/* Police Mont (charte SOCARA) servie localement, graisses épinglées 300 / 400 / 700 */
@font-face { font-family: 'Mont'; src: url('fonts/Mont-Light.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Mont'; src: url('fonts/Mont-Book.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Mont'; src: url('fonts/Mont-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* Charte SOCARA */
  --rouge: #E30613; --rouge-fonce: #B00010; --jaune: #FFDD00; --jaune-dore: #D4A800;
  --anthracite: #1A1A1A; --gris-fer: #3D3D3A; --gris-beton: #9E9E96; --gris-moyen: #B8B8B0;
  --gris-clair: #F4F4F2; --blanc: #FFFFFF; --bord: #E5E5E2; --bord-doux: #EEEEEC;
  /* police de l'écran : --police est posée par Réglages → Affichage → Police (Mont par défaut) */
  font-family: var(--police, 'Mont', 'Barlow', sans-serif);

  /* Thème SOCARA */
  --bandeau: var(--rouge); --sous-barre: var(--anthracite); --onglet-actif: var(--jaune); --signature: var(--jaune);
  --cartouche: rgba(0,0,0,.18); --montant-bg: var(--jaune); --montant-txt: var(--anthracite);
  --accent: var(--rouge); --accent-fonce: var(--rouge-fonce); --accent-doux: rgba(227,6,19,.12);
  --cote-bg: var(--anthracite); --cote-txt: #fff; --cote-sel: var(--gris-fer); --cote-marque: var(--jaune); --cote-champ: var(--gris-fer);
  /* Déboursé */
  --db-entete-bg: #F3E3E4; --db-entete-txt: var(--rouge-fonce); --db-entete-bord: #E4B9BC;
  --db-pied-bg: #ECECE8; --db-pale: #8E8E88;
  /* Devis */
  --dv-entete-bg: #ECECE8; --dv-entete-txt: var(--gris-fer); --dv-entete-bord: #CFCFC8;
  --dv-montant: #FFF6BF; --dv-titre: var(--rouge); --dv-total-bg: var(--anthracite); --dv-total-txt: #fff;
  --nat-MO: #2E7D32; --nat-ML: #6b6b66; --nat-MX: var(--rouge); --nat-DI: #6b6b66;
  --so-bg: #F4F1EC; --filet-so: rgba(120,120,110,.45); --survol: #F6F6F2; --sel: #FFF4C2; --sel-bord: #E5C24A;
}
/* Thème « Onaya » : reprend les couleurs de l'Onaya violet de SOCARA */
:root[data-couleurs="onaya"] {
  --bandeau: #5B2E91; --sous-barre: #4A2380; --onglet-actif: #F28B3C; --signature: transparent;
  --cartouche: rgba(255,255,255,.10); --montant-bg: #F58B4C; --montant-txt: #fff;
  --accent: #5B2E91; --accent-fonce: #43206F; --accent-doux: rgba(91,46,145,.14);
  --cote-bg: #F2F2F2; --cote-txt: #2b2b2b; --cote-sel: #E6DDF2; --cote-marque: #5B2E91; --cote-champ: #fff;
  --db-entete-bg: #DCEFC8; --db-entete-txt: #4E8A2A; --db-entete-bord: #A7D27F;
  --db-pied-bg: #E7E7E7; --db-pale: #8A8A8A;
  --dv-entete-bg: #C9EEF0; --dv-entete-txt: #1E7F86; --dv-entete-bord: #6CC9CF;
  --dv-montant: #C8FBFF; --dv-titre: #23848C; --dv-total-bg: #17BDBD; --dv-total-txt: #fff;
  --nat-MO: #3C9A2A; --nat-ML: #7a7a7a; --nat-MX: #D0393A; --nat-DI: #7a7a7a;
  --so-bg: #F3EFF9; --filet-so: rgba(91,46,145,.40); --survol: #F7F5FB; --sel: #E9E0F5; --sel-bord: #9A7CC4;
}

* { box-sizing: border-box; }
/* L'attribut hidden doit toujours masquer, même un élément qui reçoit un display (fenêtre, bascules…) */
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: #fff; color: var(--anthracite); font-size: 12.5px; font-weight: 300; line-height: 1.35; }
button, input, select { font: inherit; color: inherit; }
b, strong, th { font-weight: 700; }
.corps { display: flex; height: 100vh; }

/* Colonne des études */
#cote { width: 250px; flex: none; background: var(--cote-bg); color: var(--cote-txt); display: flex; flex-direction: column; border-right: 1px solid var(--bord); }
.cote-tete { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bandeau); color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; min-height: 62px; position: relative; }
.cote-tete::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--signature); }
.cote-tete small { font-weight: 300; font-size: 12px; }
.casque { height: 32px; }
/* Menu du panneau gauche : accueil puis vues de l'étude (comme Onaya) */
.menu-cote { display: flex; flex-direction: column; padding: 10px 0; overflow-y: auto; flex: 1; }
.menu-cote.hors-etude > :not([data-accueil-menu]):not([data-stats-menu]):not([data-responsables-menu]):not([data-recherche-menu]) { display: none; }
.menu-cote button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 16px; border: none; border-left: 4px solid transparent; background: none; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.menu-cote button svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.menu-cote button:hover:not(:disabled) { background: var(--cote-sel); }
.menu-cote button.actif { background: var(--cote-sel); border-left-color: var(--cote-marque); font-weight: 700; }
.menu-cote button:disabled { opacity: .35; cursor: default; }
.menu-cote button.action { font-style: italic; }
.menu-cote .pastille { margin-left: auto; }
.menu-groupe { margin: 14px 16px 4px; padding-top: 10px; border-top: 1px solid rgba(127,127,127,.25); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.couleurs { padding: 10px 12px; border-top: 1px solid var(--bord); display: flex; gap: 8px; align-items: center; font-size: 12px; }
.couleurs select { padding: 2px 8px; }

/* Bandeau façon Onaya : nom de la vue, cartouche de l'étude, montant H.T. */
#principal { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bandeau { position: relative; background: var(--bandeau); color: #fff; display: flex; align-items: center; gap: 14px; padding: 8px 14px; min-height: 62px; flex: none; }
.bandeau::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--signature); }
.nom-vue { font-size: 20px; font-weight: 400; min-width: 150px; }
.cartouche { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: var(--cartouche); border-radius: 6px; padding: 4px 12px; }
.cartouche .i { width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--bandeau); font-weight: 700; display: grid; place-items: center; font-family: Georgia, serif; flex: none; }
.cartouche > div { flex: 1; min-width: 0; overflow: hidden; } /* titre long coupé par « … » au lieu de passer sous le montant */
.cartouche small { display: block; font-weight: 700; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartouche b { display: block; font-weight: 400; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .2px; }
.montant-ht { flex: none; background: var(--montant-bg); color: var(--montant-txt); border-radius: 6px; padding: 4px 14px; text-align: left; min-width: 140px; }
.montant-ht small { display: block; font-size: 12px; font-weight: 700; opacity: .9; }
.montant-ht b { font-size: 16px; font-weight: 400; white-space: nowrap; }
.sous-barre { background: var(--sous-barre); display: flex; gap: 2px; padding: 0 14px; flex: none; flex-wrap: wrap; }
.sous-barre button { background: none; border: none; color: #fff; padding: 8px 14px 6px; font-size: 12px; cursor: pointer; border-bottom: 3px solid transparent; }
.sous-barre button.actif { border-bottom-color: var(--onglet-actif); font-weight: 700; }
.sous-barre .sep { flex: 1; }
.pastille { background: #E30613; color: #fff; border-radius: 20px; padding: 0 6px; font-size: 10px; margin-left: 4px; }
.pastille:empty { display: none; }

.contenu { flex: 1; overflow: auto; padding: 10px 16px 16px; }
/* Accueil : suivi des affaires */
.accueil { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; }
.accueil[hidden] { display: none; }
.accueil-barre { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.accueil-barre .sep { flex: 1; }
.bt.bt-tuile { border-radius: 6px; padding: 8px 14px; font-size: 11px; background: #fff; }
.bt.bt-accent { border-radius: 6px; padding: 10px 20px; font-size: 12px; background: var(--montant-bg); color: var(--montant-txt); border-color: var(--montant-bg); }
.bt-tuile:disabled, .bt-accent:disabled { opacity: .45; cursor: default; }
.accueil-titre { margin: 4px 0 0; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--gris-fer); }
.accueil-recentes { display: flex; gap: 8px; flex-wrap: wrap; }
.carte-recente { display: flex; flex-direction: column; gap: 2px; width: 210px; text-align: left; background: #fff; border: 1px solid var(--bord); border-radius: 6px; padding: 6px 10px; cursor: pointer; font: inherit; }
.carte-recente:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.carte-recente small { color: var(--accent); font-weight: 700; }
.carte-recente b { font-weight: 400; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte-recente span { color: var(--gris-fer); font-size: 11px; }
.accueil-recherche { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.accueil-recherche input { flex: 1; min-width: 240px; padding: 8px 12px; border: 1px solid var(--bord); border-radius: 6px; font-size: 14px; }
.accueil-table { flex: 1; min-height: 200px; }
/* Accueil : page Statistiques (à la place de la liste des affaires) */
#vide.page-stats > :not(#acStats), #vide.page-responsables > :not(#acResponsables), #vide.page-recherche > :not(#acRecherche) { display: none; }
.rt-resultats table { margin: 0; }
.rt-resultats .st-lib { max-width: 190px; }
.rt-resultats td { white-space: nowrap; }
.rt-texte { color: var(--gris-beton); }
#acRecherche table.st-table { width: 100%; }
/* reste à l'écran quand la page défile, par-dessus le tableau, sans le décaler */
.barre-recherche { position: sticky; top: 4px; z-index: 30; display: flex; align-items: center; gap: 6px; width: fit-content; max-width: 100%; margin: 0 0 -46px auto; padding: 6px 8px; background: var(--blanc); border: 1px solid var(--bord); border-radius: 8px; box-shadow: 0 3px 12px rgba(0,0,0,.18); }
.barre-recherche[hidden] { display: none; }
.barre-recherche input { width: 320px; max-width: 100%; padding: 5px 10px; border: 1.5px solid var(--accent); border-radius: 6px; font-size: 13px; }
.barre-recherche span { min-width: 70px; text-align: right; font-size: 12px; color: var(--gris-fer); font-variant-numeric: tabular-nums; }
.ac-stats { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; overflow: auto; }
.ac-stats[hidden] { display: none; }
.st-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.st-haut { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: flex-start; }
.st-bloc { flex: 1 1 340px; min-width: 0; }
.st-graphe { display: flex; align-items: stretch; gap: 2px; height: 170px; margin-top: 6px; max-width: 560px; }
.st-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; background: none; border: 0; border-radius: 4px; padding: 0 4px; cursor: pointer; font: inherit; }
.st-col:hover { background: var(--survol); }
.st-val { font-size: 12px; font-weight: 700; color: var(--anthracite); font-variant-numeric: tabular-nums; }
.st-barre { display: block; width: 100%; max-width: 34px; flex: 0 1 auto; min-height: 0; background: var(--accent); border-radius: 4px 4px 0 0; }
.st-an { width: 100%; padding-top: 3px; border-top: 1px solid var(--gris-moyen); font-size: 11px; color: var(--gris-fer); font-variant-numeric: tabular-nums; }
.st-col.terne .st-barre { background: var(--gris-moyen); }
.st-col.actif .st-an { font-weight: 700; color: var(--anthracite); }
#acStats table.st-table { width: 100%; }
.st-table td.n, .st-table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-ligne { cursor: pointer; }
.st-ligne:hover td { background: var(--survol); }
.st-ligne.sel td { background: var(--sel); }
.st-reps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
.st-rep { min-width: 0; }
#acStats .st-rep-liste { height: auto; max-height: 245px; overflow: auto; margin-top: 6px; flex: none; }
.st-rep .st-table { margin: 0; table-layout: fixed; }
.st-rep .st-table th:nth-child(n+2), .st-rep .st-table td:nth-child(n+2) { width: 66px; }
.st-rep-val { overflow: hidden; }
.st-rep-nom { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-mini { display: block; height: 3px; margin-top: 2px; background: var(--accent); border-radius: 2px; }
.st-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-liste { flex: 0 0 auto; overflow: visible; }
/* Page Responsables */
#acResponsables { --rs-cours: #8A9BB5; --rs-attente: #2F6BD8; --rs-gagne: #0B7A5E; --rs-perdu: #EE8434; gap: 14px; padding-bottom: 8px; }
.rs-cours { background: var(--rs-cours); } .rs-attente { background: var(--rs-attente); } .rs-gagne { background: var(--rs-gagne); } .rs-perdu { background: var(--rs-perdu); }
.rs-filtres { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rs-pilules { display: inline-flex; gap: 2px; padding: 3px; background: var(--gris-clair); border-radius: 20px; flex-wrap: wrap; }
.rs-pilule { border: 0; background: none; padding: 4px 14px; border-radius: 16px; font: inherit; font-size: 12px; color: var(--gris-fer); cursor: pointer; font-variant-numeric: tabular-nums; }
.rs-pilule:hover { background: var(--blanc); }
.rs-pilule.actif { background: var(--blanc); color: var(--anthracite); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.rs-une { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(360px, 2.2fr) minmax(170px, auto); gap: 12px; }
.rs-vedette, .rs-repart, .rs-mini > div, .rs-carte { background: var(--blanc); border: 1px solid var(--bord); border-radius: 12px; }
.rs-vedette { padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; gap: 4px; background: var(--bandeau); border-color: transparent; color: #fff; }
.rs-vedette span { font-size: 12px; opacity: .9; }
.rs-vedette small { font-size: 12px; opacity: .9; }
.rs-gros { font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-repart { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rs-etiq { font-size: 12px; color: var(--gris-fer); }
.rs-piste { display: block; height: 12px; }
.rs-piste-g { height: 16px; }
.rs-barre { display: flex; gap: 2px; height: 100%; min-width: 0; }
.rs-seg { display: block; min-width: 3px; height: 100%; transition: opacity .12s; }
.rs-seg:first-child { border-radius: 4px 0 0 4px; } .rs-seg:last-child { border-radius: 0 4px 4px 0; } .rs-seg:only-child { border-radius: 4px; }
.rs-seg:hover { opacity: .75; }
.rs-pt { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 3px; }
.rs-legs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.rs-leg { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; padding: 5px 7px; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; font: inherit; color: var(--gris-fer); cursor: pointer; min-width: 0; }
.rs-leg:hover { background: var(--survol); }
.rs-leg.actif { background: var(--accent-doux); border-color: var(--accent); }
.rs-leg-txt { font-size: 11px; }
.rs-leg b { grid-column: 1 / -1; font-size: 14px; color: var(--anthracite); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-leg small { grid-column: 1 / -1; font-size: 11px; }
.rs-mini { display: grid; grid-auto-rows: 1fr; gap: 8px; }
.rs-mini > div { padding: 7px 12px; display: flex; flex-direction: column; justify-content: center; }
.rs-mini span, .rs-mini small { font-size: 11px; color: var(--gris-fer); }
.rs-mini b { font-size: 16px; color: var(--anthracite); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.rs-carte { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; text-align: left; font: inherit; color: var(--anthracite); cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.rs-carte:hover { box-shadow: 0 3px 12px rgba(0,0,0,.1); }
.rs-carte:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rs-carte.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rs-tete { display: flex; align-items: center; gap: 10px; }
.rs-avatar { flex: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-doux); color: var(--accent-fonce); font-size: 13px; font-weight: 700; }
.rs-qui { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rs-qui b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rs-qui small, .rs-ca small { font-size: 11px; color: var(--gris-fer); }
.rs-ca { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.rs-ca b { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-cases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rs-case { display: flex; flex-direction: column; min-width: 0; }
.rs-case-t { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--gris-fer); white-space: nowrap; }
.rs-case b { font-size: 15px; font-variant-numeric: tabular-nums; }
.rs-case small { font-size: 11px; color: var(--gris-fer); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-case.vide b, .rs-case.vide small { color: var(--gris-beton); font-weight: 400; }
.rs-pied { display: flex; justify-content: space-between; gap: 10px; padding-top: 8px; border-top: 1px solid var(--bord-doux); font-size: 11px; color: var(--gris-fer); }
.rs-pied b { color: var(--anthracite); font-variant-numeric: tabular-nums; }
.fa-responsables { display: flex; flex-wrap: wrap; gap: 5px 16px; padding: 3px 0; }
.fa-responsables .case { white-space: nowrap; }
.rs-avec { color: var(--gris-fer); }
#rsBulle { position: fixed; z-index: 90; max-width: 320px; padding: 5px 9px; border-radius: 6px; background: var(--anthracite); color: #fff; font-size: 12px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#acResponsables .rs-table { flex: 0 0 auto; height: auto; max-height: none; overflow: visible; }
#acResponsables table.st-table { width: 100%; }
.rs-groupe td { background: var(--gris-clair); padding-top: 6px; color: var(--anthracite); }
#acResponsables .st-lib { max-width: 300px; }
.rs-client { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-autres { display: block; font-size: 10px; color: var(--gris-fer); white-space: nowrap; }
.rs-depuis { color: var(--gris-beton); white-space: nowrap; }
@media (max-width: 1100px) { .rs-une { grid-template-columns: 1fr; } .rs-mini { grid-auto-flow: column; grid-auto-columns: 1fr; } }
.st-lib { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-versions { white-space: normal; }
.st-version { font: inherit; font-size: 11.5px; background: #fff; border: 1px solid var(--bord); border-radius: 4px; padding: 1px 6px; margin: 1px 4px 1px 0; cursor: pointer; }
.st-version:hover { border-color: var(--accent); color: var(--accent); }
#acListe { width: 100%; border-collapse: collapse; table-layout: fixed; }
/* largeurs : la désignation prend la place restante */
#acListe th:nth-child(1) { width: 135px; } #acListe th:nth-child(3) { width: 11%; } #acListe th:nth-child(4) { width: 9%; }
#acListe th:nth-child(5) { width: 115px; white-space: normal; } #acListe th:nth-child(6) { width: 100px; } #acListe th:nth-child(7) { width: 100px; }
#acListe th:nth-child(8) { width: 92px; } #acListe th:nth-child(9) { width: 52px; } #acListe th:nth-child(10) { width: 82px; white-space: normal; }
#acListe th { position: sticky; top: 0; cursor: pointer; user-select: none; white-space: nowrap; }
#acListe th.trie { color: var(--accent); }
#acListe td { padding: 5px 8px; border-bottom: 1px solid var(--bord-doux); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* chiffres : police système à chiffres de même largeur (Mont les a larges et inégaux), colonnes secondaires en gris */
#acListe td.n { font-family: 'Segoe UI', system-ui, sans-serif; font-variant-numeric: tabular-nums; font-size: 12.5px; letter-spacing: 0; }
#acListe td:nth-child(7) { color: var(--anthracite); font-weight: 600; }
#acListe td:nth-child(8), #acListe td:nth-child(9), #acListe td:nth-child(10) { color: var(--gris-fer); }
#acListe td:nth-child(10) { font-family: 'Segoe UI', system-ui, sans-serif; font-variant-numeric: tabular-nums; font-size: 12.5px; }

#acListe td:first-child { white-space: nowrap; }
#acListe tbody tr:hover td { background: var(--gris-clair); }
#acListe tr.sel td { background: color-mix(in srgb, var(--accent) 14%, #fff); }
#acListe tr.ouverte td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.statut-ac { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: #eef1f4; color: #445; white-space: nowrap; }
.statut-ac.s1 { background: #e3eefc; color: #1f4f8f; }
.statut-ac.s2 { background: #dff3e4; color: #1d6b34; }
.statut-ac.s3 { background: #f6e0e0; color: #8a2525; }
.statut-ac.s-annexe { background: transparent; border: 1px dashed #b8bec6; color: #7a828c; }
#acListe tr.annexe td { color: #8a929b; }
.onglet-accueil { padding-right: 10px; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 2px solid var(--jaune); display: inline-block; }
.legende { color: var(--gris-beton); font-size: 11.5px; margin: 6px 0; }
.kpis { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 6px; color: var(--gris-fer); font-size: 12px; }
.kpis[hidden] { display: none !important; }
.kpis span b { color: var(--anthracite); font-variant-numeric: tabular-nums; }
.kpis .kpi small { font-size: inherit; } .kpis .kpi small::after { content: ' :'; } /* « libellé : valeur » ; tuiles avec la charte (charte-composants.css) */

.barre { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
input, select { background: #fff; border: 1.5px solid var(--bord); border-radius: 10px; padding: 4px 10px; font-weight: 400; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.barre input[type=search] { min-width: 240px; }
.bt { border-radius: 50px; padding: 5px 14px; font-weight: 700; font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; cursor: pointer;
  background: var(--gris-clair); color: var(--gris-fer); border: 1px solid var(--bord); }
.bt:hover { border-color: var(--gris-beton); }
.bt-plein { background: var(--accent); color: #fff; border-color: var(--accent); }
.case { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; cursor: pointer; }
.case input { accent-color: var(--accent); }
.segments { display: inline-flex; border: 1.5px solid var(--accent); border-radius: 50px; overflow: hidden; }
.segments button { border: none; background: #fff; color: var(--accent); padding: 4px 14px; font-weight: 700; font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; }
.segments button.actif { background: var(--accent); color: #fff; }

.table-wrap { overflow: auto; max-height: calc(100vh - 205px); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 1px 6px; text-align: left; vertical-align: top; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.c, th.c { text-align: center; }
/* Cases modifiables : toujours visibles (fond clair et bordure) */
input.q { width: 86px; text-align: right; padding: 0 4px; border: 1px solid #D9D2A6; border-radius: 4px; background: #FFFDF0; font-size: inherit; font-weight: inherit; }
input.q:hover { border-color: var(--gris-beton); background: #fff; }
input.q:focus { border-color: var(--accent); background: #fff; box-shadow: none; }
.modifiable { cursor: text; border-radius: 3px; }
.modifiable:hover { background: #FFFDF0; box-shadow: 0 0 0 1px #D9D2A6; }

/* Lignes : survol, ligne sélectionnée (simple clic), ligne visée par le menu (clic droit) */
#tDevis tr[data-act]:hover > td { background-color: var(--survol); }
#tDevis tr[data-act].sel > td { background-color: var(--sel); }
#tDevis tr[data-act].cible-menu > td { background-color: var(--sel); box-shadow: inset 0 1px 0 var(--sel-bord), inset 0 -1px 0 var(--sel-bord); }
#tDevis tr[data-act] { user-select: none; }
#tDevis tr[data-act] input, #tDevis [data-zone] { user-select: text; }
/* Repère [T]/[O]/[R] : ouvre le menu de la ligne */
#tDevis td.rep[data-menu] { cursor: pointer; border-radius: 3px; }
#tDevis td.rep[data-menu]:hover { color: #fff !important; background: var(--accent) !important; }
/* Vue Devis : poignée ⋮ avant le code, visible au survol */
.poignee { display: inline-block; width: 12px; margin-left: -14px; color: var(--accent); cursor: pointer; visibility: hidden; font-weight: 700; text-align: center; border-radius: 3px; }
#tDevis tr:hover .poignee, #tDevis tr.cible-menu .poignee { visibility: visible; }
.poignee:hover { background: var(--accent); color: #fff; }
.devis tbody td:first-child { padding-left: 16px; }
/* Texte modifié sur place et sa barre de mise en forme */
.zone-texte { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; border-radius: 2px; min-height: 1.4em; white-space: normal; cursor: text; padding: 0 2px; }
.barre-texte { position: fixed; z-index: 45; display: flex; gap: 3px; align-items: center; background: #fff; border: 1px solid #CFCFCF; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 3px 6px; }
.barre-texte button, .outils-mini button { min-width: 24px; height: 22px; border: 1px solid #CFCFCF; background: #fff; border-radius: 4px; cursor: pointer; font-size: 12px; }
.barre-texte button:hover, .outils-mini button:hover { border-color: var(--accent); }
.barre-texte .coul, .outils-mini .coul { width: 18px; min-width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #AAA; }
.barre-texte .sep { width: 1px; height: 16px; background: var(--bord); margin: 0 3px; }
.barre-texte .aide { font-size: 10.5px; color: var(--gris-beton); margin-left: 6px; }
.saisie-riche { border: 1px solid #C9C9C9; border-radius: 4px; }
.outils-mini { display: flex; gap: 3px; padding: 3px; border-bottom: 1px solid var(--bord); background: #F7F7F5; }
.saisie-riche .zone-texte { outline: none; min-height: 64px; padding: 4px 8px; }
/* Libellé court de la fiche d'ouvrage : zone de 2 lignes au départ, qui grandit avec le texte */
.fi-libelle .saisie-riche { margin-top: 2px; background: #fff; }
.fi-libelle .zone-texte { min-height: 2.8em; font-size: 13px; line-height: 1.4; }
.fi-libelle .saisie-riche:focus-within { border-color: var(--accent); }
.lib-riche { line-height: 1.3; }
.saisie-titre input { font-size: 13px; padding: 1px 6px; border: 1px solid var(--accent); border-radius: 4px; }
/* Fiche d'ouvrage ou de ressource : au-dessus du tableau (déplaçable) ou ancrée à droite, même contenu */
.flottant { position: fixed; z-index: 35; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--gris-beton); border-radius: 8px; overflow: hidden; box-shadow: 0 14px 40px rgba(0,0,0,.32); font-size: 12.5px; }
.flottant:focus { outline: none; }
.flottant.ancre { border-width: 0 0 0 1px; border-radius: 0; box-shadow: -6px 0 18px rgba(0,0,0,.16); }
.flottant header { flex: none; padding: 8px 14px; background: var(--gris-clair); border-bottom: 1px solid var(--bord); cursor: move; user-select: none; touch-action: none; }
.flottant.ancre header { cursor: default; }
.fi-tete { display: flex; align-items: center; gap: 6px; }
.fi-tete b { font-size: 17px; font-weight: 700; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fi-espace { flex: 1; }
.fi-genre { flex: none; padding: 2px 9px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.fi-genre[data-nature="MainOeuvre"] { background: var(--nat-MO); }
.fi-genre[data-nature="Materiaux"] { background: var(--nat-MX); }
.fi-genre[data-nature="Materiel"], .fi-genre[data-nature="Divers"] { background: var(--gris-fer); }
.fi-b { flex: none; min-width: 28px; height: 28px; padding: 0 7px; border: 1px solid var(--bord); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; white-space: nowrap; }
.fi-b:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.fi-b:disabled { opacity: .35; cursor: default; }
.fi-lib { margin-top: 3px; color: var(--gris-fer); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-resultat { flex: none; display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: var(--sous-barre); color: #fff; font-size: 11px; }
.fi-resultat b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; }
.fi-resultat small { font-size: 11px; font-weight: 300; }
.fi-deb { flex: 1; }
.fi-vente { padding: 4px 12px; border-radius: 6px; background: var(--montant-bg); color: var(--montant-txt); }
.fi-onglets { flex: none; display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 14px 0; border-bottom: 1px solid var(--bord); }
.fi-onglets button { padding: 5px 12px; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; background: none; cursor: pointer; font-size: 12px; white-space: nowrap; color: var(--gris-fer); }
.fi-onglets button:hover { color: var(--accent); }
.fi-onglets button.on { background: #fff; border-color: var(--bord); box-shadow: inset 0 3px 0 var(--accent); font-weight: 700; color: var(--anthracite); }
#flottantCorps { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px 14px; }
.fi-corps { display: flex; flex-direction: column; gap: 14px; }
.fi-groupe { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fi-groupe h3 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-fonce); }
.fi-colonnes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.flottant.ancre .fi-colonnes { grid-template-columns: minmax(0, 1fr); }
.fi-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fi-plein { grid-column: 1 / -1; }
.fi-prix { max-width: 340px; }
.fi-champ { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 11px; font-weight: 400; color: var(--gris-fer); }
.fi-champ input, .fi-champ select { width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--dv-entete-bord); border-radius: 5px; background: #fff; font-size: 12.5px; color: var(--anthracite); min-width: 0; }
.fi-champ input:disabled { background: var(--gris-clair); color: var(--gris-fer); }
.fi-n input { text-align: right; }
.fi-seg { display: flex; border: 1px solid var(--dv-entete-bord); border-radius: 6px; overflow: hidden; }
.fi-seg button { flex: 1; height: 28px; padding: 0 6px; border: none; border-right: 1px solid var(--dv-entete-bord); background: #fff; cursor: pointer; font-size: 12px; white-space: nowrap; }
.fi-seg button:last-child { border-right: none; }
.fi-seg button:hover:not(.on) { background: var(--survol); }
.fi-seg button.on { background: var(--accent); color: #fff; font-weight: 700; }
.fi-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fi-table th { padding: 3px 8px; background: var(--db-entete-bg); color: var(--db-entete-txt); border: 1px solid var(--db-entete-bord); font-size: 11px; font-weight: 400; text-align: left; white-space: nowrap; }
.fi-table th.n, .fi-table td.n { text-align: right; white-space: nowrap; }
.fi-table td { padding: 4px 8px; border-bottom: 1px solid var(--bord-doux); }
.fi-cliquable tr[data-fi-spec] { cursor: default; }
.fi-cliquable tr[data-fi-spec]:hover td { background: var(--survol); }
.fi-cliquable tr.fi-sel td { background: var(--survol); box-shadow: inset 0 -1px 0 var(--accent); }
.fi-table td { vertical-align: middle; }
.fi-table input.champ { width: 100%; min-width: 0; box-sizing: border-box; padding: 0 4px; }
.fi-table td.n input.champ { min-width: 64px; }
.fi-table input.champ[readonly] { cursor: default; border-color: transparent; background: transparent; text-overflow: ellipsis; }
.fi-table input.champ[readonly]:hover { border-color: #D9D2A6; background: transparent; }
.fi-table input.champ:not([readonly]) { border-color: var(--accent); background: #fff; cursor: text; }
.fi-table input.champ.u { text-align: center; width: 56px; min-width: 56px; }
.fi-table input.champ.lib { text-align: left; color: inherit; font-weight: inherit; min-width: 240px; }
.fi-texte[data-fi-texte], .fi-note-ligne td[data-fi-note] { cursor: text; }
.fi-note-ligne .sd-note-saisie { width: 100%; box-sizing: border-box; font-style: normal; }
.fi-so { font-weight: 700; }
.fi-nota td { color: var(--gris-beton); text-decoration: line-through; }
.fi-note-ligne td { font-style: italic; white-space: pre-line; color: var(--gris-fer); }
.flottant.ancre .fi-large { display: none; }
.fi-note { font-size: 12px; color: var(--gris-fer); margin: 0; }
.fi-alerte { padding: 6px 10px; border-radius: 5px; background: var(--dv-montant); font-size: 12px; }
.fi-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 8px; border-top: 1px solid var(--bord-doux); }
.fi-actions .fi-note { flex: 1; }
.fi-texte { white-space: pre-line; line-height: 1.4; }
.fi-texte .l1 { font-weight: 700; }
.fi-ligne { flex: none; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 8px 14px 10px; background: var(--gris-clair); border-top: 1px solid var(--bord); }
.fi-ligne[hidden] { display: none; }
.fi-dans { width: 100%; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-fonce); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-etats { flex: 1 1 220px; min-width: 200px; }
.fi-ligne .fi-champ { flex: 0 0 82px; }
body.lecture-seule #flottant .fi-seg button, body.lecture-seule #flottant [data-remplacer], body.lecture-seule #flottant [data-fi-texte] { pointer-events: none; opacity: .6; }
input.nom-coef { width: 170px; padding: 0 6px; border: 1px solid #D9D2A6; border-radius: 4px; background: #FFFDF0; font-size: inherit; }
.menu-ligne { position: fixed; z-index: 40; background: #fff; border: 1px solid #CFCFCF; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18); min-width: 230px; font-size: 12px; overflow: hidden; }
.menu-ligne button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 5px 14px; cursor: pointer; }
.menu-ligne button:hover { background: var(--accent-doux); }
.menu-ligne button.danger { color: #B42318; }
.menu-ligne .lot { padding: 3px 0; }
.menu-ligne .lot + .lot { border-top: 1px solid var(--bord); }
.menu-ligne .titre-menu { padding: 4px 14px 2px; color: var(--lot-titre, var(--gris-beton)); font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
/* Une couleur par lot, sur son titre seulement : les lignes restent sur fond blanc */
.menu-ligne .lot-bleu { --lot-titre: #1F5F99; }
.menu-ligne .lot-vert { --lot-titre: #1E7A3E; }
.menu-ligne .lot-ambre { --lot-titre: #8A5A00; }
.menu-ligne .lot-violet { --lot-titre: #5B3E96; }
.menu-ligne .lot-rose { --lot-titre: #A3341F; }

/* Fenêtres simples (nouvelle étude, bibliothèque) */
.fenetre-simple { width: min(520px, 100%); background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; max-height: 100%; }
.fenetre-simple.large { width: min(980px, 100%); height: min(720px, 100%); }
.an-fenetre { width: min(620px, 100%); }
.an-corps { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.an-ligne { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; }
.an-ligne[hidden] { display: none; }
.an-ligne > span { color: var(--gris-fer); font-size: 13px; }
.an-ligne input:not([type=radio]), .an-ligne select { min-width: 0; width: 100%; box-sizing: border-box; }
.an-choix { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.an-choix input[name=qte] { width: 90px; }
.an-bases { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; }
.an-bases label { grid-column: 1; white-space: nowrap; }
.an-bases .an-titre { grid-column: 2; }
.an-corps .legende { min-height: 18px; margin: 4px 0 0; }
.fenetre-simple header { background: var(--bandeau); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 15px; }
.fenetre-simple footer { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--bord); background: #F4F4F4; }
.fenetre-simple .fa-grille input, .fenetre-simple .fa-grille select { border-radius: 4px; padding: 4px 8px; border: 1px solid #C9C9C9; width: 100%; }
.biblio-onglets { display: flex; gap: 2px; background: var(--sous-barre); padding: 0 10px; }
.biblio-onglets button { background: none; border: none; color: #fff; padding: 7px 14px 5px; border-bottom: 3px solid transparent; cursor: pointer; font-size: 12px; }
.biblio-onglets button.actif { border-bottom-color: var(--onglet-actif); font-weight: 700; }
.biblio-corps { flex: 1; overflow: auto; padding: 12px 14px; }
/* validation Claude : le tableau prend la hauteur restante et défile seul (une seule barre) */
#voileValidation .biblio-corps { display: flex; flex-direction: column; min-height: 0; }
#voileValidation .vc-tableau { flex: 1 1 auto; min-height: 120px; max-height: none; }
#biblioQ { width: 100%; }
#tBiblio tbody tr:hover td { background: var(--accent-doux); }
.nouvelle { margin: 10px 12px 0; }
.sous-barre button.action { opacity: .9; font-style: italic; }

/* Éditeur de texte mis en forme */
.editeur { border: 1px solid var(--accent); border-radius: 6px; background: #fff; margin: 4px 0; }
.editeur .outils { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 6px; border-bottom: 1px solid var(--bord); background: #F7F7F5; border-radius: 6px 6px 0 0; }
.editeur .outils button { min-width: 26px; height: 24px; border: 1px solid #CFCFCF; background: #fff; border-radius: 4px; cursor: pointer; font-size: 12px; }
.editeur .outils button:hover { border-color: var(--accent); }
.editeur .outils .coul { width: 20px; min-width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #AAA; }
.editeur .outils .sep { width: 1px; height: 18px; background: var(--bord); margin: 0 4px; }
.editeur .zone { min-height: 70px; max-height: 340px; overflow: auto; padding: 6px 8px; outline: none; font-size: 12px; line-height: 1.4; }
.editeur .pied { display: flex; justify-content: flex-end; gap: 6px; padding: 4px 6px 6px; }
.edition-ligne { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-end; padding: 4px 0; }
.edition-ligne label { display: flex; flex-direction: column; font-size: 10px; font-weight: 700; color: var(--gris-fer); text-transform: uppercase; letter-spacing: .5px; gap: 2px; }
.edition-ligne input { font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.fl { display: inline-block; width: 14px; color: var(--accent); cursor: pointer; font-size: 10px; user-select: none; }
.fl.sans-sd { color: transparent; cursor: default; } /* ouvrage sans sous-détail : flèche masquée */
.lien { cursor: pointer; }
.lien:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ecart { color: #E30613 !important; font-weight: 700; }
.tag-tp { background: var(--jaune); color: var(--anthracite); border-radius: 6px; padding: 0 5px; font-size: 9px; font-weight: 700; }
.texte { white-space: pre-line; }
.texte .l1 { font-weight: 700; }

/* ===== Vue DÉBOURSÉ (Onaya « Détaillé ») ===== */
table.debourse { width: auto; min-width: 1150px; }
.debourse tr.pied-db { display: none; } /* total déboursé sec et TOTAL H.T. : thème Charte seulement (charte-composants.css) */
.debourse thead th { position: sticky; top: 0; z-index: 2; background: var(--db-entete-bg); color: var(--db-entete-txt); font-weight: 400; font-size: 11px; text-align: center; border: 1px solid var(--db-entete-bord); padding: 2px 6px; }
.debourse td.rep { color: #444; font-family: Consolas, 'Courier New', monospace; font-size: 11px; white-space: nowrap; width: 28px; padding-right: 0; }
.debourse tr.titre td { padding-top: 14px; font-size: 17px; font-weight: 400; color: var(--dv-titre); border-bottom: 1px solid var(--dv-titre); }
.debourse tr.titre td.rep { font-size: 11px; color: #444; }
.debourse tr.titre.niv1 td { font-size: 14px; }
.debourse tr.ouv td { padding-top: 10px; }
.debourse tr.ouv td.code { font-weight: 700; white-space: nowrap; }
.debourse tr.ouv td.vb { vertical-align: bottom; font-weight: 700; }
.debourse td.desig { width: 340px; max-width: 340px; }
.debourse tr.sentete td { background: var(--db-entete-bg); color: var(--db-entete-txt); font-size: 10.5px; text-align: center; border: 1px solid var(--db-entete-bord); padding: 0 4px; }
.debourse tr.sd td.bloc { border-left: 1px solid var(--db-entete-bord); }
.debourse tr.sd td { font-size: 11.5px; padding-top: 0; padding-bottom: 0; vertical-align: middle; }
.debourse tr.sd.so td { font-weight: 700; font-size: 12px; }
/* Sous-ouvrage : bande teintée sur sa ligne ; son contenu est relié par un filet vertical */
.debourse tr.sd.so > td:not(:first-child) { background-color: var(--so-bg); }
.debourse tr.sd.so td.code .fl { color: var(--accent); }
.debourse tr.sd.pale td { color: var(--db-pale); font-size: 11px; }
.debourse tr.sd.pale td.nat-MainOeuvre, .debourse tr.sd.pale td.nat-Materiel, .debourse tr.sd.pale td.nat-Materiaux { opacity: .85; }
.debourse tr.sd td.code { white-space: nowrap; }
.debourse tr.pied td { background: var(--db-pied-bg); font-size: 11px; padding: 0 6px; }
.debourse tr.pied td.vide-pied { background: none; }
.debourse tr.total td { font-weight: 700; padding: 6px; border-top: 1px solid var(--dv-titre); }
.debourse tr.nota td { text-decoration: line-through; color: var(--gris-beton) !important; }
.debourse tr.options td { background: #FAFAF8; }
.nat-MainOeuvre { color: var(--nat-MO); }
.nat-Materiel { color: var(--nat-ML); }
.nat-Materiaux { color: var(--nat-MX); }
.nat-Divers { color: var(--nat-DI); }

/* ===== Vue DEVIS (Onaya « Devis » client) ===== */
table.devis { width: auto; min-width: 1050px; }
.devis thead th { position: sticky; top: 0; z-index: 2; background: var(--dv-entete-bg); color: var(--dv-entete-txt); font-weight: 400; font-size: 12px; text-align: center; border: 1px solid var(--dv-entete-bord); padding: 3px 6px; }
.devis td.desig { width: 440px; max-width: 440px; }
.devis tr.titre td { padding-top: 22px; padding-bottom: 4px; font-size: 20px; font-weight: 400; color: var(--dv-titre); border-bottom: 1px solid var(--dv-titre); }
.devis tr.titre.niv1 td { font-size: 17px; }
.devis tr.titre.niv2 td { font-size: 15px; }
.devis tr.titre > td:first-child, .devis tr.ouv > td:first-child { white-space: nowrap; } /* code sur une ligne, flèche comprise */
/* Titre non vendable (frais de chantier) : fond orangé, comme dans Onaya */
.debourse tr.titre.nv td, .devis tr.titre.nv td { background: #FBE3C6; }
.badge-nv { margin-left: 10px; padding: 1px 7px; border-radius: 9px; background: #E8892B; color: #fff; font-size: 11px; font-weight: 600; vertical-align: middle; white-space: nowrap; }
.fv-nv { border-left: 4px solid #E8892B; padding: 6px 10px; background: #FDF1E3; color: #333; }
.fv-rep { max-width: 980px; margin: 0 0 14px; border: 1px solid #E8892B; border-radius: 8px; background: #FFFaf4; padding: 8px 14px 12px; }
.fv-rep legend { font-weight: 700; padding: 0 6px; }
.fv-rep .ligne-rep { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 6px 0; }
.fv-rep-table { margin-top: 6px; }
.fv-rep-table tr.tot td { font-weight: 700; border-top: 1px solid #999; }
.alerte-rep { color: #B03A00; }
.devis tr.ouv td { padding-top: 16px; }
.devis tr.ouv td.vb { vertical-align: bottom; }
.devis tr.ouv td.montant { background: var(--dv-montant); }
.devis tr.ouv td.type { color: var(--dv-entete-txt); font-size: 11px; }
.devis tr.ouv td.info { color: var(--dv-entete-txt); font-size: 11px; text-align: center; }
.devis tr.total td { padding-top: 10px; padding-bottom: 10px; border-top: 1px solid var(--dv-titre); }
.devis tr.total td.lt { text-align: center; font-weight: 700; color: var(--dv-titre); }
.devis tr.total td.mt { background: var(--dv-total-bg); color: var(--dv-total-txt); font-weight: 700; text-align: right; }
.devis tr.nota td.montant { color: var(--gris-beton); }

/* Lignes de texte libre du devis (hypothèses, limites de prestation…) */
.debourse tr.texte td.bloc-texte { border: 1px solid #E8D97A; background: #FFFDF2; padding: 6px 10px; }
.devis tr.texte td { padding-top: 12px; }
.texte-riche { white-space: normal; }

/* ===== Approvisionnement (Onaya « Appro ») ===== */
table.appro { width: auto; min-width: 980px; }
.appro td { padding: 1px 6px; vertical-align: middle; }
.appro tr[data-ligne-res] { cursor: default; }
.appro tr[data-ligne-res].sel > td { background-color: var(--sel); }
.appro tr.hors-total td { color: #C25E00; font-style: italic; background: #FFF3E6; }
.appro input.appro-lib { width: 100%; min-width: 340px; font: inherit; color: inherit; padding: 0 4px; border: 1px solid transparent; border-radius: 4px; background: transparent; }
.appro input.appro-lib:hover { border-color: #D9D2A6; background: #FFFDF0; }
.appro input.appro-lib:focus { border-color: var(--accent); background: #fff; outline: none; }
.appro .lien-res { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.appro .bt-petit { padding: 1px 8px; font-size: 11px; }
#tRempl tbody tr[data-cible] { cursor: pointer; }
#tRempl tbody tr[data-cible]:hover td { background: #F6F2DC; }
#tRempl tbody tr.choisi td { background: #FFE9A8; font-weight: 600; }
.rempl-source { margin: 0 0 8px; }
#remplQ { width: 100%; padding: 5px 8px; border: 1px solid #C9C9C9; border-radius: 4px; }
.rempl-apercu { margin-top: 10px; }
.alerte-rempl { color: #B02A1A; margin: 4px 0; padding-left: 18px; }
.appro .qte-hors, .hors-total-leg { color: #C25E00; font-size: 11px; font-style: italic; }
.hors-total-leg { margin-left: 12px; padding: 0 6px; background: #FFF3E6; border-radius: 4px; }
.case-appro { margin-left: 12px; white-space: nowrap; }
.appro tr.classe td { background: #C9C9C9; border: 1.5px solid #333; font-size: 18px; font-weight: 700; padding: 4px 6px 0; }
.appro tr.classe-entete td { background: #C9C9C9; border: 1.5px solid #333; border-top: none; font-size: 13px; padding: 0 6px 2px; }
.appro tr.famille td { color: #8B2B1F; font-size: 18px; font-weight: 700; padding-top: 14px; border-bottom: 1.5px solid #8B2B1F; }
.appro tr.tot-famille td.lt { color: #B02A1A; font-weight: 700; text-align: right; font-size: 13px; padding-top: 6px; }
.appro tr.tot-famille td.mt { color: #B02A1A; font-weight: 700; text-align: right; font-size: 14px; border-top: 1.5px solid #3C9A2A; padding-top: 6px; }
.appro tr.tot-classe td.lt { color: #2E8B22; font-weight: 700; text-align: right; padding-top: 12px; padding-bottom: 18px; }
.appro tr.tot-classe td.mt { color: #2E8B22; font-weight: 700; text-align: right; border-top: 1.5px solid #555; padding-top: 12px; padding-bottom: 18px; }
.appro tr.tot-gen td { color: #2E8B22; font-weight: 700; text-align: right; }
.appro tr.tot-gen.final td { border-top: 1.5px solid #555; }

/* ===== Feuille de vente : feuille de synthèse ===== */
.fv-feuille { border: 1.5px solid #222; background: #fff; max-width: 980px; padding: 8px 10px 14px; font-size: 11.5px; margin-bottom: 18px; }
.fv-feuille .tete { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 6px; }
.fv-feuille .bandeau-noir { background: #111; color: #fff; font-weight: 700; display: inline-block; padding: 1px 6px; margin-bottom: 4px; }
.fv-feuille table { width: 100%; border-collapse: collapse; }
.fv-feuille th { font-weight: 700; font-size: 11px; text-align: center; border: 1px solid #222; padding: 2px 6px; background: #fff; color: #111; position: static; }
.fv-feuille td { padding: 1px 6px; font-size: 11px; vertical-align: middle; }
.fv-feuille td.cg { border-left: 1px solid #222; }
.fv-feuille tr.tot td { border-top: 1px solid #222; font-weight: 700; padding-top: 6px; padding-bottom: 6px; }
.fv-pied { display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid #222; margin-top: 10px; font-size: 11px; }
.fv-pied > div { padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fv-pied .lab { background: #C9C9C9; font-weight: 700; padding: 0 6px; }
.fv-pied b { font-size: 12px; }
#fvCalcul h2 { margin-top: 6px; }
table.fvc td { font-size: 11.5px; padding: 2px 8px; border-bottom: 1px solid var(--bord-doux); vertical-align: top; }
table.fvc tr.Commentaire td { color: var(--gris-fer); font-style: italic; }
table.fvc td.var { color: var(--gris-beton); font-family: Consolas, monospace; font-size: 10.5px; }

/* ===== Fiche Affaire (fenêtre du bouton « i ») ===== */
.cartouche .i { border: none; cursor: pointer; padding: 0; }
.cartouche .i:disabled { cursor: default; opacity: .6; }
.cartouche .i:not(:disabled):hover { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.voile { position: fixed; inset: 0; background: rgba(20,10,35,.45); display: grid; place-items: center; z-index: 36; padding: 16px; } /* au-dessus de la fiche (.flottant) */
.fenetre-affaire { width: min(960px, 100%); height: min(680px, 100%); background: #fff; display: flex; border-radius: 6px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.fa-cote { width: 160px; flex: none; background: #7A55B8; color: #fff; display: flex; flex-direction: column; }
:root[data-couleurs="socara"] .fa-cote { background: var(--anthracite); }
.fa-icone { width: 64px; height: 56px; margin: 22px auto 30px; border-radius: 10px; background: #fff; color: #7A55B8; font-size: 30px; font-weight: 700; display: grid; place-items: center; }
:root[data-couleurs="socara"] .fa-icone { color: var(--rouge); }
#faNav, #rgNav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; border-top: 1px solid rgba(255,255,255,.3); padding-top: 10px; }
#faNav button, #rgNav button { background: none; border: none; color: #fff; text-align: left; padding: 3px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
#faNav button.actif, #rgNav button.actif { background: #fff; color: #5B2E91; }
:root[data-couleurs="socara"] #faNav button.actif, :root[data-couleurs="socara"] #rgNav button.actif { color: var(--rouge); }
.fa-corps { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #F4F4F4; }
.fa-tete { background: var(--bandeau); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 14px; }
.fa-tete span { font-size: 22px; }
.fa-tete b { flex: 1; background: var(--sous-barre); border-radius: 6px; padding: 6px 12px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fa-fermer { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; }
.fa-commun { display: grid; grid-template-columns: 110px 1fr 90px 1fr; gap: 4px 10px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--bord); align-items: start; }
.fa-commun label { display: contents; font-size: 11.5px; }
.fa-commun label input, .fa-commun label textarea { grid-column: span 3; }
.fa-commun label.haut textarea { grid-column: span 1; }
.fa-section { flex: 1; overflow: auto; padding: 12px 14px; }
.fa-section fieldset { border: 1px solid #CFCFCF; border-radius: 6px; background: #fff; margin: 0 0 12px; padding: 8px 12px 10px; }
.fa-section legend { font-weight: 700; font-size: 13px; color: var(--gris-fer); padding: 0 4px; }
.fa-grille { display: grid; grid-template-columns: 130px 1fr; gap: 5px 10px; align-items: center; font-size: 11.5px; }
.fa-grille.deux { grid-template-columns: 130px 1fr 90px 1fr; }
.fa-section input, .fa-section textarea, .fa-section select, .fa-commun input, .fa-commun textarea { border-radius: 4px; padding: 3px 8px; font-size: 12px; border: 1px solid #C9C9C9; width: 100%; font-family: inherit; }
.fa-section textarea, .fa-commun textarea { resize: vertical; }
.fa-col2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.recap h3 { color: #8FC9CF; font-weight: 400; font-size: 17px; margin: 6px 0 0; }
.recap small { color: #9AC3C8; font-style: italic; display: block; }
.recap p { margin: 0 0 6px; font-weight: 700; font-size: 12px; }
.statuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; justify-items: center; padding: 6px 4px; }
.statuts button { width: 96px; min-height: 36px; border: 1px solid #C9C9C9; background: #ECECEC; color: #9a9a9a; border-radius: 4px; font-size: 11px; cursor: pointer; line-height: 1.15; }
.statuts button:hover { border-color: var(--accent); color: #555; }
.statuts button.fait { background: #FFC233; border-color: #E5A800; color: #A3361C; }
.statuts button.actuel { background: #FFC233; border-color: #E5A800; color: #A3361C; font-weight: 700; box-shadow: 0 0 0 2px rgba(0,0,0,.12); }
.statuts button.gagnee.actuel { background: #12A12E; border-color: #0E8325; color: #fff; font-size: 15px; }
.statuts button.perdue.actuel { background: #8D8D8D; border-color: #666; color: #fff; font-size: 15px; }
.statuts .plein { grid-column: span 2; }
.fa-pied { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-top: 1px solid var(--bord); background: #EDEDED; }
@media print { body > *:not(#voileFiche) { display: none !important; } .voile { position: static; background: none; padding: 0; } .fenetre-affaire { box-shadow: none; height: auto; } .fa-cote, .fa-pied, .fa-fermer { display: none; } }

/* Fiches dépliées */
.fiche { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 6px 0; align-items: flex-end; }
.fiche label { display: flex; flex-direction: column; font-size: 10px; color: var(--gris-fer); gap: 2px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.fiche input, .fiche select { width: 120px; font-size: 12px; padding: 2px 8px; border-radius: 8px; text-transform: none; letter-spacing: 0; color: var(--anthracite); }
.fiche input:disabled { background: var(--gris-clair); color: var(--gris-fer); }
.fiche .fiche-actions { flex-basis: 100%; display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--bord-doux); }
.fiche .info { font-size: 11px; color: var(--gris-fer); font-weight: 300; text-transform: none; letter-spacing: 0; align-self: center; }
.bloc-alerte { background: rgba(255,221,0,.18); border-left: 4px solid var(--jaune-dore); border-radius: 0 8px 8px 0; padding: 2px 8px; }

/* Listes (alertes, coefficients, annexes) */
table.liste th, table.petit th { background: var(--dv-entete-bg); color: var(--dv-entete-txt); font-weight: 700; font-size: 11px; padding: 5px 8px; border: 1px solid var(--dv-entete-bord); position: sticky; top: 0; }
table.liste td, table.petit td { padding: 4px 8px; border-bottom: 1px solid var(--bord-doux); vertical-align: middle; }
table.petit { width: auto; margin: 6px 0; }
table.petit input.q { border-color: var(--bord); background: #fff; }
.b { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.b-Erreur { background: rgba(227,6,19,.1); color: #E30613; }
.b-Attention { background: rgba(255,221,0,.25); color: #A07A00; }
.b-Info { background: rgba(26,26,26,.08); color: var(--anthracite); }
/* Alertes marquées « normales » : en bas, grisées */
#tAlertes tr.alerte-vue td { color: var(--gris-beton); }
#tAlertes tr.alerte-vue .b { opacity: .45; }
#tAlertes tr.alerte-sep td { padding-top: 14px; font-weight: 700; color: var(--gris-fer); border-bottom: 1px solid var(--bord); }
#tAlertes .alerte-par { color: var(--gris-beton); }
#tAlertes td.c { text-align: center; width: 1%; }
.deux-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.carte { background: #fff; border: 1px solid var(--bord-doux); border-radius: 16px; padding: 16px 20px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.a-venir { max-width: 720px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--anthracite); color: #fff; padding: 10px 18px; border-radius: 50px; z-index: 50; border-top: 3px solid var(--jaune); }
@media (max-width: 760px) { .corps { flex-direction: column; height: auto; } #cote { width: 100%; max-height: 35vh; } .nom-vue { display: none; } .barre input[type=search] { min-width: 0; width: 100%; } }

/* Études ouvertes (onglets) et presse-papiers commun aux fenêtres */
.onglets-etudes { display: flex; align-items: flex-end; gap: 8px; padding: 4px 14px 0; background: var(--gris-clair); border-bottom: 1px solid var(--bord); flex: none; min-height: 32px; }
.liste-onglets { display: flex; gap: 3px; flex: 1; min-width: 0; overflow-x: auto; }
.onglet-etude { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 4px 4px 4px 10px; border: 1px solid var(--bord); border-bottom: none; border-radius: 6px 6px 0 0; background: #fff; opacity: .7; cursor: pointer; font-size: 12px; white-space: nowrap; }
.onglet-etude:hover { opacity: 1; }
.onglet-etude.actif { opacity: 1; box-shadow: inset 0 3px 0 var(--accent); font-weight: 700; }
.onglet-etude small { overflow: hidden; text-overflow: ellipsis; color: var(--gris-fer); font-weight: 400; }
.onglet-etude button { border: none; background: none; color: var(--gris-fer); cursor: pointer; padding: 0 4px; border-radius: 3px; font-size: 11px; line-height: 18px; }
.onglet-etude button:hover { background: var(--accent); color: #fff; }
.pp-etat { align-self: center; display: inline-flex; align-items: center; gap: 4px; max-width: 360px; font-size: 11px; color: var(--gris-fer); background: #fff; border: 1px dashed var(--accent); border-radius: 10px; padding: 1px 4px 1px 10px; }
.pp-etat > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-etat button { border: none; background: none; cursor: pointer; color: var(--gris-fer); font-size: 10px; }
.nouvelle-fenetre { align-self: center; border: 1px solid var(--bord); background: #fff; border-radius: 10px; padding: 2px 10px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.nouvelle-fenetre:hover { border-color: var(--accent); color: var(--accent); }
/* Glisser-déposer : la ligne déposée viendra juste sous la ligne survolée */
#tDevis td.rep[draggable], .poignee[draggable] { cursor: grab; }
#tDevis tr.depot td { box-shadow: inset 0 -3px 0 var(--accent); }

/* Roue crantée : réglages de l'application */
.utilisateur { flex: none; margin-left: auto; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 16px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.utilisateur:hover { background: rgba(255,255,255,.22); }
.bandeau-verrou { display: flex; align-items: center; gap: 12px; background: #FFF1D6; border: 1px solid #E8B44A; color: #6B4A00; border-radius: 6px; padding: 6px 12px; margin: 0 0 8px; font-size: 13px; }
.bandeau-verrou span { flex: 1; }
body.lecture-seule #vueEtude input:not([type=search]):not([type=checkbox]), body.lecture-seule #vueEtude select, body.lecture-seule #vueEtude textarea,
body.lecture-seule #flottant input, body.lecture-seule #flottant select, body.lecture-seule #flottant textarea { pointer-events: none; background: transparent !important; border-color: transparent !important; }
body.lecture-seule #vueEtude [draggable="true"] { cursor: default; }
.roue { flex: none; width: 38px; height: 38px; border-radius: 50%; border: none; background: none; color: #fff; cursor: pointer; display: grid; place-items: center; }
.roue:hover { background: rgba(255,255,255,.18); }
.rg-groupe { color: rgba(255,255,255,.75); font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; padding: 10px 10px 2px; }
#voileReglages .fa-section section > fieldset { max-width: 760px; }
#cpTable input.cp-pers { width: 110px; min-width: 110px; box-sizing: border-box; padding: 3px 6px; }
/* Réglages : fenêtre redimensionnable par le coin bas-droit (taille gardée sur ce poste) */
#voileReglages .fenetre-affaire { resize: both; min-width: 640px; min-height: 420px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); }
.ligne-reglage { display: flex; gap: 4px; align-items: center; margin-bottom: 3px; }
.ligne-reglage input { width: 220px !important; }
.ligne-reglage .bt, .liste-reglage .barre .bt { padding: 2px 9px; }
.lignes-reglage { max-height: 380px; overflow: auto; padding: 2px; }
.liste-reglage .barre { margin-top: 8px; display: flex; gap: 6px; }
.liste-reglage .barre input { width: 220px !important; }
.rg-colonnes { display: flex; gap: 28px; flex-wrap: wrap; }
.rg-vue h3 { margin: 4px 0 8px; font-size: 13px; }
.rg-vue .fa-grille { grid-template-columns: 140px 80px; }
/* Coefficients saisis en % */
td.mult { color: var(--gris-beton); font-size: 11px; white-space: nowrap; }
/* Panneau des études réduit */
.replier-cote { margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; width: 26px; height: 24px; cursor: pointer; font-size: 14px; line-height: 1; }
.replier-cote:hover { background: rgba(255,255,255,.18); }
.cote-reduit { flex: none; width: 28px; border: none; border-right: 1px solid var(--bord); background: var(--bandeau); color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 0 0; }
.cote-reduit span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; letter-spacing: 1px; }
.cote-reduit:hover { filter: brightness(1.15); }
/* Colonnes de largeur réglable (vues Déboursé et Devis) */
#tDevis { table-layout: fixed; min-width: 0; }
#tDevis thead th { position: sticky; top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bord-col { position: absolute; top: 0; right: -1px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.bord-col:hover, body.redim-col .bord-col { background: rgba(255,255,255,.35); }
body.redim-col, body.redim-col * { cursor: col-resize !important; user-select: none; }
#tDevis td.n, .debourse td.code { overflow: hidden; text-overflow: ellipsis; }
#tDevis td input.q { max-width: 100%; }

/* Colonnes de quantité par bâtiment */
#tDevis th.th-bat { background-image: linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)); }
#tDevis td.bat input.q { width: 100%; }
/* Cases modifiables du devis et du déboursé : comme à l'approvisionnement, en lecture tant qu'on n'a pas double-cliqué */
#tDevis input.champ { width: 100%; padding-right: 7px; }
#tDevis input.champ[readonly] { cursor: default; border-color: transparent; background: transparent; text-overflow: ellipsis; }
#tDevis input.champ[readonly]:hover { border-color: #D9D2A6; background: transparent; }
#tDevis input.champ[readonly]:focus { border-color: var(--gris-beton); background: transparent; }
#tDevis input.champ:not([readonly]) { border-color: var(--accent); background: #fff; cursor: text; }
#tDevis input.champ.u { text-align: center; padding: 0 2px; }
#tDevis input.champ.lib { text-align: left; padding: 0 4px; flex: 1; min-width: 0; color: inherit; font-style: inherit; }
#tDevis .case-lib { display: flex; align-items: center; gap: 4px; }
body:not(.lecture-seule) #tDevis td[data-editer]:hover { box-shadow: inset 0 0 0 1px #D9D2A6; border-radius: 4px; cursor: text; }
#tDevis td.tot-bat { font-weight: 700; color: var(--gris-fer); }

/* Devis imprimé selon une présentation (bouton « Imprimer… ») : invisible à l'écran.
   Mise en page reprise du devis SOCARA (GO) d'Onaya : en-tête répété sur chaque page (logo, affaire, date),
   numéro de page et pied par les marges de page (@page, réglées dans app.js), page de garde sans en-tête. */
#impression { display: none; }
/* Boutons Imprimer / PDF des pages Approvisionnement, Feuille de vente et Ratios */
.barre-page { display: flex; justify-content: flex-end; gap: 6px; margin: 0 0 6px; }
/* Copie imprimée de ces pages : tableaux en pleine largeur, sans ombre, défilement ni en-tête collant */
@media print {
  #impression .p-ecran { font-size: 8pt; }
  #impression .p-ecran .carte { box-shadow: none; border: none; border-radius: 0; padding: 0; margin: 0 0 4mm; background: none; }
  #impression .p-ecran h2 { font-size: 11pt; margin: 3mm 0 1.5mm; break-after: avoid; }
  #impression .p-ecran h3 { font-size: 9.5pt; margin: 2mm 0 1mm; break-after: avoid; }
  #impression .p-ecran .table-wrap { overflow: visible !important; max-height: none !important; height: auto !important; }
  #impression .p-ecran table { width: 100% !important; min-width: 0 !important; font-size: 7.5pt; }
  #impression .p-ecran th { position: static !important; }
  #impression .p-ecran thead { display: table-header-group; }
  #impression .p-ecran tr { break-inside: avoid; }
  #impression .p-ecran td, #impression .p-ecran th { padding: 1.2mm 1.5mm; white-space: normal; overflow-wrap: anywhere; min-width: 0 !important; }
  #impression .p-ecran td.n, #impression .p-ecran th.n, #impression .p-ecran td.mt { white-space: nowrap; overflow-wrap: normal; }
  /* approvisionnement : même présentation qu'à l'écran (police Mont, couleurs), une ligne par ressource sans retour à la ligne,
     bandes grises de classe resserrées */
  #impression .p-ecran-appro { font-family: 'Mont', Arial, sans-serif; font-weight: 300; font-size: 10.5px; }
  #impression .p-ecran-appro table.appro { table-layout: fixed; font-size: 10.5px; }
  #impression .p-ecran-appro .appro td, #impression .p-ecran-appro .appro .p-valeur { padding: 0.5px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
  #impression .p-ecran-appro .appro .p-valeur { padding: 0; }
  #impression .p-ecran-appro .appro tr.classe td { font-size: 12px; padding: 1px 5px 0; border-width: 1px; }
  #impression .p-ecran-appro .appro tr.classe-entete td { font-size: 10px; padding: 0 5px 1px; border-width: 1px; }
  #impression .p-ecran-appro .appro tr.famille td { font-size: 12.5px; padding-top: 7px; border-bottom-width: 1px; }
  #impression .p-ecran-appro .appro tr.tot-famille td, #impression .p-ecran-appro .appro tr.tot-classe td, #impression .p-ecran-appro .appro tr.tot-gen td { overflow: visible; padding-top: 3px; }
  #impression .p-ecran-appro .appro tr.tot-famille td.mt { font-size: 11.5px; }
  #impression .p-ecran-appro .appro tr.tot-classe td { padding-bottom: 10px; } /* de l'air avant la bande grise suivante */
  #impression .p-ecran-appro .appro tr.famille, #impression .p-ecran-appro .appro tr.classe, #impression .p-ecran-appro .appro tr.classe-entete { break-after: avoid; }
  #impression .p-ecran tr.sel td { background: none !important; box-shadow: none !important; }
  #impression .p-ecran .p-valeur { white-space: pre-wrap; }
  #impression .p-ecran .n .p-valeur, #impression .p-ecran td.n { text-align: right; }
  html:has(body.impression-devis .p-ecran) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media print {
  body.impression-devis > *:not(#impression) { display: none !important; }
  body.impression-devis > #impression { display: block !important; }
  body.impression-devis { background: #fff; }
  #impression { font-family: Tahoma, Verdana, sans-serif; color: #000; font-size: 8pt; line-height: 1.22; }
  #impression .p-piece { break-after: page; }
  #impression .p-piece:last-child { break-after: auto; }
  #impression img { max-width: 100%; }
  /* page de garde */
  .p-garde { page: garde; height: 268mm; display: flex; flex-direction: column; font-size: 13pt; text-align: center; }
  .p-garde .g-haut { display: flex; justify-content: space-between; align-items: flex-start; text-align: left; }
  .p-garde .g-logo { width: 42mm; }
  .p-garde .g-ref { font-weight: 700; font-size: 11pt; padding-top: 2mm; }
  .p-garde .g-suivi { font-weight: 700; font-size: 11pt; margin: 6mm 0 0 30%; text-align: left; }
  .p-garde .g-titre { margin: 28mm 15% 0; font-size: 18pt; font-weight: 700; border-bottom: 1px solid #000; padding-bottom: 1mm; }
  .p-garde .g-lot { margin-top: 10mm; font-size: 15pt; }
  .p-garde .g-cadre { margin: 12mm 12% 0; border: 1.5px solid #000; padding: 8mm 6mm; font-size: 14pt; line-height: 1.35; }
  .p-garde .g-cadre p { margin: 0 0 5mm; }
  .p-garde .g-cadre p:last-child { margin: 8mm 0 0; }
  .p-garde .g-date { margin-top: 14mm; font-weight: 700; font-size: 11pt; }
  .p-garde .g-bandeau { margin-top: auto; width: 100%; }
  /* en-tête répété (premier rang du thead de chaque pièce) */
  table.p-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  table.p-table thead { display: table-header-group; }
  .p-tete { display: flex; align-items: flex-start; gap: 8mm; font-size: 9.5pt; font-weight: 400; text-align: left; }
  .p-tete img { width: 18mm; }
  .p-tete .p-aff { flex: 1; line-height: 1.45; }
  .p-tete .p-quand { text-align: right; line-height: 1.6; }
  .p-titre-doc { text-align: center; font-size: 15pt; font-weight: 700; margin: 3mm 0 1mm; }
  .p-sous-titre { text-align: center; font-size: 13pt; font-weight: 700; margin: 4mm 0 3mm; }
  tr.p-cols th { font-family: Tahoma, Verdana, sans-serif; font-style: italic; font-weight: 400; color: #1F2F8F; text-decoration: underline; font-size: 9pt; padding: 1mm 1mm 1.5mm; border-bottom: 1px solid #000; }
  /* lignes du devis */
  table.p-table td { padding: .6mm 1.2mm; vertical-align: top; }
  table.p-table td.n { text-align: right; white-space: nowrap; vertical-align: bottom; }
  table.p-table td.c { text-align: center; vertical-align: bottom; }
  table.p-table td.p-code { white-space: nowrap; }
  tr.p-ouv td { padding-top: 2.6mm; }
  tr.p-ouv { break-inside: avoid; }
  tr.p-ouv .texte { white-space: pre-wrap; }
  tr.p-ouv .l1 { font-weight: 700; }
  tr.p-memoire td.n { color: #666; font-style: italic; } /* P.M. : quantité / montant pour mémoire, hors total */
  tr.p-ouv td.p-etat { font-weight: 700; font-size: 7.5pt; text-align: center; vertical-align: bottom; }
  tr.p-tx td { padding-top: 3mm; }
  .p-boite { border: 1.5px solid #1F2F8F; color: #1F2F8F; font-weight: 700; font-size: 12.5pt; padding: 1.5mm 3mm; margin-top: 4mm; display: flex; gap: 12mm; }
  .p-boite > span:first-child { min-width: 10mm; }
  tr.p-t1 td, tr.p-t2 td { color: #1F2F8F; font-style: italic; font-weight: 700; padding-top: 4mm; break-after: avoid; }
  tr.p-t1 td { font-size: 11pt; }
  tr.p-t1 .puce { font-style: normal; margin: 0 6mm 0 -2mm; font-size: 9pt; }
  tr.p-t2 td.p-lib { padding-left: 14mm; }
  tr.p-saut { break-before: page; }
  tr.p-tot td { color: #1F2F8F; font-style: italic; font-weight: 700; padding-top: 3mm; break-before: avoid; }
  tr.p-tot td.p-totlib { text-align: right; }
  tr.p-tot td.n span { display: inline-block; min-width: 28mm; border-top: 1px solid #000; padding-top: .8mm; }
  tr.p-tot0 td { font-size: 11pt; }
  tr.p-tot1 td { font-size: 10pt; }
  /* totalisation et récapitulatif */
  table.p-arbre td { padding: .8mm 1.5mm; }
  table.p-arbre tr.p-t2 td.p-lib { padding-left: 4mm; }
  table.p-arbre tr.p-t2 td { font-size: 8.5pt; padding-top: 2mm; }
  table.p-totaux { width: 100%; border-collapse: collapse; margin-top: 4mm; break-inside: avoid; }
  table.p-totaux td { padding: 1mm 1.5mm; vertical-align: top; }
  table.p-totaux td.n { text-align: right; white-space: nowrap; width: 32mm; }
  table.p-totaux td.lib { text-align: right; font-weight: 700; }
  table.p-totaux td.an { font-weight: 700; font-size: 8pt; }
  table.p-totaux td.base { text-align: right; white-space: nowrap; font-size: 9pt; }
  table.p-totaux td.base span + span { display: inline-block; min-width: 18mm; margin-left: 4mm; }
  table.p-totaux tr.st td { font-size: 10pt; }
  table.p-totaux tr.st td.n, table.p-totaux tr.ht td.n, table.p-totaux tr.ttc td.n { border-top: 1px solid #000; }
  table.p-totaux tr.ht td, table.p-totaux tr.ttc td { font-size: 12pt; font-weight: 700; padding-top: 3mm; }
  table.p-totaux tr.tva td { font-size: 10pt; }
  table.p-totaux tr.tva td.lib { font-weight: 400; }
  table.p-recap tr.p-r0 td { color: #1F2F8F; font-weight: 700; font-size: 12pt; padding: 2mm 1.5mm; }
  table.p-recap tr.p-rbat td { font-size: 10pt; padding-left: 8mm; }
  .p-remarques { margin-top: 6mm; font-size: 10pt; line-height: 1.7; break-inside: avoid; }
  .p-remarques b { display: block; }
  .p-signatures { margin-top: 8mm; font-size: 10pt; break-inside: avoid; }
  .p-signatures .p-lieu { text-align: center; margin-bottom: 2mm; }
  .p-signatures .p-sig { display: flex; justify-content: space-between; height: 35mm; }
  .p-sans-prix .p-masque { display: none; }
  /* ---------- Modèle « Moderne SOCARA » (tout sous .pm : le modèle classique ci-dessus n'est pas touché) ----------
     Mesures en px CSS (96 dpi), reprises de la maquette validée : 794 px = 210 mm. */
  #impression .pm { font-family: Tahoma, Verdana, sans-serif; color: #1A1A1A; font-size: 10.5px; line-height: 1.25; }
  #impression .pm b { font-weight: 700; }
  /* page de garde : pleine page, reprend le papier à en-tête SOCARA */
  #impression .pm .pm-garde { page: garde; position: relative; height: 296.5mm; box-sizing: border-box; overflow: hidden; padding: 40px; }
  #impression .pm .pm-fili { position: absolute; right: -170px; top: 150px; width: 640px; max-width: none; height: 640px; opacity: .16; }
  #impression .pm .pm-g-haut { position: relative; display: flex; justify-content: space-between; align-items: flex-start; }
  #impression .pm .pm-g-haut img { width: 137px; height: 137px; }
  #impression .pm .pm-g-ref { text-align: right; }
  #impression .pm .pm-g-ref small { display: block; font-weight: 700; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #3D3D3A; }
  #impression .pm .pm-g-ref b { display: block; margin-top: 6px; font-size: 21px; }
  #impression .pm .pm-g-ref span { display: block; margin-top: 4px; font-weight: 300; font-size: 13px; color: #3D3D3A; }
  #impression .pm .pm-g-titre { position: relative; margin-top: 150px; }
  #impression .pm .pm-g-titre .lot { font-weight: 700; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #E30613; }
  #impression .pm .pm-g-titre h1 { font-family: 'Mont', Arial, sans-serif; margin: 12px 0 0; font-weight: 700; font-size: 96px; line-height: 1; letter-spacing: -1px; color: #E30613; }
  #impression .pm .pm-g-titre .suite { font-family: 'Mont', Arial, sans-serif; margin-top: 6px; font-weight: 700; font-size: 29px; line-height: 1.2; }
  #impression .pm .pm-g-infos { position: relative; margin-top: 56px; border-top: 1.5px solid #1A1A1A; padding-top: 24px; display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; row-gap: 22px; align-items: baseline; }
  #impression .pm .pm-g-infos .lib { font-weight: 700; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #3D3D3A; }
  #impression .pm .pm-g-infos .val { font-size: 13px; line-height: 1.4; }
  #impression .pm .pm-g-infos .val b { font-size: 14px; }
  #impression .pm .pm-g-infos .val b.op { display: block; font-size: 20px; line-height: 1.25; }
  #impression .pm .pm-g-infos .val span { display: block; margin-top: 3px; color: #3D3D3A; }
  #impression .pm .pm-g-date { position: relative; margin-top: 40px; font-weight: 700; font-size: 13px; }
  #impression .pm .pm-g-pied { position: absolute; left: 40px; right: 40px; bottom: 30px; text-align: center; }
  #impression .pm .pm-g-pied .act { font-weight: 700; font-size: 15px; line-height: 1.2; color: #E30613; white-space: nowrap; }
  #impression .pm .pm-g-pied i { display: block; margin-top: 7px; height: 6px; background: #FFDD00; }
  #impression .pm .pm-g-pied .adr { margin-top: 10px; font-size: 12px; line-height: 1.4; }
  #impression .pm .pm-g-pied .leg { margin-top: 4px; font-size: 8px; line-height: 1.4; }
  /* en-tête répété des pages suivantes */
  #impression .pm .pm-tete { display: flex; align-items: center; gap: 10px; height: 32px; }
  #impression .pm .pm-tete img { width: 32px; height: 32px; }
  #impression .pm .pm-aff { flex: 1; min-width: 0; line-height: 1.25; }
  #impression .pm .pm-aff b { display: block; font-size: 11px; }
  #impression .pm .pm-aff span { display: block; font-weight: 300; font-size: 9.5px; color: #3D3D3A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #impression .pm .pm-ref { text-align: right; line-height: 1.25; white-space: nowrap; }
  #impression .pm .pm-ref b { display: block; font-size: 11px; }
  #impression .pm .pm-ref span { display: block; font-size: 9.5px; color: #3D3D3A; }
  #impression .pm .pm-titre { margin: 6px 0 2px; font-weight: 700; font-size: 14px; line-height: 18px; color: #E30613; }
  #impression .pm table.p-table thead td { padding: 0; }
  /* détail du devis */
  #impression .pm tr.p-cols th { font-family: Tahoma, Verdana, sans-serif; font-style: normal; font-weight: 700; font-size: 8.5px; line-height: 11px; letter-spacing: .5px; text-transform: uppercase; color: #3D3D3A; text-decoration: none; text-align: left; padding: 6px 3px 3px; border-bottom: 1.5px solid #1A1A1A; }
  #impression .pm tr.p-cols th.n { text-align: right; }
  #impression .pm tr.p-cols th.c { text-align: center; }
  #impression .pm table.p-table td { padding: 1px 3px; }
  #impression .pm table.p-table td.n, #impression .pm table.p-table td.c { vertical-align: bottom; } /* montants en bas de l’ouvrage, comme d’habitude */
  #impression .pm td.p-code { font-size: 9px; color: #3D3D3A; }
  #impression .pm table.p-table td.p-code { white-space: nowrap; } /* jamais coupé : la colonne prend la largeur du plus long code (largeurCodes) */
  #impression .pm tr.p-ouv td { padding-top: 12px; padding-bottom: 7px; border-top: 1px solid #E5E5E2; } /* ouvrages aérés */
  #impression .pm tr.p-ouv .texte { font-weight: 400; }
  #impression .pm tr.p-ouv .l1 { font-weight: 700; }
  #impression .pm tr.p-memoire td.n { color: #1A1A1A; font-style: normal; }
  #impression .pm .p-etat { font-weight: 700; font-size: 9px; color: #3D3D3A; }
  #impression .pm .p-boite { display: flex; gap: 10px; margin-top: 4px; padding: 3px 6px; border: none; background: #E30613; color: #fff; font-weight: 700; font-size: 11px; }
  #impression .pm .p-boite > span:first-child { min-width: 0; }
  /* titres nettement distincts des ouvrages : niveau 1 sur bande grise, niveaux suivants soulignés d'un filet anthracite */
  #impression .pm tr.p-t1 td, #impression .pm tr.p-t2 td { font-style: normal; font-weight: 700; color: #1A1A1A; font-size: 11px; break-after: avoid; }
  #impression .pm tr.p-t1 td { color: #E30613; font-size: 12px; padding: 5px 6px; background: #EDEDEA; border-top: 10px solid #fff; }
  #impression .pm tr.p-t1 td.p-code { font-size: 12px; color: #E30613; }
  #impression .pm tr.p-t2 td { padding: 12px 3px 3px; border-bottom: 1.5px solid #1A1A1A; }
  #impression .pm tr.p-t2 td.p-code { font-size: 11px; color: #1A1A1A; }
  #impression .pm tr.p-t1 .puce { display: none; }
  #impression .pm tr.p-t2 td.p-lib { padding-left: 3px; }
  #impression .pm tr.p-tot td { font-style: normal; color: #1A1A1A; padding-top: 2px; padding-bottom: 2px; font-size: 10.5px; }
  #impression .pm tr.p-tot0 td { font-size: 11px; }
  #impression .pm tr.p-tot td.n span { min-width: 0; border-top: 1px solid #1A1A1A; padding-top: 1px; }
  /* totalisation */
  #impression .pm table.pm-arbre td { padding: 4px 6px; }
  #impression .pm table.pm-arbre td.cd, #impression .pm table.pm-recap td.cd { font-size: 9.5px; color: #6B6B66; white-space: nowrap; }
  #impression .pm table.pm-arbre tr.pm-b td { padding: 4px 0 2px; }
  #impression .pm table.pm-arbre tr.c1 td { padding-top: 12px; font-weight: 700; border-bottom: 1px solid #1A1A1A; break-after: avoid; }
  #impression .pm table.pm-arbre tr.c1 td.cd { font-size: 10.5px; color: #1A1A1A; }
  #impression .pm table.pm-arbre tr.c2 td { font-size: 9.5px; border-bottom: 1px solid #E5E5E2; }
  #impression .pm table.pm-arbre tr.c2 td:nth-child(2) { padding-left: 12px; }
  #impression .pm table.pm-arbre tr.anx td { font-style: italic; }
  #impression .pm table.pm-arbre tr.t0 td { background: #F0F0EE; font-weight: 700; padding: 9px 6px; text-align: right; }
  #impression .pm table.pm-arbre tr.t0 td.n { font-size: 12px; }
  #impression .pm td.n { text-align: right; white-space: nowrap; }
  /* bloc des totaux (totalisation, récapitulation, fin du devis) */
  #impression .pm table.pm-totaux { width: 390px; margin: 16px 0 0 auto; border-collapse: collapse; break-inside: avoid; }
  #impression .pm table.pm-totaux td { padding: 4px 6px; font-size: 9.5px; border-bottom: 1px solid #E5E5E2; vertical-align: bottom; }
  #impression .pm table.pm-totaux tr.st td { font-weight: 700; text-transform: uppercase; }
  #impression .pm table.pm-totaux tr.an td:first-child { font-weight: 700; width: 150px; }
  #impression .pm table.pm-totaux td.g { color: #6B6B66; font-size: 9px; }
  #impression .pm table.pm-totaux tr.ht td { font-weight: 700; font-size: 12px; padding-top: 7px; border-top: 1.5px solid #1A1A1A; border-bottom: 1.5px solid #1A1A1A; }
  #impression .pm table.pm-totaux tr.tva td { color: #3D3D3A; border-bottom: none; }
  #impression .pm table.pm-totaux tr.ttc td { background: #1A1A1A; color: #fff; font-weight: 700; font-size: 13px; padding: 8px; border-top: 3px solid #FFDD00; border-bottom: none; }
  #impression .pm table.pm-totaux tr.ttc td.n { color: #FFDD00; }
  /* récapitulation */
  #impression .pm table.pm-recap td { padding: 4px 6px; }
  #impression .pm table.pm-recap tr.r0 td { font-size: 11px; border-bottom: 1px solid #E5E5E2; }
  #impression .pm .pm-lb { font-weight: 700; font-size: 9.5px; letter-spacing: 1px; text-transform: uppercase; color: #3D3D3A; }
  #impression .pm .pm-remarques { margin-top: 14px; font-weight: 300; font-size: 10.5px; line-height: 1.45; break-inside: avoid; }
  #impression .pm .pm-remarques .pm-lb { margin-bottom: 3px; }
  #impression .pm .pm-signatures { margin-top: 14px; break-inside: avoid; }
  #impression .pm .pm-lieu { font-size: 10.5px; }
  #impression .pm .pm-sig { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
  #impression .pm .pm-sig > div { height: 120px; box-sizing: border-box; padding: 8px 10px; border: 1px solid #9E9E96; }
  #impression .pm .pm-sig small { display: block; font-weight: 300; font-size: 9.5px; color: #3D3D3A; margin-top: 2px; }
  /* déboursé détaillé */
  .d-titre-doc { text-decoration: underline; }
  table.d-table { font-size: 7pt; }
  table.d-table td { padding: .35mm 1mm; vertical-align: top; }
  table.d-table td.n { vertical-align: bottom; }
  table.d-table td.fort { font-weight: 700; }
  table.d-table td.rep { color: #333; white-space: nowrap; }
  tr.d-cols td, tr.d-sentete td { background: #CFE8B0; border: .5px solid #9DBF7A; text-align: center; font-size: 6.5pt; color: #3B5E1C; padding: .3mm 1mm; }
  tr.d-sentete td:first-child, tr.d-sentete td:last-child { background: none; border: none; }
  tr.d-cols td:first-child { background: none; border: none; }
  tr.d-t td { color: #4A7A1F; font-size: 9pt; padding-top: 4mm; break-after: avoid; }
  tr.d-t0 td { font-size: 10.5pt; font-weight: 700; border-bottom: 1.5px solid #A8CF7E; }
  tr.d-nv td { background: #FBE3C6; color: #8A4A0B; }
  tr.d-o td { padding-top: 2mm; break-inside: avoid; }
  tr.d-o td.c { vertical-align: bottom; }
  tr.d-pied td { white-space: nowrap; }
  tr.d-o .texte { white-space: pre-wrap; }
  tr.d-o .l1, tr.d-o td.d-code { font-weight: 700; }
  tr.d-r td, tr.d-so td { border-left: .5px solid #C9DFB4; border-right: .5px solid #C9DFB4; font-size: 6.6pt; }
  tr.d-der td:nth-child(n+2):not(:last-child) { border-bottom: .8px solid #9DBF7A; }
  /* filets des sous-ouvrages : un trait bordé et ses copies décalées (box-shadow), traits simples dans le PDF */
  td.d-p1, td.d-p2, td.d-p3, td.d-p4 { position: relative; }
  td.d-p1::before, td.d-p2::before, td.d-p3::before, td.d-p4::before { content: ''; position: absolute; top: 0; bottom: 0; left: 1.4mm; border-left: .35mm solid #B4B4AA; }
  td.d-p2::before { box-shadow: 3mm 0 0 #B4B4AA; }
  td.d-p3::before { box-shadow: 3mm 0 0 #B4B4AA, 6mm 0 0 #B4B4AA; }
  td.d-p4::before { box-shadow: 3mm 0 0 #B4B4AA, 6mm 0 0 #B4B4AA, 9mm 0 0 #B4B4AA; }
  tr.d-r td:first-child, tr.d-so td:first-child, tr.d-r td:last-child, tr.d-so td:last-child { border: none; }
  /* couleur du code selon la nature de la ressource : main d'œuvre verte, matériaux rouges, matériel et divers gris */
  tr.d-r td.d-code { color: #7A7A7A; }
  tr.d-r td.nat-MainOeuvre { color: #3C9A2A; }
  tr.d-r td.nat-Materiaux { color: #D0393A; }
  tr.d-r td:nth-child(3) { color: #222; }
  tr.d-so td { font-weight: 700; }
  tr.d-so td:nth-child(n+2):not(:last-child) { background-color: #F1F7EA; }
  tr.d-pale td:not(.d-code) { color: #8A8A8A !important; }
  tr.d-pale td { font-weight: 400; }
  tr.d-pale td.d-code { color: #A5A5A0; }
  tr.d-pale td.nat-MainOeuvre { color: #7DBB6F; }
  tr.d-pale td.nat-Materiaux { color: #E28A8B; }
  tr.d-so.d-pale td { font-weight: 700; }
  tr.d-pied td { font-size: 6.5pt; color: #3B5E1C; }
  tr.d-pied td:nth-child(n+2) { background: #EAEAEA; }
  tr.d-pied td:last-child { background: none; }
  tr.d-pied2 td:nth-child(n+2):not(:last-child) { background: #EAEAEA; }
  tr.d-tot td { color: #4A7A1F; padding-top: 2.5mm; border-top: 1.5px solid #A8CF7E; text-align: center; }
  tr.d-tot td:first-child { border: none; }
  tr.d-tot td.n { text-align: right; }
  tr.d-tot0 td { background: #DDEFC4; font-size: 8.5pt; }
  tr.d-tot0 td.n { font-size: 7.5pt; }
  tr.d-fin td { background: #111; color: #fff; font-size: 11pt; padding: 2mm; text-align: center; }
  tr.d-fin td.n { text-align: right; }
  tr.d-fin td:first-child { background: none; }
}

/* Regroupement des chapitres de bâtiments */
.rg-chapitres tr.niv1 td { color: var(--gris-fer); font-size: 11.5px; }
.rg-apercu { margin-top: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--bord); border-radius: 6px; }
.rg-apercu p { margin: 4px 0; }

/* Fenêtre « Imprimer… » et éditeur des présentations (réglages) */
.boite-dialogue { background: var(--fond, #fff); border-radius: 10px; overflow: hidden; width: min(560px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.corps-dialogue { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.corps-dialogue .pieces, .rg-pres .pieces { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.corps-dialogue label, .rg-pres label.coche { display: inline-flex; align-items: center; gap: 6px; }
.rg-pres input[type=checkbox], .corps-dialogue input[type=checkbox] { width: auto; flex: none; margin: 0; }
.rg-pres label.coche, .corps-dialogue .pieces label { white-space: nowrap; }
/* « Imprimer avec totaux seuls » : chapitres à imprimer sans leur détail */
.ts-bloc { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--bord); }
.ts-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ts-arbre { max-height: 300px; overflow: auto; border: 1px solid var(--bord); border-radius: 6px; padding: 4px 0; }
.corps-dialogue label.ts-ligne { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 6px; cursor: pointer; }
.ts-ligne:hover { background: var(--survol); }
.ts-ligne:has(input:checked) { background: var(--sel); }
.ts-ligne.ts-inclus { opacity: .55; cursor: default; }
.ts-code { flex: none; min-width: 48px; font-weight: 700; }
.ts-lib { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-mt { flex: none; font-variant-numeric: tabular-nums; }
.rg-pres .fa-grille textarea { width: 100%; min-height: 90px; font: inherit; }
.rg-pres .libelles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; }
.rg-pres .libelles label { display: flex; flex-direction: column; font-size: 11px; color: var(--gris-fer); }
/* Annuler / rétablir et historique des modifications */
.bt.annuler { min-width: 32px; padding-left: 6px; padding-right: 6px; font-size: 15px; line-height: 1; }
#tHisto tbody tr[data-op] { cursor: pointer; }
#tHisto tbody tr[data-op]:hover td { background: #F6F2DC; }
#tHisto tbody tr.choisi td { background: #FFE9A8; }
#tHisto tbody tr.histo-annulee td { color: #8A8A8A; text-decoration: line-through; }
#tHisto tbody tr.histo-annulee td:last-child { text-decoration: none; }
.histo-detail { margin-top: 10px; font-size: 12px; }
.histo-detail ul { max-height: 24vh; overflow: auto; margin: 4px 0; padding-left: 18px; }
.histo-detail li { margin: 2px 0; }
/* Rond de couleur du bandeau et palette */
.rond-couleurs { flex: none; width: 28px; height: 28px; border-radius: 50%; padding: 0; cursor: pointer; border: 2px solid rgba(255,255,255,.85);
  background: conic-gradient(var(--a, #F58B4C) 0 50%, var(--p, #5B2E91) 0 100%); box-shadow: 0 0 0 1px rgba(0,0,0,.2); transition: transform .12s; }
.rond-couleurs:hover, .rond-couleurs[aria-expanded="true"] { transform: scale(1.12); }
.palette { position: fixed; z-index: 1000; width: 300px; max-width: calc(100vw - 16px); box-sizing: border-box; background: #fff; color: #2b2b2b;
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.28); padding: 12px 14px; font-size: 13px; }
.palette-ronds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 4px; margin: 10px 0 8px; }
.palette-ronds button { display: grid; justify-items: center; gap: 4px; background: none; border: none; cursor: pointer; font: inherit; font-size: 11px; line-height: 1.15; color: inherit; padding: 2px; text-align: center; }
.palette-ronds i { width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--a) 0 50%, var(--p) 0 100%); box-shadow: 0 0 0 1px rgba(0,0,0,.18); }
.palette-ronds button:hover i { transform: scale(1.08); }
.palette-ronds button[aria-pressed="true"] i { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2b2b2b; }
.palette-perso { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding-top: 8px; border-top: 1px solid #eee; }
.palette-perso label { display: flex; align-items: center; gap: 5px; }
.palette-perso input[type="color"] { width: 34px; height: 24px; padding: 0; border: 1px solid #ccc; border-radius: 4px; background: none; cursor: pointer; }
.palette .legende { margin: 8px 0 0; }
.rg-majuscules { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0; }
.rg-majuscules .case { white-space: nowrap; }
.fa-section .case input[type="checkbox"] { flex: none; width: auto; padding: 0; }

/* Papier à en-tête (Réglages → Présentations d'impression) */
.papier-pages { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.papier-page { display: flex; gap: 12px; align-items: flex-start; }
.papier-page .barre { margin: 6px 0; }
.papier-page label { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
.papier-page input[type=number] { width: 64px; }
.papier-vignette { width: 84px; height: 119px; border: 1px solid var(--bord, #ccc); background: #fff; display: flex; align-items: center; justify-content: center; color: #888; font-size: 11px; flex: none; }
.papier-vignette img { width: 100%; height: 100%; }

/* Approvisionnement : un chiffre en italique (lignes Nota / P.M.) déborde à droite, le champ le coupait (« 2,7C ») */
.appro input.q { padding-right: 7px; }
/* approvisionnement : champs en lecture tant qu'on n'a pas double-cliqué (un clic surligne la ligne) */
.appro input[readonly] { cursor: default; border-color: transparent; background: transparent; }
.appro input[readonly]:hover { border-color: #D9D2A6; background: transparent; }
.appro input[readonly]:focus { border-color: var(--gris-beton); background: transparent; }
.appro input:not([readonly]) { border-color: var(--accent); background: #fff; cursor: text; }
.appro tr.hors-total input { font-style: normal; }

/* Familles : code + libellé, et liste collée depuis Excel */
.liste-reglage input.code-famille { width: 110px !important; flex: none; font-family: Consolas, 'Courier New', monospace; }
.coller-familles { margin-top: 10px; display: flex; gap: 6px; align-items: flex-start; }
.coller-familles textarea { flex: 1; min-height: 54px; font: inherit; }
.ligne-reglage input[data-lib] { width: 360px !important; }

/* Images du devis (dans une zone de texte [TX]) : à l'écran, à l'impression et dans l'éditeur */
img.img-devis { display: block; height: auto; max-width: 100%; margin: 3px 0; }
[data-zone] img.img-devis { cursor: pointer; outline: 1px dashed #bbb; }
[data-zone] img.img-devis.choisie { outline: 2px solid var(--accent); }
#barreTexte .taille-img { font-size: 11px; display: inline-flex; align-items: center; gap: 2px; }
#barreTexte .taille-img button { width: auto; padding: 0 4px; font-size: 11px; }
/* Poignée de redimensionnement de l'image choisie (en modification) */
#poigneeImage { position: fixed; width: 12px; height: 12px; background: var(--accent); border: 2px solid #fff; border-radius: 2px; box-shadow: 0 0 0 1px var(--accent); cursor: nwse-resize; z-index: 60; }
#barreTexte .taille-img input { width: 52px; text-align: right; padding: 0 3px; font-size: 11px; }
#barreTexte .taille-img[hidden] { display: none; }

/* Mise à jour des prix depuis une étude */
.prix-barre { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.prix-barre select { max-width: 420px; }
.prix-filtres { display: flex; flex-wrap: wrap; gap: 4px; }
.prix-filtres .bt.actif { background: var(--bandeau); color: #fff; }
#tPrix tr.prix-identique td, #tPrix tr.prix-absent td { color: #8A8A8A; }
#tPrix tr.prix-unite td { background: #FFF6E0; }
.prix-hausse { color: #B3261E; }
.prix-baisse { color: #1E7B34; }
.prix-resume { margin-right: auto; align-self: center; font-size: 12px; }

/* Coefficients dans la feuille de vente : saisie, montant visé, scénarios */
.fv-outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: 980px; margin: 0 0 8px; }
.fv-saisie { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; max-width: 980px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid #E8892B; border-radius: 8px; background: #FFF6E0; }
.fv-saisie[hidden] { display: none; }
.fv-feuille input.fv-coef { width: 72px; text-align: right; font: inherit; padding: 1px 4px; border: 1px solid #BBB; border-radius: 3px; background: #FFFDF5; }
.fv-feuille input.fv-coef.modifie { background: #FFE7B8; border-color: #E8892B; font-weight: 700; }
.fv-feuille input.fv-coef.invalide { border-color: #B3261E; background: #FBE3E1; }
.fv-scenarios { max-width: 980px; margin: 0 0 18px; border: 1px solid var(--bord); border-radius: 8px; padding: 8px 14px 10px; }
.fv-scenarios legend { font-weight: 700; padding: 0 6px; }
.fv-scenarios tr.scen-actuelle td { background: #F4F1F8; }
.fv-scenarios tr.scen-en-place td:first-child { border-left: 3px solid #1E7B34; }
.fv-scenarios td.scen-diff { color: #B3261E; font-weight: 700; }
.fv-scenarios .scen-actions { white-space: nowrap; }
.viser-cible { display: flex; gap: 8px; align-items: center; font-weight: 700; margin-bottom: 6px; }
.viser-classes { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 10px; }
.viser-table { margin-bottom: 6px; }
@media print { .fv-outils, .fv-saisie, .fv-scenarios { display: none !important; } }
.viser-reste { padding: 6px 10px; border: 1px solid #E8892B; border-radius: 6px; background: #FFF6E0; }
.viser-reste b { font-size: 14px; }
.viser-reste.ok { border-color: #1E7B34; background: #EAF5EC; }
.viser-calcules { display: block; margin: 0 0 10px; padding: 6px 10px; border: 1px dashed #E8892B; border-radius: 6px; }
.viser-calcules[hidden] { display: none; }
.viser-erreur { padding: 6px 10px; border: 1px solid #B3261E; border-radius: 6px; background: #FBE3E1; color: #7A1A14; }
/* Pied du devis et montants annexes, comme Onaya : libellé à droite, base × taux, montant ; totaux sur fond clair */
.devis tr.pied td { padding: 5px 6px; border: 0; font-size: 13px; vertical-align: baseline; }
.devis tr.pied td.lib { text-align: right; font-weight: 700; }
.devis tr.pied td.base, .devis tr.pied td.taux { text-align: right; white-space: nowrap; }
.devis tr.pied td.mnt { text-align: right; font-weight: 700; white-space: nowrap; }
.devis tr.pied.st td { padding-top: 14px; }
.devis tr.pied.st td.lib, .devis tr.pied.chapitres td.lib, .devis tr.pied.tv td.lib, .devis tr.pied.tv td.mnt { font-weight: 400; }
.devis tr.pied.annexe { cursor: default; }
.devis tr.pied.tot td.mnt { background: var(--dv-montant); }
.devis tr.pied.ht td, .devis tr.pied.ttc td { padding-top: 9px; padding-bottom: 9px; }
.devis tr.pied.ht td.base, .devis tr.pied.ht td.taux, .devis tr.pied.ht td.taux + td,
.devis tr.pied.ttc td.base, .devis tr.pied.ttc td.taux, .devis tr.pied.ttc td.taux + td { border-top: 1px solid var(--dv-titre); }
.devis tr.pied.ht td.mnt { border-top: 2px solid var(--dv-titre); font-size: 14px; }
.devis tr.pied.ttc td.mnt { border-top: 1px solid var(--dv-titre); font-size: 14px; }
.devis tr.pied.ttc td { border-bottom: 1px solid var(--dv-titre); }
.devis tr.pied.annexe.vide td { color: var(--gris-beton, #999); }
/* Import d'un DQE */
.dqe-colonnes { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 4px 0 8px; }
.dqe-colonnes label { display: flex; flex-direction: column; font-size: 12px; color: #555; }
.dqe-colonnes select { min-width: 110px; }
.dqe-apercu td { vertical-align: top; }
.dqe-apercu td.dqe-desig { white-space: pre-wrap; max-width: 520px; }
.dqe-apercu tr.dqe-titre td { font-weight: 700; background: #EEF3F8; }
.dqe-apercu tr.dqe-suite td, .dqe-apercu tr.dqe-ignorer td { color: #8A8A8A; }
.dqe-apercu tr.dqe-ignorer td.dqe-desig { text-decoration: line-through; }

/* Onglet Ratios */
[data-panneau="ratios"] .carte { margin-bottom: 20px; }
.ratios-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 16px; }
.kpi-ratio { background: #fff; border: 1px solid var(--bord-doux); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi-ratio span { font-size: 11px; color: var(--gris-fer); }
.kpi-ratio b { font-size: 15px; color: var(--anthracite); font-variant-numeric: tabular-nums; }
table.ratios { border-collapse: collapse; width: 100%; }
table.ratios th, table.ratios td { padding: 3px 6px; border-bottom: 1px solid var(--bord-doux); font-size: 12px; }
table.ratios th { text-align: left; color: var(--gris-fer); font-weight: 600; }
table.ratios tr.total td { font-weight: 700; border-top: 2px solid var(--bord-doux); }
table.ratios tr.sous-ouvrage td { color: var(--gris-fer); font-style: italic; }
table.ratios tr.nota td { text-decoration: line-through; color: var(--gris-beton); }
table.ratios input.ratio { width: 70px; text-align: right; }
table.ratios td.actions { white-space: nowrap; }
.fiche-ratios { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px 22px; align-items: start; }
.fiche-ratios h3 { margin: 4px 0 6px; font-size: 13px; }
.fiche-ratios .entete-fr { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: 12px; }
.fiche-ratios .entete-fr input { width: 100%; }
.fiche-ratios input.fr-val { width: 96px; text-align: right; }
.fiche-ratios input.fr-val.saisi { background: #fff7d6; border-color: #e0b84a; }
.fiche-ratios .info { cursor: help; color: var(--gris-fer); margin-left: 4px; }
.fiche-ratios td.src { color: var(--gris-beton); font-size: 11px; white-space: nowrap; }
.fiche-ratios tr.groupe td { font-weight: 700; background: var(--fond-doux, #f4f4f4); }
.fiche-ratios tr.vide td.n { color: var(--gris-beton); }
table.rg-fr input { width: 100%; box-sizing: border-box; }
table.rg-fr td { padding: 2px 3px; }
[data-panneau="ratios"] h3 { font-size: 13px; margin: 14px 0 6px; }

/* Réglages ▸ Claude (IA) : connecteur en lecture seule */
.rg-claude-infos { grid-template-columns: 90px 1fr; }
.rg-claude-infos code, .rg-claude-etapes code { font: 11.5px Consolas, monospace; background: var(--fond, #f4f4f2); padding: 1px 4px; border-radius: 3px; word-break: break-all; }
.rg-claude-etapes { margin: 4px 0 8px 18px; padding: 0; line-height: 1.5; }
.rg-claude-etapes li { margin: 3px 0; }
pre.rg-claude-code { margin: 6px 0; padding: 8px 10px; background: #1f1f1d; color: #f2f2ee; border-radius: 6px; font: 11.5px/1.45 Consolas, monospace; white-space: pre-wrap; word-break: break-all; user-select: all; }
.rg-cl-resultat { margin-left: 10px; font-weight: 600; }
.rg-cl-resultat.ok { color: #2E7D32; }
.rg-cl-resultat.ko { color: var(--rouge); }
table.rg-claude-outils td:first-child { white-space: nowrap; vertical-align: top; }
table.rg-claude-outils td { padding: 3px 6px; }

/* Écran partagé : seconde moitié (cadre) à droite, séparateur déplaçable, liseré sur la moitié active */
.cadre-droite { flex: 1 1 0; min-width: 0; height: 100vh; border: 0; background: #fff; }
.separateur { flex: none; width: 6px; cursor: col-resize; background: var(--bord); }
.separateur:hover, body.glisse .separateur { background: var(--accent); }
body.glisse { cursor: col-resize; user-select: none; }
body.glisse .cadre-droite { pointer-events: none; }
body.partage:not(.actif-droite) #principal, body.partage.actif-droite .cadre-droite { outline: 2px solid var(--accent); outline-offset: -2px; }
/* dans la moitié droite : ni menu, ni réglages propres au poste (gérés par la fenêtre) */
.cadre #cote, .cadre #coteReduit, .cadre #btnFenetre, .cadre #btnPartager, .cadre #btnUtilisateur, .cadre #btnCouleurs { display: none !important; }
/* moitié étroite (écran partagé) : bandeau resserré selon la largeur de la moitié, pas de l'écran */
#principal { container: principal / inline-size; }
@container principal (max-width: 900px) {
  .nom-vue { display: none; }
  .bandeau { gap: 8px; padding: 8px 10px; }
  .utilisateur span { display: none; }
  .montant-ht { min-width: 0; padding: 4px 8px; }
  .cartouche b { font-size: 16px; }
}
/* la moitié droite garde la mise en page d'écran même sous 760 px (sinon toute la page défilerait) */
.cadre .corps { flex-direction: row; height: 100vh; }
@container principal (max-width: 600px) {
  .bandeau .utilisateur, .bandeau .rond-couleurs { display: none; }
}
/* Écran partagé : dans la moitié active, l'onglet de l'étude est en couleur ; la moitié inactive a son bandeau atténué */
.moitie-active .onglet-etude.actif { background: var(--accent); color: #fff; box-shadow: none; }
.moitie-active .onglet-etude.actif small, .moitie-active .onglet-etude.actif button { color: rgba(255,255,255,.85); }
.moitie-active .onglet-etude.actif button:hover { background: rgba(255,255,255,.25); }
.moitie-inactive .bandeau { filter: grayscale(.7); opacity: .6; transition: opacity .15s; }
/* Glisser au clic droit : étiquette qui suit le curseur */
.fantome-glisse { position: fixed; z-index: 1000; pointer-events: none; max-width: 320px; padding: 4px 10px; border-radius: 4px; background: var(--anthracite, #333); color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
body.glisse-droit, body.glisse-droit * { cursor: copy !important; user-select: none; }

/* Panneau Claude : à droite de l'étude, qui se resserre pour rester entièrement visible */
#principal { position: relative; }
#principal.avec-claude .contenu { margin-right: min(420px, 45%); }
.panneau-claude { position: absolute; right: 0; bottom: 0; width: min(420px, 45%); z-index: 20; display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--bord); box-shadow: -4px 0 14px rgba(0,0,0,.08); font-size: 13px; }
.panneau-claude[hidden] { display: none; }
.panneau-claude > header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--bord); }
.panneau-claude > header b { flex: 1; }
.panneau-claude > header button { background: none; border: 1px solid var(--bord); border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.panneau-claude > header button:hover { background: var(--survol); }
.pc-messages { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.pc-question { align-self: flex-end; max-width: 88%; background: var(--gris-clair); border-radius: 8px; padding: 6px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-reponse { line-height: 1.45; overflow-wrap: anywhere; }
.pc-reponse p { margin: 0 0 6px; }
.pc-reponse ul, .pc-reponse ol { margin: 0 0 6px 18px; padding: 0; }
.pc-reponse .pc-titre { font-weight: 700; margin: 8px 0 4px; }
.pc-reponse code { font: 12px Consolas, monospace; background: var(--gris-clair); padding: 0 3px; border-radius: 3px; }
.pc-tableau { overflow-x: auto; margin-bottom: 6px; }
.pc-tableau table { border-collapse: collapse; font-size: 12px; }
.pc-tableau th, .pc-tableau td { border: 1px solid var(--bord); padding: 2px 6px; text-align: left; vertical-align: top; }
.pc-tableau th { background: var(--gris-clair); }
.pc-lien { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.pc-infos { color: #6b6b66; font-size: 11px; margin-top: 2px; }
.pc-attente { color: #6b6b66; font-style: italic; }
.pc-erreur { color: var(--rouge); font-weight: 600; }
.pc-vide { color: #6b6b66; }
.pc-config { padding: 12px; border-top: 1px solid var(--bord); }
.pc-config p { margin: 0 0 8px; }
.pc-saisie { padding: 8px 10px; border-top: 1px solid var(--bord); }
.pc-saisie textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; padding: 6px; border: 1px solid var(--bord); border-radius: 4px; }
.pc-pied { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.pc-pied span { flex: 1; color: #6b6b66; font-size: 11px; }
#btnClaude.actif { background: var(--onglet-actif); color: var(--anthracite); }

/* Comptes et droits */
[data-droit][hidden], #btnPrendreMain[hidden], .cp-mot[hidden], .cx-erreur[hidden], #mdAnnuler[hidden], #cpPremier[hidden], #cpGestion[hidden] { display: none !important; }
.cx-voile-haut { z-index: 110; }
.cx-fenetre { width: min(420px, 100%); }
.cx-erreur { margin: 0 14px 10px; color: #B3261E; font-size: 13px; }
.cp-form { max-width: 460px; }
.cp-form input { border-radius: 4px; padding: 4px 8px; border: 1px solid #C9C9C9; width: 100%; }
.cp-table { width: 100%; }
.cp-table th, .cp-table td { text-align: center; vertical-align: middle; }
.cp-table th:first-child, .cp-table td:first-child { text-align: left; }
.cp-table td.cp-actions { white-space: nowrap; }
.cp-table .cp-moi { color: var(--gris-fer); font-size: 12px; }
.cp-table tr.cp-inactif td { opacity: .55; }
.cp-mot { margin-top: 10px; padding: 8px 12px; border: 1px solid var(--bord); border-left: 4px solid var(--accent); background: #FAFAFA; }
.cp-mot code { font-size: 15px; user-select: all; font-weight: 700; }
.cp-ajout { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.cp-ajout .case { white-space: nowrap; }
.cp-ajout .case input { width: auto; }
.cp-ajout input[name="nom"] { border-radius: 4px; padding: 4px 8px; border: 1px solid #C9C9C9; }

/* Barre d'insertion, sous la ligne sélectionnée */
#tDevis tr.barre-insertion > td { background: var(--accent); padding: 4px 8px; white-space: normal; overflow: visible; }
.bi-corps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: #fff; font-size: 12px; font-weight: 600; }
.bi-corps select { flex: 1; min-width: 0; max-width: 560px; padding: 3px 6px; border: 1px solid transparent; border-radius: 4px; background: #fff; color: #1A1A1A; font: inherit; font-weight: 400; }
.bi-corps .bt { flex: none; }
.bi-corps .bi-lieu { min-width: 84px; }
.bi-corps .bi-lieu:disabled { opacity: 1; cursor: default; }
.bi-aide { flex: 1 0 100%; font-size: 11px; font-weight: 400; }

/* ---------- Écran de connexion SOCARA : panneau rouge et formulaire ---------- */
:is(#voileConnexion, #voileMot)[hidden], :is(#voileConnexion, #voileMot) .sl-error[hidden] { display: none !important; }
.socara-login {
  --rouge:       #E30613;
  --rouge-fonce: #B00010;
  --jaune:       #FFDD00;
  --anthracite:  #1A1A1A;
  --gris-fer:    #3D3D3A;
  --gris-clair:  #F4F4F2;
  --bordure:     #E5E5E2;
  --blanc:       #FFFFFF;

  /* Couleur du panneau : #B00010 (défaut), #E30613, #1A1A1A ou #3D3D3A */
  --panneau: var(--rouge-fonce);
}

:is(#voileConnexion, #voileMot).socara-login {
  display: block;
  padding: 0;
  overflow: auto;
  z-index: 100;
  font-family: 'Mont', 'Barlow', sans-serif; /* écran d'accès : la marque, toujours en Mont (charte v3) */
  background: var(--gris-clair);
  color: var(--anthracite);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Mise en page ---------- */
:is(#voileConnexion, #voileMot) .sl-layout {
  width: 100%;
  display: flex;
  min-height: 100vh;
}

/* ---------- Panneau gauche ---------- */
:is(#voileConnexion, #voileMot) .sl-panel {
  position: relative;
  overflow: hidden;
  flex: 0 0 37.5%;          /* 540 px sur un écran de 1440 px */
  max-width: 600px;
  min-width: 380px;
  background: var(--panneau);
  color: var(--blanc);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 56px 48px;
}

/* Barre signature jaune 4 px */
:is(#voileConnexion, #voileMot) .sl-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--jaune);
}

/* Grand symbole S en filigrane */
:is(#voileConnexion, #voileMot) .sl-panel::after {
  content: '';
  position: absolute;
  right: -260px;
  bottom: -200px;
  width: 720px;
  height: 720px;
  background: url('img/logo_casque_blanc.png') center / contain no-repeat;
  opacity: 0.08;
  pointer-events: none;
}

:is(#voileConnexion, #voileMot) .sl-panel > * { position: relative; z-index: 1; }

:is(#voileConnexion, #voileMot) .sl-logo { width: 56px; height: 56px; display: block; }

:is(#voileConnexion, #voileMot) .sl-brand { display: flex; flex-direction: column; gap: 14px; }

:is(#voileConnexion, #voileMot) .sl-kicker {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--jaune);
}

:is(#voileConnexion, #voileMot) .sl-title {
  margin: 0;
  font-weight: 700;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: var(--blanc);
}

:is(#voileConnexion, #voileMot) .sl-l1 { display: block; }

:is(#voileConnexion, #voileMot) .sl-rule { width: 48px; height: 4px; border-radius: 2px; background: var(--jaune); }

:is(#voileConnexion, #voileMot) .sl-meta { font-weight: 300; font-size: 12px; color: rgba(255,255,255,0.85); }

/* ---------- Zone formulaire ---------- */
:is(#voileConnexion, #voileMot) .sl-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
}

:is(#voileConnexion, #voileMot) .sl-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }

:is(#voileConnexion, #voileMot) .sl-head { display: flex; flex-direction: column; gap: 6px; }

:is(#voileConnexion, #voileMot) .sl-label-caps {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--rouge-fonce);
}

:is(#voileConnexion, #voileMot) .sl-h2 { display: block; padding: 0; border: 0; margin: 0; font-weight: 700; font-size: 26px; letter-spacing: -0.5px; }

:is(#voileConnexion, #voileMot) .sl-intro { margin: 0; font-weight: 300; font-size: 14px; color: var(--gris-fer); }

:is(#voileConnexion, #voileMot) .sl-field { display: flex; flex-direction: column; gap: 6px; }

:is(#voileConnexion, #voileMot) .sl-field label { font-weight: 400; font-size: 13px; color: var(--gris-fer); }

:is(#voileConnexion, #voileMot) .sl-field input {
  font: 400 14px/1.4 'Mont', 'Barlow', sans-serif;
  color: var(--anthracite);
  background: var(--blanc);
  padding: 12px 16px;
  border: 1.5px solid var(--bordure);
  border-radius: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

:is(#voileConnexion, #voileMot) .sl-field input:focus {
  outline: none;
  border-color: var(--rouge);
  box-shadow: 0 0 0 3px rgba(227,6,19,0.12);
}

:is(#voileConnexion, #voileMot) .sl-help { margin: 0; font-weight: 300; font-size: 12px; line-height: 1.5; color: var(--gris-fer); }

:is(#voileConnexion, #voileMot) .sl-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(227,6,19,0.08);
  color: var(--rouge-fonce);
  font-size: 13px;
}

:is(#voileConnexion, #voileMot) .sl-submit {
  min-height: 48px;
  font: 700 12px 'Mont', 'Barlow', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--blanc);
  background: var(--anthracite);
  border: none;
  border-radius: 50px;
  padding: 14px 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all .25s ease;
}

:is(#voileConnexion, #voileMot) .sl-submit:hover  { background: var(--rouge); box-shadow: 0 8px 24px rgba(227,6,19,0.4); transform: translateY(-2px); }
:is(#voileConnexion, #voileMot) .sl-submit:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; }

/* ---------- Petits écrans : le panneau devient un bandeau ---------- */
@media (max-width: 900px) {
  :is(#voileConnexion, #voileMot) .sl-layout { flex-direction: column; }
  :is(#voileConnexion, #voileMot) .sl-panel {
    flex: 0 0 auto;
    max-width: none;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 24px 24px 20px;
  }
  :is(#voileConnexion, #voileMot) .sl-panel::after { width: 320px; height: 320px; right: -120px; bottom: -140px; }
  :is(#voileConnexion, #voileMot) .sl-logo { width: 40px; height: 40px; }
  :is(#voileConnexion, #voileMot) .sl-brand { gap: 4px; }
  :is(#voileConnexion, #voileMot) .sl-title { font-size: 24px; }
  :is(#voileConnexion, #voileMot) .sl-l1 { display: inline; }
  :is(#voileConnexion, #voileMot) .sl-rule, :is(#voileConnexion, #voileMot) .sl-meta { display: none; }
  :is(#voileConnexion, #voileMot) .sl-main { align-items: flex-start; padding: 32px 20px; }
}

/* Changement de mot de passe : au-dessus de la connexion, avec un bouton Annuler à côté du bouton principal */
#voileMot.socara-login { z-index: 110; }
#voileMot .sl-actions { display: flex; gap: 12px; align-items: center; }
#voileMot .sl-submit { flex: 1; }
#voileMot .sl-annuler { min-height: 48px; padding: 14px 24px; font: 700 12px 'Mont', 'Barlow', sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--anthracite); background: transparent; border: 1.5px solid var(--bordure); border-radius: 50px; cursor: pointer; }
#voileMot .sl-annuler:hover { border-color: var(--anthracite); }
#voileMot .sl-annuler:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; }

/* Ligne de texte du sous-détail (note de calcul) */
#tDevis tr.sd-note td.sd-note-texte { white-space: pre-line; font-style: italic; padding-top: 2px; padding-bottom: 2px; cursor: text; }
#tDevis textarea.sd-note-saisie { display: block; width: 100%; box-sizing: border-box; font: inherit; font-style: normal; resize: vertical; }
.d-note-texte { white-space: pre-line; font-style: italic; }

/* Import d'une étude depuis un XML Onaya */
.ix-corps { padding: 14px; font-size: 13px; overflow: auto; }
.ix-corps p { margin: 6px 0; }
.ix-corps ul { margin: 4px 0 8px; padding-left: 20px; }
.ix-corps .barre { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ix-corps .barre .legende { margin: 0; overflow-wrap: anywhere; min-width: 0; flex: 1; }
.se-saisie { display: block; margin-top: 12px; font-weight: 600; }
#seSaisie { width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid #C9C9C9; border-radius: 4px; font: inherit; box-sizing: border-box; }
.bt.se-supprimer:not(:disabled) { background: #B42318; border-color: #B42318; color: #fff; }
.bt.se-supprimer:disabled { opacity: .45; cursor: default; }
/* Suppression en cours : bouton rouge plein avec une roue qui tourne, Annuler et la croix grisés */
/* #voileSupprEtude : passe devant « [data-couleurs=charte] #vide .bt » (fond blanc) de charte-composants.css */
#voileSupprEtude .bt.se-supprimer:not(:disabled) { background: #B42318; border-color: #B42318; color: #fff; }
#voileSupprEtude .bt.se-supprimer.occupe { opacity: 1; background: #B42318; border-color: #B42318; color: #fff; cursor: progress; display: inline-flex; align-items: center; gap: 8px; }
.se-roue { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: se-tourne .8s linear infinite; flex: none; }
@keyframes se-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .se-roue { animation-duration: 2s; } }
#voileSupprEtude.occupe [data-fermer] { opacity: .45; pointer-events: none; }
#voileSupprEtude.occupe .fenetre-simple { cursor: progress; }
.se-etape { margin-top: 10px; font-size: 12px; color: #5B5B57; }
.ix-message { margin-top: 10px; }
.ix-message.erreur { color: #B02A1A; font-weight: 600; }
.ix-message.reussi { margin-top: 0; }
.ix-total { font-size: 15px; }
#ixImporter:disabled { opacity: .45; cursor: default; }
.ix-liste { max-height: 160px; overflow: auto; margin: 0; padding-left: 20px; font-size: 12px; }
.ix-bilan { width: 100%; margin-top: 8px; font-size: 12px; }
.ix-bilan td { vertical-align: top; overflow-wrap: anywhere; }
.ix-bilan td:first-child { width: 38%; word-break: break-all; }
.ix-bilan tr.ix-refuse td:last-child { color: #B02A1A; }
.ix-bilan tr.ix-deja td:last-child { color: var(--gris-beton); }
.ix-bilan tr.ix-doublon td:last-child { background: rgba(255,221,0,.14); }
.ix-meme-code { margin: 6px 0; padding-left: 20px; }
.ix-bilan small { color: #8A5A00; }
.ix-bilan .ix-ouvrir, .ix-meme-code .ix-ouvrir { background: none; border: 0; padding: 0; margin-left: 6px; font: inherit; color: var(--bandeau); text-decoration: underline; cursor: pointer; }
#voileImportXml .ix-corps { max-height: 70vh; }
.ix-attention { background: rgba(255,221,0,.18); border-left: 4px solid var(--jaune-dore); border-radius: 0 6px 6px 0; padding: 6px 10px; }
.ix-ignores { margin: 8px 0; } .ix-ignores summary { cursor: pointer; } .ix-ignores p { font-size: 12px; word-break: break-word; max-height: 160px; overflow: auto; }

/* Chiffreur (agent Claude) : pastille « à valider » et fenêtre des propositions */
.tag-agent { background: #e8f0fb; color: #1d4f91; border: 1px solid #9db8e0; border-radius: 6px; padding: 0 5px; font-size: 9px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.agent-reglages { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.agent-reglages input { width: 70px; margin-left: 6px; }
.agent-h { margin: 12px 0 4px; }
.agent-boutons { white-space: nowrap; }
.agent-boutons .bt { padding: 2px 6px !important; margin-left: 3px; }
.agent-source { white-space: nowrap; font-size: 11px; }
#tAgentProps .st-lib { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-laissees { margin: 4px 0; padding-left: 18px; font-size: 12px; }

/* Icônes SVG (étape 5 de la charte, tous les thèmes) : prennent la couleur du texte */
svg.ic { width: 1.15em; height: 1.15em; vertical-align: -.2em; pointer-events: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.fa-icone svg.ic { width: 28px; height: 28px; vertical-align: 0; }
.poignee svg.ic { width: 14px; height: 14px; }

/* Barre « Études / Chantiers / Planning » en haut du menu gauche (Études de prix et Chantier-Situations), reprise de Planning ; tous les thèmes */
aside .bascule { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin: 10px 12px 4px; flex: none; padding: 4px;
  background: color-mix(in srgb, currentColor 9%, transparent); border-radius: var(--radius-lg, 12px); }
aside .bascule button { border: 0; background: none; text-align: center; padding: 8px 2px; min-height: 0; width: auto; box-shadow: none; letter-spacing: 0; text-transform: none;
  border-radius: var(--radius-md, 8px); font-family: var(--font-mont, Montserrat, sans-serif); font-size: 11px; font-weight: 400; color: inherit; opacity: .85; cursor: pointer; }
aside .bascule button:hover { opacity: 1; }
aside .bascule button.on { background: #fff; color: var(--anthracite, #1a1a1a); font-weight: 700; opacity: 1; cursor: default; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
aside .bascule button:focus-visible { outline: 2px solid var(--jaune, #ffdd00); outline-offset: 1px; }
body.ch-cote-reduit .bascule { display: none; }
@media print { .bascule { display: none !important; } }
.fl svg.ic { width: 12px; height: 12px; vertical-align: -2px; }
