/* La déclaration de TVA – feuille de style commune à tous les niveaux
   Structure du modèle co-int ; couleurs reprises de miseenforme-orange.css */

:root {
	--pourpre: #C45911;        /* couleur principale : orange */
	--pourpre-fonce: #9A4409;
	--pourpre-clair: #FBEADB;
	--rouge: #C02539;
	--rouge-vif: #DC143C;
	--jaune: #FCC419;
	--jaune-clair: #FFF6D6;
	--vert: #187C09;           /* ce qu'on te donne */
	--vert-fonce: #125E07;
	--menthe: #E4F1E1;
	--menthe-clair: #F3F9F1;
	--brun: #6D3109;
	--gris: #F2F2F2;
	--gris-ligne: #E2DEDA;
	--fond: #F5F4F3;
	--texte: #2E2A27;
	--texte-doux: #6A625C;
	--ok: #187C09;
	--ok-fond: #E4F1E1;
	--ko: #C02539;
	--ko-fond: #FBE6E9;
	--rayon: 10px;
	--largeur-score: 118px;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--fond);
	color: var(--texte);
	font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}
button, select, input { font-family: inherit; }
.cache { display: none !important; }
[hidden] { display: none !important; }   /* l'attribut hidden l'emporte sur les display des composants */

/* ===== Barre du haut ===== */
.topbar {
	position: sticky; top: 0; z-index: 20;
	background: var(--pourpre); color: #fff;
	display: flex; align-items: center; gap: 16px;
	padding: 10px 24px;
}
.topbar .logo { height: 46px; width: 46px; background: #fff; border-radius: 8px; padding: 3px; object-fit: contain; }
.topbar .titres { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.25; }
.topbar .sous-titre { font-size: 13px; opacity: .9; }
.badge-niveau {
	display: inline-block; background: var(--jaune); color: var(--brun);
	font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 20px;
	margin-left: 8px; vertical-align: middle;
}
.puce-eleve {
	display: flex; align-items: center; gap: 8px;
	background: rgba(255, 255, 255, .16); border-radius: 30px;
	padding: 6px 14px; font-size: 14px; white-space: nowrap;
}
.puce-eleve button {
	display: inline-flex; background: transparent; color: #fff; border: 0; padding: 2px; cursor: pointer; opacity: .85;
}
.puce-eleve button:hover { opacity: 1; }
.puce-eleve button:disabled { opacity: .35; cursor: default; }
.chrono { font-variant-numeric: tabular-nums; }

/* ===== Mise en page ===== */
main { max-width: 1440px; margin: 22px auto 0; padding: 0 calc(var(--largeur-score) + 30px) 0 24px; }

.carte {
	background: #fff; border-radius: var(--rayon);
	border: 1px solid var(--gris-ligne);
	margin-bottom: 18px; overflow: hidden;
}
.carte-titre {
	display: flex; align-items: center; gap: 10px; width: 100%;
	background: var(--pourpre); color: #fff;
	padding: 10px 16px; font-weight: 600; font-size: 16px; border: 0; text-align: left;
}
.carte-titre.vert { background: var(--vert); }
.carte-titre.jaune { background: var(--jaune); color: var(--brun); }
.carte-titre svg { flex: none; }
.carte-corps { padding: 14px 18px; }

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grille.simple { grid-template-columns: 1fr; }
.grille > .carte { margin-bottom: 18px; }

/* ----- Consigne repliable ----- */
.consigne { display: flex; gap: 14px; }
.consigne .ico {
	flex: none; width: 40px; height: 40px; border-radius: 50%;
	background: var(--pourpre-clair); color: var(--pourpre);
	display: flex; align-items: center; justify-content: center;
}
.consigne-texte { flex: 1; min-width: 0; }
.consigne-texte h2 { margin: 0; font-size: 16px; }
.consigne-bascule {
	display: flex; align-items: center; gap: 8px; width: 100%;
	background: none; border: 0; padding: 8px 0; cursor: pointer;
	font-size: 16px; font-weight: 600; color: var(--pourpre); text-align: left;
}
.chevron { transition: transform .25s; }
.repliee .chevron { transform: rotate(-90deg); }
.consigne-contenu, .pliable { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .25s; }
.consigne-contenu > div, .pliable > div { overflow: hidden; }
.repliee .consigne-contenu, .repliee .pliable { grid-template-rows: 0fr; }
#listeConsignes { margin: 4px 0 10px; padding-left: 20px; }
#listeConsignes li { margin: 3px 0; }
.legende { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--texte-doux); padding-bottom: 6px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.pastille { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }

/* ----- Encadrés d'information (vert = ce qu'on te donne) ----- */
.bascule-carte { cursor: pointer; }
.bascule-carte span { flex: 1; }
.info { background: var(--menthe-clair); color: var(--texte); }
.info ul { margin: 0; padding-left: 20px; }
.info li { margin: 3px 0; }
.info p { margin: 0 0 6px; }

/* ----- Mémo partie double ----- */
.memo { background: var(--jaune-clair); color: var(--brun); }
.memo p { margin: 0 0 6px; }
.memo .regle { display: flex; gap: 10px; align-items: baseline; margin: 4px 0; }
.memo .ordre { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #E8CF8A; }

/* ===== Tableaux de saisie ===== */
.defile { overflow-x: auto; }
table.saisie { width: auto; border-collapse: collapse; font-size: 13.5px; }
table.saisie th {
	background: var(--jaune); color: var(--rouge);
	font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
	padding: 6px 6px; text-align: center; border: 1px solid #F1D57A; line-height: 1.25;
}
table.saisie td { padding: 4px 5px; border: 1px solid var(--gris-ligne); vertical-align: middle; text-align: center; }
table.saisie td.donnee { color: var(--texte); white-space: nowrap; }
table.saisie td.donnee.num { text-align: right; font-variant-numeric: tabular-nums; }
table.saisie td:first-child.donnee:not(.num):not(.date) { text-align: left; white-space: normal; }
table.saisie td.sans-objet { background: #FAF9F8; }
table.saisie td.etat, table.saisie th.th-etat { width: 34px; border-left: 2px solid var(--gris-ligne); }
table.saisie tr.ligne-total td { border-top: 2px solid var(--pourpre); background: var(--pourpre-clair); font-weight: 600; }
.carte-donnees table.saisie th { background: var(--menthe); color: var(--vert-fonce); border-color: #CFE5CA; }

.champ {
	width: 100%; min-width: 54px; height: 32px; padding: 0 6px;
	border: 1.5px solid #D9CFC7; border-radius: 6px; background: #fff;
	color: var(--texte); font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums;
}
.champ:focus { outline: none; border-color: var(--pourpre); box-shadow: 0 0 0 3px var(--pourpre-clair); background: #fff; }
.champ-date { min-width: 64px; text-align: center; }
.champ-doc { min-width: 100px; text-align: left; }
.champ-op { width: 38px; min-width: 38px; text-align: center; font-weight: 700; font-size: 16px; }
.champ-prix { min-width: 64px; }
.champ-mt { min-width: 84px; }
select.champ { text-align: left; cursor: pointer; min-width: 180px; }
td.ok .champ, .cellule.ok .champ { border-color: var(--ok); background: var(--ok-fond); }
td.ko .champ, .cellule.ko .champ { border-color: var(--ko); background: var(--ko-fond); }

/* Oui / Non */
.bascule { display: inline-flex; border: 1.5px solid #D9CFC7; border-radius: 6px; overflow: hidden; }
.bascule button { border: 0; background: #fff; color: var(--texte-doux); padding: 5px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.bascule button + button { border-left: 1.5px solid #D9CFC7; }
.bascule button.actif { background: var(--pourpre); color: #fff; }
td.ok .bascule { border-color: var(--ok); } td.ok .bascule button.actif { background: var(--ok); }
td.ko .bascule { border-color: var(--ko); } td.ko .bascule button.actif { background: var(--ko); }

.etat-ico svg { display: none; }
.ligne-ok > .etat .i-ok, .ligne-ok .etat-ico .i-ok { display: inline; color: var(--ok); }
.ligne-ko > .etat .i-ko, .ligne-ko .etat-ico .i-ko { display: inline; color: var(--ko); }

.corr { display: none; margin-top: 3px; font-size: 11.5px; color: var(--rouge); font-weight: 600; white-space: nowrap; }
body.corrige .corr { display: block; }
.note { margin: 0; padding: 8px 16px 12px; font-size: 13px; color: var(--texte-doux); font-style: italic; }

/* ----- Informations données ----- */
.info-ligne { margin: 3px 0; }

/* ----- Documents des mouvements ----- */
.mouvements { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; background: var(--menthe-clair); }
.mvt { background: #fff; border: 1px solid #CFE5CA; border-left: 4px solid var(--vert); border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.mvt.mvt-out { border-left-color: var(--rouge); }
.mvt-haut { display: flex; justify-content: space-between; gap: 6px; font-weight: 700; }
.mvt-doc { color: var(--texte); }
.mvt-date { color: var(--texte-doux); font-weight: 600; }
.mvt-ref { font-size: 12px; color: var(--texte-doux); margin-top: 2px; }
.mvt-des { font-size: 12.5px; }
.mvt-qte { margin-top: 3px; }
.mvt-in .mvt-qte strong { color: var(--vert); }
.mvt-out .mvt-qte strong { color: var(--rouge); }
.mvt-pu { color: var(--texte-doux); }

/* ----- Lignes de calcul ----- */
.calculs { display: flex; flex-direction: column; gap: 10px; }
.calcul { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--gris-ligne); border-radius: 8px; }
.calcul-titre { min-width: 150px; font-weight: 600; color: var(--pourpre); }
.calcul-formule { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
.calcul-formule .cellule { display: inline-flex; flex-direction: column; align-items: center; position: relative; }
.calcul-formule .cellule .champ { width: 92px; }
.calcul-formule .cellule .champ-op { width: 38px; }
.calcul-formule .cellule select.champ { width: auto; }
.calcul-formule .aide { position: absolute; top: -8px; right: -8px; }
.jeton-txt { font-size: 18px; font-weight: 600; color: var(--texte-doux); }
.calcul > .etat { width: 24px; text-align: center; }

/* ----- Infobulles d'aide ----- */
.aide { display: inline-flex; color: var(--pourpre); cursor: help; vertical-align: middle; position: relative; }
.aide .bulle {
	display: none; position: fixed; z-index: 60; max-width: 260px;
	background: var(--texte); color: #fff; font-size: 12.5px; font-weight: 400; text-transform: none; letter-spacing: 0;
	line-height: 1.4; padding: 8px 10px; border-radius: 6px; text-align: left; white-space: normal;
}
.aide:hover .bulle.placee, .aide:focus .bulle.placee { display: block; }

/* ----- Vérification d'un tableau ----- */
.verif-cas {
	display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
	margin: -8px 0 22px; padding: 0 2px;
}
.verif-cas-info { font-size: 13px; color: var(--texte-doux); }

/* ===== Boutons ===== */
.btn {
	display: inline-flex; align-items: center; gap: 8px;
	border: 0; border-radius: 8px; cursor: pointer;
	font-size: 15px; font-weight: 600; padding: 10px 18px;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn-principal { background: var(--rouge-vif); color: #fff; }
.btn-principal:hover:not(:disabled) { background: var(--jaune); color: var(--rouge); }
.btn-second { background: #fff; color: var(--pourpre); border: 1.5px solid var(--pourpre); }
.btn-second:hover:not(:disabled) { background: var(--pourpre-clair); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 18px; }

.bandeau-cloture {
	display: flex; align-items: center; gap: 10px;
	background: var(--pourpre-clair); color: var(--pourpre-fonce);
	border-radius: var(--rayon); padding: 12px 16px; margin-bottom: 18px; font-weight: 600;
}
body.cloture select.champ { pointer-events: none; }

/* ===== Jauge de réussite (à droite de l'écran) ===== */
.score {
	position: fixed; right: 18px; top: 92px; z-index: 15;
	width: var(--largeur-score);
	background: #fff; border: 1px solid var(--gris-ligne); border-radius: var(--rayon);
	padding: 12px 10px; text-align: center;
}
.score-titre { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--pourpre); letter-spacing: .03em; }
.score-valeur { font-size: 26px; font-weight: 700; color: var(--texte); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.jauge {
	position: relative; width: 26px; height: 180px; margin: 0 auto 10px;
	background: var(--gris); border-radius: 14px; overflow: hidden;
}
.jauge div { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--pourpre); transition: height .5s, width .5s; }
.jauge.parfait div { background: var(--vert); }
.score-texte { margin: 0 0 4px; font-size: 12px; color: var(--texte); }
.penalite { margin: 0; font-size: 11.5px; color: var(--texte-doux); }

footer { text-align: center; color: var(--texte-doux); font-size: 13px; padding: 18px 0 26px; }

/* ===== Fenêtres ===== */
.voile {
	position: fixed; inset: 0; z-index: 100;
	background: rgba(46, 42, 39, .55);
	display: flex; align-items: center; justify-content: center; padding: 20px;
}
.fenetre { background: #fff; border-radius: 12px; width: 100%; max-width: 440px; overflow: hidden; }
.fenetre.alerte .carte-titre { background: var(--rouge); }
.fenetre form, .dialogue-corps { padding: 18px; }
.fenetre label { display: block; font-weight: 600; margin-bottom: 8px; }
.fenetre input {
	width: 100%; height: 42px; padding: 0 12px; font-size: 15px; margin-bottom: 16px;
	border: 1.5px solid #D9CFC7; border-radius: 8px;
}
.fenetre input:focus { outline: none; border-color: var(--pourpre); box-shadow: 0 0 0 3px var(--pourpre-clair); }
.fenetre form .btn { width: 100%; justify-content: center; }
.dialogue-corps p { margin: 0 0 16px; }
.dialogue-boutons { display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Impression ===== */
.entete-impression { display: none; }

@media (max-width: 860px) {
	main { padding: 0 14px; }
	.grille { grid-template-columns: 1fr; }
	.score {
		position: sticky; top: auto; bottom: 0; right: auto; width: auto;
		display: flex; align-items: center; gap: 12px; border-radius: 0; border-width: 1px 0 0;
		text-align: left;
	}
	.score-valeur { margin: 0; font-size: 20px; }
	.jauge { flex: 1; width: auto; height: 12px; margin: 0; }
	.jauge div { top: 0; bottom: 0; right: auto; height: auto; width: 0; }
	.score-texte, .penalite { display: none; }
}

@media print {
	@page { size: A4 landscape; margin: 8mm; }
	.defile { overflow: visible !important; }
	body { background: #fff; font-size: 9.5pt; color: #000; }
	.topbar, .score, .voile, .actions, .verif-cas, footer, #carteConsignes, .bandeau-cloture, .section-mouvements { display: none !important; }
	main { max-width: none; margin: 0; padding: 0; }
	.entete-impression { display: block; margin-bottom: 3mm; }
	.entete-impression h1 { font-size: 12pt; margin: 0 0 2mm; }
	.entete-impression table { width: 100%; border-collapse: collapse; font-size: 9.5pt; border-bottom: 1px solid #000; }
	.entete-impression td { padding: 1mm 0; }
	.grille { display: block; }
	.carte { border: 1px solid #999; border-radius: 0; margin-bottom: 3mm; break-inside: auto; }
	.carte-titre, .carte-titre.vert, .carte-titre.jaune { background: none !important; color: #000; border-bottom: 1px solid #999; padding: 1mm 2mm; font-size: 10pt; }
	.carte-titre .chevron { display: none; }
	.carte-corps { padding: 1.5mm 2mm; }
	.pliable { display: block; }
	.info, .memo { background: none; color: #000; }
	table.saisie { font-size: 8pt; }
	table.saisie th { background: none !important; color: #000; border: 1px solid #999; padding: .8mm 1mm; font-size: 7pt; }
	table.saisie td { padding: .6mm 1mm; border: 1px solid #bbb; background: none !important; }
	table.saisie tr { break-inside: avoid; }
	.champ, td.ok .champ, td.ko .champ, .cellule.ok .champ, .cellule.ko .champ { -webkit-appearance: none; appearance: none; border: 0; background: none; height: auto; padding: 0; min-width: 0; font-size: 8pt; color: #000; }
	.bascule { border: 0; } .bascule button { display: none; padding: 0; } .bascule button.actif { display: inline; background: none !important; color: #000; }
	.mouvements, .info-carte { display: none !important; }
	.calcul { border: 0; padding: 1mm 0; } .calcul-formule .cellule .champ { width: auto; }
	.aide { display: none; }
	.ligne-ok .etat-ico .i-ok, .ligne-ko .etat-ico .i-ko { color: #000; }
	.corr { display: none !important; }
}

/* Formule à reconstituer : listes plus étroites pour tenir sur une ligne */
.section-selection .calcul-formule .cellule select.champ { min-width: 150px; max-width: 210px; }

/* ===== Largeur des colonnes adaptée au contenu ===== */
/* Le tableau prend la largeur de son contenu ; chaque case a la largeur de la donnée attendue. */
table.saisie .champ { width: 64px; min-width: 0; }
table.saisie .champ-qte { width: 64px; }
table.saisie .champ-prix { width: 68px; }
table.saisie .champ-mt { width: 92px; }
table.saisie .champ-date { width: 66px; }
table.saisie .champ-doc { width: 112px; }
table.saisie th { min-width: 0; }
table.saisie td.donnee { white-space: nowrap; }
table.saisie td:first-child.donnee:not(.num):not(.date) { white-space: normal; }
/* chaque colonne prend la largeur minimale de son contenu ; les en-têtes passent à la ligne */
table.saisie th, table.saisie td { width: 1px; }
table.saisie td.donnee.long { white-space: normal; min-width: 190px; }
.carte > .defile { padding: 0; }

.calcul-formule .cellule .champ-op { width: 38px; }

/* ===== Tableaux côte à côte quand la place le permet ===== */
#contenu { display: flex; flex-wrap: wrap; gap: 0 22px; align-items: flex-start; }
#contenu > .section { flex: 0 1 auto; min-width: 0; max-width: 100%; }
#contenu > .section-mouvements { flex-basis: 100%; }
#contenu > .section > .carte { width: max-content; max-width: 100%; }
#contenu > .section-mouvements > .carte { width: auto; }
.section .note { max-width: 640px; }
@media print { #contenu { display: block; } #contenu > .section > .carte { width: auto; } }
#contenu > .section > .carte table.saisie { min-width: 100%; }
table.saisie td.donnee.long { text-align: left; }
/* Calculs : se placent à côté de la fiche s'il reste au moins 300 px, sinon dessous */
#contenu > .section-calculs { flex: 1 1 300px; min-width: 300px; }
#contenu > .section-calculs > .carte { width: auto; }
.calcul { flex-wrap: wrap; row-gap: 6px; }
.calcul-titre { min-width: 0; flex: 0 0 auto; margin-right: 6px; }
.calcul-formule { flex: 1 1 260px; }
.calcul-formule .cellule .champ { width: 76px; }
.calcul-formule .cellule .champ-op { width: 38px; }
#contenu > .section-selection { flex: 1 1 300px; min-width: 300px; }
#contenu > .section-selection > .carte { width: auto; }

/* ===== Alignement selon la nature de la donnée ===== */
table.saisie td.donnee.num { text-align: right; }
table.saisie td.donnee.date { text-align: center; }
table.saisie td.donnee.texte, table.saisie td.donnee.code, table.saisie td.donnee.long { text-align: left; }
table.saisie tr.ligne-total td.donnee.texte { text-align: left; }
table.saisie td[class^="saisie-"] { text-align: center; }
.champ-date, .champ-op { text-align: center; }
.champ-doc, select.champ { text-align: left; }

/* ===== Justification des calculs ===== */
.calcul { position: relative; align-items: flex-start; padding: 10px 40px 10px 12px; }
.calcul-titre { flex-basis: 100%; margin: 0; }
.calcul > .etat { position: absolute; right: 12px; top: 10px; }
.cellule { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.legende-case { font-size: 11px; line-height: 1.2; color: var(--texte-doux); text-align: center; max-width: 100px; }
.calcul-formule { align-items: flex-start; gap: 8px; }
.calcul-formule .jeton-txt, .frac-resultat .jeton-txt { padding-top: 4px; }
.calcul-cmup { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fraction { display: inline-flex; flex-direction: column; align-items: stretch; }
.frac-ligne { display: flex; justify-content: center; align-items: flex-start; gap: 6px; }
.frac-barre { height: 2px; background: var(--texte); margin: 6px 0; border-radius: 1px; }
.frac-resultat { display: flex; align-items: flex-start; gap: 8px; }
.calculs .cellule .champ { width: 82px; }
.calculs .cellule .champ-mt { width: 90px; }
.calculs .cellule .champ-op { width: 38px; }
.calculs .cellule select.champ { width: 175px; min-width: 0; }
.section-calculs .calculs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 10px; }
.section-calculs .aide { display: none; }
@media print { .legende-case { font-size: 7pt; } .frac-barre { background: #000; } }

/* ===== Déclaration de TVA ===== */
table.saisie tr.ligne-groupe td { background: var(--orange-clair, #FBEADB); color: var(--pourpre-fonce); font-weight: 700; text-align: left; text-transform: uppercase; font-size: 12.5px; letter-spacing: .02em; }
table.saisie tr.ligne-total td.donnee { font-weight: 700; }
table.saisie td.donnee.code { font-weight: 600; color: var(--texte-doux); }
table.saisie td.donnee.ligne-cerfa { font-weight: 700; color: var(--pourpre); text-align: center; }
table.saisie.formulaire .champ { width: 96px; }
table.saisie tr.ligne-cadre td { background: var(--pourpre); color: #fff; font-weight: 700; text-align: left; font-size: 13.5px; }
table.saisie.formulaire td.donnee.texte { white-space: normal; min-width: 220px; }

/* ----- Documents support (balance) : déclinaisons de vert ----- */
.carte-donnees { border-color: #CFE5CA; }
.carte-donnees table.saisie td { border-color: #DCEBD8; }
.carte-donnees table.saisie tbody tr:nth-child(even):not(.ligne-total):not(.ligne-groupe) td { background: var(--menthe-clair); }
.carte-donnees table.saisie td.donnee.code { color: var(--vert); font-weight: 700; }
.carte-donnees table.saisie tr.ligne-total td { border-top: 2px solid var(--vert); background: var(--menthe); color: var(--vert-fonce); }
.carte-donnees table.saisie tr.ligne-groupe td { background: var(--menthe); color: var(--vert-fonce); }
.carte-donnees table.saisie th { border-color: #CFE5CA; }
.info-carte { border-color: #CFE5CA; }
.info-carte .info strong { color: var(--vert-fonce); }

/* ----- Écriture comptable ----- */
table.saisie.ecriture .choix { width: 330px; text-align: left; }
table.saisie.ecriture .champ-mt { width: 100px; }
table.saisie.ecriture td.donnee.date { color: var(--texte-doux); font-weight: 600; }
@media print { table.saisie.ecriture .choix { text-align: left; } }

/* ----- « Pour aller plus loin » : déclinaisons de bleu ----- */
:root { --bleu: #1F5FA8; --bleu-fonce: #17457A; --bleu-clair: #E3EDF9; --bleu-pale: #F3F7FC; }
.carte-bleue { border-color: #C7D9EF; }
.carte-titre.bleu { background: var(--bleu); color: #fff; }
.carte-bleue table.saisie th { background: var(--bleu-clair); color: var(--bleu-fonce); border-color: #C7D9EF; }
.carte-bleue table.saisie td { border-color: #D6E3F3; }
.carte-bleue table.saisie td.donnee.date { color: var(--bleu-fonce); }
.carte-bleue .champ { background: var(--bleu-pale); border-color: #BFD3EC; }
.carte-bleue .champ:focus { border-color: var(--bleu); box-shadow: 0 0 0 3px var(--bleu-clair); background: #fff; }
.section-ecriture .btn-verif-cas { background: var(--bleu); color: #fff; }
.section-ecriture .btn-verif-cas:hover:not(:disabled) { background: var(--bleu-fonce); color: #fff; }

/* ===== Contrôle des documents commerciaux ===== */
/* En-tête des documents reconstitués (émetteur, références, destinataire) */
.doc-entete { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 10px 22px; justify-content: space-between;
	padding: 12px 14px 10px; font-size: 12.5px; line-height: 1.45; color: var(--texte); }
.doc-bloc { min-width: 0; }
.doc-cadre { border: 1px solid #CFE5CA; border-radius: 6px; padding: 6px 10px; background: var(--menthe-clair); align-self: start; }
.carte:not(.carte-donnees) .doc-cadre { border-color: var(--gris-ligne); background: var(--gris); }
.doc-logo { display: block; max-height: 44px; max-width: 90px; margin-bottom: 4px; }
/* Repères L1, L2… */
span.repere, table.saisie td.donnee.repere { font-weight: 700; color: var(--pourpre); }
span.repere { display: inline-block; padding: 0 6px; margin-left: 4px; border-radius: 4px; background: var(--jaune); color: var(--brun); font-size: 11.5px; }
table.saisie td.donnee.repere { text-align: center; }
/* Documents en image */
.images-docs { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.doc-image { margin: 0; flex: 0 1 460px; min-width: 260px; }
.doc-image img { display: block; width: 100%; height: auto; border: 1px solid var(--gris-ligne); border-radius: 6px; cursor: zoom-in; background: #fff; }
.doc-image figcaption { margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--vert-fonce); text-align: center; }
/* Listes de choix */
table.saisie.analyse td:nth-child(2) .choix { width: 260px; }
table.saisie.analyse td:nth-child(3) .choix { width: 380px; }
table.saisie.analyse td.donnee.texte { white-space: nowrap; }
table.saisie.facture .choix { width: 250px; }
table.saisie.facture td.donnee.texte { white-space: normal; min-width: 200px; }
@media print {
	.doc-image { flex: 0 1 48%; } .doc-image img { cursor: default; }
	.images-docs { gap: 6mm; } .note { font-size: 8pt; }
	table.saisie .choix { width: auto !important; }
}
/* Ajustements de mise en page */
.doc-logo { float: left; margin: 0 10px 4px 0; }
.doc-bloc::after { content: ''; display: block; clear: both; }
.carte-donnees:has(.doc-entete) table.saisie td, .carte-donnees:has(.doc-entete) table.saisie th { font-size: 12.5px; padding: 3px 5px; }
.images-colonne { flex-direction: column; }
.images-colonne .doc-image { flex: none; width: 420px; min-width: 0; }
table.saisie.facture .choix { width: 275px; }
#contenu > .section > .carte:has(.doc-entete) { width: min-content; }
.doc-entete { grid-template-columns: auto auto auto; }
.doc-bloc { white-space: normal; }
table.saisie.facture td.donnee.texte { min-width: 160px; }
table.saisie.analyse td:nth-child(3) .choix { width: 420px; }
@media print { .images-colonne { flex-direction: row; } .images-colonne .doc-image, .doc-image { width: 31%; flex: 0 0 31%; } #contenu > .section > .carte:has(.doc-entete) { width: auto; } }

/* ===== Organisation de la page : documents à gauche (fixes), travail à droite ===== */
#contenu.avec-panneau { display: grid; grid-template-columns: var(--larg-panneau, 460px) minmax(0, 1fr); gap: 0 20px; align-items: start; }
.panneau-docs { position: sticky; top: 80px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; margin: 0 0 18px; width: auto; }
.panneau-docs > .carte-titre { flex: none; }
.onglets { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; border-bottom: 1px solid #CFE5CA; background: var(--menthe-clair); flex: none; }
.onglet { border: 1px solid #CFE5CA; border-bottom: 0; background: #fff; color: var(--vert-fonce); font-weight: 600; font-size: 13px;
	padding: 6px 12px; border-radius: 8px 8px 0 0; cursor: pointer; margin-bottom: -1px; }
.onglet:hover { background: var(--menthe); }
.onglet.actif { background: var(--vert); border-color: var(--vert); color: #fff; }
.onglet-corps { overflow: auto; padding: 12px; flex: 1 1 auto; min-height: 0; }
.panneau-docs .onglet-corps > .carte { border: 0; box-shadow: none; margin: 0; width: auto; }
.panneau-docs .onglet-corps > .carte > .carte-titre { display: none; }
.panneau-docs .doc-image { width: 100%; flex: none; min-width: 0; margin: 0; }
.doc-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.doc-zoom img { display: block; width: 100%; height: auto; border: 1px solid var(--gris-ligne); border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.08); background: #fff; }
.doc-zoom:hover img, .doc-zoom:focus-visible img { outline: 3px solid var(--menthe); }
.colonne-taches { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.colonne-taches > .section { max-width: 100%; }
.colonne-taches > .section > .carte { width: max-content; max-width: 100%; }
.avec-panneau table.saisie.analyse td:nth-child(2) .choix { width: 225px; }
.avec-panneau table.saisie.analyse td:nth-child(3) .choix { width: 310px; }
.avec-panneau table.saisie.analyse td.donnee.texte { white-space: normal; min-width: 150px; max-width: 200px; }
@media (max-width: 1180px) {
	#contenu.avec-panneau { display: block; }
	.panneau-docs { position: static; max-height: none; }
}

/* ===== Présentation des documents (en-tête façon document commercial) ===== */
.doc-entete { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 18px; padding: 12px 14px; font-size: 12.5px; line-height: 1.45;
	border-bottom: 2px solid #CFE5CA; margin-bottom: 2px; }
.carte:not(.carte-donnees) .doc-entete { border-bottom-color: var(--pourpre-clair); }
.doc-emetteur { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.doc-emetteur strong { font-size: 13.5px; color: var(--texte); }
.doc-logo { float: none; margin: 0; max-height: 52px; max-width: 64px; object-fit: contain; flex: none; }
.doc-titre { text-align: right; white-space: nowrap; color: var(--texte-doux); }
.doc-nom { font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--vert-fonce); margin-bottom: 2px; }
.carte:not(.carte-donnees) .doc-nom { color: var(--pourpre); }
.doc-infos { color: var(--texte-doux); align-self: end; }
.doc-dest { justify-self: end; align-self: start; min-width: 170px; border: 1px solid #CFE5CA; border-radius: 6px; padding: 6px 10px; background: var(--menthe-clair); }
.carte:not(.carte-donnees) .doc-dest { border-color: var(--gris-ligne); background: var(--gris); }
.doc-bloc::after { display: none; }

/* ===== Visionneuse ===== */
#visionneuse { position: fixed; inset: 0; z-index: 200; background: rgba(25, 22, 20, .86); display: flex; flex-direction: column; }
#visionneuse[hidden] { display: none; }
.visionneuse-barre { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; color: #fff; font-weight: 600; }
#visionneuseFermer { background: #fff; color: var(--texte); border: 0; border-radius: 6px; padding: 6px 12px; font-weight: 600; cursor: pointer; }
.visionneuse-image { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 0 18px 18px; }
.visionneuse-image img { max-width: min(1250px, 100%); height: auto; background: #fff; border-radius: 6px; box-shadow: 0 6px 30px rgba(0,0,0,.4); }
body.sans-defilement { overflow: hidden; }

@media print {
	#contenu.avec-panneau { display: block; }
	.panneau-docs { position: static; max-height: none; display: block; }
	.onglets, #visionneuse { display: none !important; }
	.onglet-corps[hidden] { display: block !important; }
	.panneau-docs .onglet-corps { overflow: visible; padding: 2mm; }
	.panneau-docs .onglet-corps:has(.doc-image) { display: inline-block !important; width: 32%; vertical-align: top; }
	.doc-image figcaption { font-size: 7pt; }
	.colonne-taches > .section > .carte { width: auto; }
}
.panneau-docs .onglet-corps table.saisie { width: 100%; }
.panneau-docs .onglet-corps .note { padding: 6px 4px 0; }
/* Repères : même étiquette jaune partout (documents, tableau d'analyse) */
span.repere { display: inline-block; min-width: 30px; padding: 1px 7px; border-radius: 4px; background: var(--jaune); color: var(--brun);
	font-weight: 700; font-size: 12px; line-height: 1.5; text-align: center; box-shadow: inset 0 -1px 0 rgba(0,0,0,.12); }
td.donnee.repere span.repere { margin-left: 0; }
@media print { span.repere { background: #FFE08A !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
table.saisie td.donnee.repere { text-align: center !important; width: 1px; }
.avec-panneau table.saisie.analyse td:nth-child(2) .choix { width: 215px; }
.avec-panneau table.saisie.analyse td:nth-child(3) .choix { width: 295px; }
/* En-tête : émetteur | type de document, destinataire sous le titre, conditions sur toute la largeur */
.doc-entete { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "em ti" "em de" "in in"; }
.doc-emetteur { grid-area: em; }
.doc-titre { grid-area: ti; white-space: normal; max-width: 260px; }
.doc-nom { font-size: 15px; line-height: 1.25; }
.doc-dest { grid-area: de; }
.doc-infos { grid-area: in; align-self: start; padding-top: 6px; border-top: 1px dashed #CFE5CA; display: block; }
.carte:not(.carte-donnees) .doc-infos { border-top-color: var(--pourpre-clair); }
/* Tableaux des documents dans le panneau : plus compacts */
.panneau-docs table.saisie th, .panneau-docs table.saisie td { font-size: 12px !important; padding: 3px 4px !important; }
.panneau-docs table.saisie th { font-size: 10.5px !important; }
.avec-panneau table.saisie.analyse td:nth-child(2) .choix { width: 205px; }
.avec-panneau table.saisie.analyse td:nth-child(3) .choix { width: 285px; }
.avec-panneau table.saisie.analyse td.donnee.texte { max-width: 160px; }
.doc-emetteur > div { white-space: nowrap; } .doc-titre { max-width: 200px; }
.mentions-legales { display: inline-block; margin-top: 4px; font-style: normal; font-size: 11px; color: var(--texte-doux); letter-spacing: .01em; }

/* ===== Impression : A4 portrait, une seule page, économe en encre (réglage commun) ===== */
.impr-choix { display: none; }
@media print {
	@page { size: A4 portrait; margin: 10mm; }
	html, body { background: #fff !important; }
	body { font-size: 8.5pt; color: #000 !important; -webkit-print-color-adjust: economy; print-color-adjust: economy; }
	main { zoom: var(--zoom-impr, 1); max-width: none !important; margin: 0 !important; padding: 0 !important; }
	.topbar, .score, .voile, .actions, .verif-cas, footer, .bandeau-cloture, #carteConsignes, #grilleHaut, .panneau-docs, .info-carte, .onglets, #visionneuse, .section-mouvements, .section-memo, .note .mentions-legales { display: none !important; } .section:has(> .carte-donnees) { display: none !important; }
	#contenu, #contenu.avec-panneau, .colonne-taches { display: block !important; }
	.section, #contenu > .section, .colonne-taches > .section { margin: 0 0 3mm !important; max-width: 100% !important; }
	.carte { border: 0.5pt solid #888 !important; box-shadow: none !important; border-radius: 0 !important; margin: 0 !important; width: auto !important; background: #fff !important; }
	.carte-titre, .carte-titre.vert, .carte-titre.bleu, .carte-titre.jaune { background: none !important; color: #000 !important; border-bottom: 0.5pt solid #888 !important;
		padding: .8mm 2mm !important; font-size: 9.5pt !important; font-weight: 700; }
	.carte-titre svg, .chevron, .aide { display: none !important; }
	.carte-corps { padding: 1mm 2mm !important; background: none !important; }
	table.saisie { width: auto; font-size: 8pt !important; }
	table.saisie th { background: none !important; color: #000 !important; border: 0.5pt solid #888 !important; padding: .5mm 1mm !important; font-size: 7pt !important; }
	table.saisie td { background: none !important; color: #000 !important; border: 0.5pt solid #aaa !important; padding: .35mm 1mm !important; font-size: 8pt !important; line-height: 1.2; }
	table.saisie tr.ligne-groupe td, table.saisie tr.ligne-cadre td { background: none !important; color: #000 !important; font-weight: 700; font-size: 7.5pt !important; }
	table.saisie tr.ligne-cadre td { border-top: 0.8pt solid #000 !important; text-transform: uppercase; }
	table.saisie tr.ligne-total td { background: none !important; color: #000 !important; font-weight: 700; border-top: 0.8pt solid #000 !important; }
	table.saisie td.donnee.code, table.saisie td.donnee.ligne-cerfa, span.repere, table.saisie td.donnee.repere { color: #000 !important; background: none !important; box-shadow: none !important; }
	span.repere { border: 0.5pt solid #000; padding: 0 1mm; }
	.champ, td.ok .champ, td.ko .champ, .cellule.ok .champ, .cellule.ko .champ { width: auto; min-width: 0 !important; border: 0 !important; background: none !important; -webkit-appearance: none; appearance: none;
		padding: 0 !important; height: auto !important; font-size: 8pt !important; color: #000 !important; box-shadow: none !important; }
	input.champ { width: 100% !important; max-width: 30mm; }
	select.champ { display: none !important; }
	.impr-choix { display: inline !important; font-size: 8pt; color: #000; }
	td.etat, th.th-etat { width: 4mm !important; padding: 0 .5mm !important; }
	.etat-ico svg { width: 9px; height: 9px; }
	.ligne-ok .etat-ico .i-ok, .ligne-ko .etat-ico .i-ko, .i-ok, .i-ko { color: #000 !important; }
	.bascule { border: 0 !important; background: none !important; }
	.bascule button { display: none !important; }
	.bascule button.actif { display: inline !important; background: none !important; color: #000 !important; border: 0 !important; padding: 0 !important; font-weight: 700; }
	.doc-entete { border-bottom: 0.5pt solid #888 !important; padding: 1mm 2mm !important; font-size: 7.5pt !important; }
	.doc-dest, .doc-cadre { background: none !important; border: 0.5pt solid #888 !important; }
	.doc-nom { color: #000 !important; font-size: 10pt !important; }
	.doc-logo { max-height: 28px !important; filter: grayscale(1); opacity: .7; }
	.note { font-size: 7pt !important; color: #000 !important; margin: 1mm 2mm !important; }
	.frac-barre { background: #000 !important; }
	.calcul { border-color: #aaa !important; background: none !important; }
	.legende-case { color: #000 !important; }
	.corr { display: none !important; }
	.entete-impression { display: block !important; margin-bottom: 2.5mm !important; }
	.entete-impression h1 { font-size: 11pt !important; color: #000 !important; }
	.entete-impression table { width: 100%; font-size: 8.5pt !important; border-bottom: 0.5pt solid #000 !important; }
}
@media print {
	table.saisie { width: 100% !important; }
	table.saisie th, table.saisie td { width: auto !important; }
	table.saisie td.etat, table.saisie th.th-etat { width: 4mm !important; }
	.impr-choix { white-space: normal; }
}
@media print { td:has(> .impr-choix) { text-align: left !important; } }
/* Facture : n° d'anomalie affiché seul après le choix */
table.saisie.facture .choix-num { width: 86px; font-weight: 700; text-align: center; }
table.saisie.facture .choix-num:focus { font-weight: 400; text-align: left; }

/* ===== Facture à contrôler : présentation professionnelle ===== */
.carte:has(table.facture) .doc-entete { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "em ti" "em de" "ca ca";
	background: #fff; border-top: 4px solid var(--pourpre); border-bottom: 0; padding: 14px 16px 10px; }
.carte:has(table.facture) .doc-nom { font-size: 22px; letter-spacing: .14em; color: var(--pourpre-fonce); }
.carte:has(table.facture) .doc-dest { background: #fff; border: 1px solid var(--gris-ligne); border-left: 3px solid var(--pourpre); border-radius: 4px; min-width: 190px; }
.doc-etiq { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texte-doux); margin-bottom: 2px; }
.doc-cartouche { grid-area: ca; display: grid; grid-template-columns: repeat(4, auto); margin-top: 4px; border: 1px solid var(--gris-ligne); border-radius: 4px; overflow: hidden; }
.doc-cartouche > div { padding: 5px 10px; border-left: 1px solid var(--gris-ligne); }
.doc-cartouche > div:first-child { border-left: 0; }
.doc-cartouche span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--texte-doux); background: none; }
.doc-cartouche strong { display: block; font-size: 13px; color: var(--texte); white-space: nowrap; }
.carte:has(table.facture) .defile { padding: 0 16px; }
table.saisie.facture { border-collapse: collapse; }
table.saisie.facture thead th { background: #3B3633; color: #fff; border-color: #3B3633; font-size: 11px; letter-spacing: .04em; }
table.saisie.facture thead th:last-of-type:not(.th-etat), table.saisie.facture thead th.th-etat { background: var(--jaune); color: var(--brun); border-color: var(--jaune); }
table.saisie.facture td { border-left: 0; border-right: 0; }
table.saisie.facture tr.ligne-produit:nth-child(even) td:not(.saisie-ch):not(.etat) { background: #FAF8F6; }
table.saisie.facture tr.ligne-info td.donnee { background: var(--gris); font-size: 12px; color: var(--texte-doux); font-style: italic; }
table.saisie.facture td:has(> select.choix-num) { border-left: 2px dashed var(--jaune); background: var(--jaune-clair); text-align: center; }
table.saisie.facture tr.ligne-tot td.donnee.vide { border: 0; background: #fff; }
table.saisie.facture tr.ligne-tot td.donnee.texte { text-align: left; font-weight: 600; background: #FAF8F6; border-left: 1px solid var(--gris-ligne); }
table.saisie.facture tr.ligne-tot td.donnee.num { font-weight: 600; background: #FAF8F6; }
table.saisie.facture tr.ligne-sous td.donnee:not(.vide) { border-top: 2px solid #3B3633; }
table.saisie.facture tr.ligne-net td.donnee:not(.vide) { background: var(--pourpre); color: #fff; font-weight: 800; font-size: 13.5px; border-top: 0; }
/* N° d'anomalie choisi : même vignette que les repères */
table.saisie.facture select.choix-num:not(:has(option[value=""]:checked)):not(:focus) { background-color: var(--jaune); color: var(--brun); border-color: #E0A800; border-radius: 4px; }
td.ok select.choix-num:not(:focus), td.ko select.choix-num:not(:focus) { color: var(--brun); }
td.ok select.choix-num:not(:focus) { box-shadow: 0 0 0 2px var(--ok); }
td.ko select.choix-num:not(:focus) { box-shadow: 0 0 0 2px var(--ko); }
/* Pied de facture */
.carte:has(table.facture) > .note { font-style: normal; padding: 10px 16px 12px; }
.fact-pied { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.fact-tva table { border-collapse: collapse; font-size: 11.5px; font-style: normal; color: var(--texte); }
.fact-tva th { background: var(--gris); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); padding: 3px 8px; border: 1px solid var(--gris-ligne); }
.fact-tva td { padding: 2px 8px; border: 1px solid var(--gris-ligne); text-align: right; }
.fact-tva td:first-child { text-align: left; }
.fact-tva tr:last-child:not(:first-child) td { font-weight: 700; }
.fact-cond { flex: 1; font-size: 11px; line-height: 1.4; color: var(--texte-doux); font-style: italic; }
.carte:has(table.facture) .mentions-legales { display: block; padding-top: 6px; border-top: 1px solid var(--gris-ligne); text-align: center; font-size: 10.5px; }
/* Récapitulatif : n° en vignette */
table.analyse td.donnee.texte span.repere { margin: 0 4px 0 0; min-width: 0; }
@media print {
	.carte:has(table.facture) .doc-entete { border-top: 1pt solid #000 !important; }
	.doc-cartouche { border: 0.5pt solid #888 !important; } .doc-cartouche > div { border-left: 0.5pt solid #888 !important; padding: .5mm 2mm !important; }
	.doc-cartouche span { font-size: 6pt !important; } .doc-cartouche strong { font-size: 7.5pt !important; }
	.carte:has(table.facture) .defile { padding: 0 !important; }
	table.saisie.facture thead th, table.saisie.facture tr.ligne-net td.donnee, table.saisie.facture tr.ligne-tot td.donnee, table.saisie.facture tr.ligne-info td.donnee, table.saisie.facture tr.ligne-produit td { background: none !important; color: #000 !important; } table.saisie.facture td:has(> select.choix-num) { background: none !important; color: #000 !important; }
	table.saisie.facture tr.ligne-tot td.donnee.vide { border: 0 !important; }
	table.saisie.facture td:has(> .impr-choix) { text-align: center !important; }
	table.saisie.facture .impr-choix { border: 0.5pt solid #000; border-radius: 1mm; padding: 0 1mm; font-weight: 700; }
	.fact-pied { gap: 3mm; margin-bottom: 1mm; } .fact-tva table { font-size: 6.5pt; } .fact-tva th, .fact-tva td { padding: 0 1.5mm !important; border: 0.5pt solid #888 !important; background: none !important; }
	.fact-cond { font-size: 6.5pt; color: #000; }
	.carte:has(table.facture) .mentions-legales { display: block !important; font-size: 6pt; border-top: 0.5pt solid #888; }
}
table.saisie.facture tr.ligne-produit td.donnee.texte { white-space: nowrap; min-width: 0; }
table.saisie.facture .choix-num { width: 104px; }
table.saisie.analyse td.donnee.texte:has(span.repere) { min-width: 290px; }
@media print { table.saisie.facture .impr-choix:empty { border: 0; } }
/* Facture et récapitulatif alignés sur le cadre « Mon entreprise » (pleine largeur de la colonne) */
.colonne-taches { align-items: stretch; }
.colonne-taches > .section:has(table.facture, table.analyse) > .carte { width: 100%; }
.colonne-taches table.saisie.facture, .colonne-taches table.saisie.analyse { width: 100%; }
table.saisie.facture tr.ligne-produit td.donnee.texte { width: auto; }
table.saisie.facture th:nth-child(2) { width: auto; }
table.saisie.analyse select.choix { width: 100%; }
/* Équilibre documents / facture : facture compacte, sans défilement horizontal */
table.saisie.facture tr.ligne-produit td.donnee.texte { white-space: normal; min-width: 150px; }
.carte:has(table.facture) .defile { padding: 0 10px; }
table.saisie.facture td, table.saisie.facture th { padding-left: 5px; padding-right: 5px; }
table.saisie.facture .choix-num { width: 92px; }
.doc-cartouche { grid-template-columns: repeat(4, minmax(0, auto)); }
.doc-cartouche > div { padding: 4px 8px; }
table.saisie.analyse td.donnee.texte:has(span.repere) { min-width: 200px; }
/* Récapitulatif (niveaux 4-5) : colonnes réparties sur la largeur disponible */
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) { table-layout: fixed; }
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) th:nth-child(1) { width: 30%; }
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) th:nth-child(2) { width: 28%; }
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) th.th-etat { width: 34px; }
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) td.donnee.texte { min-width: 0; white-space: normal; }
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) select.choix { width: 100%; min-width: 0; }
@media print { .colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) { table-layout: auto; } }
.colonne-taches table.saisie.analyse:has(td.donnee.repere) { table-layout: fixed; }
.colonne-taches table.saisie.analyse:has(td.donnee.repere) th:nth-child(1) { width: 62px; }
.colonne-taches table.saisie.analyse:has(td.donnee.repere) th:nth-child(2) { width: 42%; }
.colonne-taches table.saisie.analyse:has(td.donnee.repere) th.th-etat { width: 34px; }
.colonne-taches table.saisie.analyse:has(td.donnee.repere) select.choix { width: 100%; min-width: 0; }
@media print { .colonne-taches table.saisie.analyse:has(td.donnee.repere) { table-layout: auto; } }
table.saisie.facture td, table.saisie.facture th { padding-left: 4px; padding-right: 4px; }
table.saisie.facture .choix-num { width: 84px; }
.colonne-taches table.saisie.analyse:has(td.donnee.texte span.repere) th:nth-child(3),
.colonne-taches table.saisie.analyse:has(td.donnee.repere) th:nth-child(3) { width: auto; }
.colonne-taches table.saisie.analyse th.th-etat { width: 34px !important; }

/* « L'entreprise » : en-tête de document */
.ent-corps { padding: 12px 16px 14px !important; }
.ent-entete { display: flex; gap: 12px; align-items: center; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 2px solid var(--ent, #187C09); }
.ent-entete:has(.ent-logo) { border-bottom-color: #CFE5CA; }
.ent-logo { flex: none; width: 48px; height: 48px; border-radius: 10px; background: var(--ent); color: #fff; display: grid; place-items: center;
	font: 800 18px/1 Georgia, 'Times New Roman', serif; letter-spacing: .04em; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }
.ent-nom { font-size: 15.5px; font-weight: 800; letter-spacing: .03em; color: var(--texte); }
.ent-forme { font-size: 12px; color: var(--texte-doux); }
.ent-adr { font-size: 12px; color: var(--texte-doux); }
.ent-grille { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.ent-champ { display: contents; }
.ent-grille dt { font-weight: 700; color: var(--vert-fonce); }
.ent-grille dd { margin: 0; color: var(--texte); }
.panneau-docs table.saisie td, .panneau-docs table.saisie th { font-size: 11.5px !important; padding: 3px 3px !important; }
.panneau-docs table.saisie td.donnee.texte { min-width: 0 !important; }
.panneau-docs table.saisie td.donnee.num { width: 1px; }
table.saisie.etat-fin th:nth-child(2) { width: 76px; }
.panneau-docs table.saisie th:first-child { width: 48px; }
.panneau-docs table.saisie td.donnee.num { width: 58px; }

/* ===== Lettrage ===== */
.champ-lt { width: 46px; text-align: center; text-transform: uppercase; font-weight: 700; letter-spacing: .06em; }
table.saisie.grand-livre td.donnee.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.saisie.grand-livre td.donnee.texte { white-space: nowrap; }
table.saisie.grand-livre th:nth-child(1), table.saisie.grand-livre td.donnee.date { white-space: nowrap; }
table.saisie.grand-livre td:has(> .champ-lt) { background: var(--jaune-clair); text-align: center; }
table.saisie.justif td.donnee.num:first-child { font-weight: 700; color: var(--pourpre-fonce); text-align: center; }
table.saisie.justif select.choix { width: 100%; min-width: 150px; }
table.saisie.justif td:nth-child(2) select.choix { min-width: 190px; }
table.saisie.justif .champ-mt { width: 92px; }
table.saisie.justif .champ-date { width: 96px; }
table.saisie.journal td.donnee.code { font-weight: 700; color: var(--vert-fonce); }
table.saisie.journal tr.ligne-tiers td { font-weight: 700; }
.memo { font-size: 13.5px; line-height: 1.5; }
.memo-etapes { margin: 0 0 10px; padding-left: 20px; }
.memo-etapes li { margin-bottom: 4px; }
.memo-def { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 0; padding-top: 8px; border-top: 1px solid var(--gris-ligne); }
.memo-def dt { font-weight: 700; color: var(--vert-fonce); }
.memo-def dd { margin: 0; }
/* Justification : un bloc par élément */
.justifs { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.justif-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 10px; align-items: center; padding: 10px 10px 10px 0;
	border: 1px solid var(--gris-ligne); border-left: 4px solid var(--orange, #E8590C); border-radius: 8px; background: #fff; }
.justif-num { font-size: 18px; font-weight: 800; color: var(--pourpre-fonce); text-align: center; }
.justif-grille { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 10px; }
.justif-champ { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.legende-champ { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--texte-doux); white-space: nowrap; }
.justif-champ .champ { width: 100%; min-width: 0; }
.c-lib { grid-column: span 6; } .c-mt { grid-column: span 3; } .c-date { grid-column: span 3; }
.avec-ecart .c-lib { grid-column: span 5; } .avec-ecart .c-mt, .avec-ecart .c-date { grid-column: span 2; } .avec-ecart .c-ecart { grid-column: span 3; }
.c-type, .c-action, .c-compte { grid-column: span 4; }
.c-type { border-top: 1px dashed var(--gris-ligne); padding-top: 6px; } .c-action, .c-compte { border-top: 1px dashed var(--gris-ligne); padding-top: 6px; }
.justif-item > .etat { justify-self: center; }
.justif-champ { text-align: left; align-items: stretch; }
.legende-champ { white-space: normal; line-height: 1.2; min-height: 14px; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.justif-champ .corr { text-align: left; }
.avec-ecart .c-lib { grid-column: span 4; } .avec-ecart .c-mt { grid-column: span 3; } .avec-ecart .c-date { grid-column: span 3; } .avec-ecart .c-ecart { grid-column: span 2; }
.justif-grille { align-items: end; }
.justif-champ .corr { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }

/* ===== Grand livre façon PGI ===== */
.zone-large { grid-column: 1 / -1; margin-top: 4px; }
.colonne-taches > .section-grandlivre { width: 100%; }
.carte-gl { width: 100%; }
.gl-barre { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid #D5DCE3; background: #F4F6F8; }
.gl-barre > div { padding: 7px 14px; border-right: 1px solid #D5DCE3; }
.gl-barre span { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #6B7785; }
.gl-barre strong { font-size: 13px; color: #1F2933; white-space: nowrap; }
.gl-barre .gl-lettre { display: inline-block; min-width: 26px; padding: 0 6px; border-radius: 4px; background: var(--jaune); color: var(--brun); text-align: center; }
.carte-gl .defile { padding: 0; }
table.saisie.grand-livre { width: 100%; border-collapse: collapse; font-size: 13px; }
table.saisie.grand-livre thead th { background: #E9EEF3; color: #334155; border: 0; border-bottom: 2px solid #B8C4D0; font-size: 11px; letter-spacing: .05em; padding: 7px 8px; text-align: left; }
table.saisie.grand-livre thead th.gl-debit, table.saisie.grand-livre thead th.gl-credit, table.saisie.grand-livre thead th.gl-solde { text-align: right; }
table.saisie.grand-livre thead th.gl-lettrage { text-align: center; }
table.saisie.grand-livre thead th.th-etat { background: #E9EEF3; }
table.saisie.grand-livre td { border: 0; border-bottom: 1px solid #EDF0F3; padding: 3px 8px; height: 32px; }
table.saisie.grand-livre tbody tr:nth-child(even) td:not(.saisie-lt):not(.etat) { background: #FAFBFC; }
table.saisie.grand-livre tbody tr:hover td:not(.etat) { background: #FFF7E6; }
table.saisie.grand-livre td.donnee.date { width: 92px; white-space: nowrap; color: #475569; text-align: left; }
table.saisie.grand-livre td.jnl { width: 40px; font-weight: 700; color: #64748B; font-size: 11.5px; }
table.saisie.grand-livre td.gl-lib { width: auto; white-space: nowrap; color: #1F2933; }
table.saisie.grand-livre td.donnee.num { width: 100px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
table.saisie.grand-livre td.gl-solde { color: #475569; }
table.saisie.grand-livre td.saisie-lt { width: 64px; text-align: center; background: #FFFBEA; }
table.saisie.grand-livre .champ-lt { width: 44px; height: 26px; border: 1px solid #C9B458; border-radius: 4px; background: #fff; }
table.saisie.grand-livre tr.ligne-an td { font-style: italic; }
table.saisie.grand-livre tfoot td { padding: 6px 8px; border: 0; font-weight: 700; }
table.saisie.grand-livre tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.saisie.grand-livre tr.gl-total td { border-top: 2px solid #B8C4D0; background: #F4F6F8; }
table.saisie.grand-livre tr.gl-final td { background: #1F3A5A; color: #fff; }
table.saisie.grand-livre tr.gl-final td:first-child { text-align: right; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
table.saisie.grand-livre tr.gl-total td:first-child { text-align: right; }

/* Justification : tableau sur toute la largeur */
.zone-large table.saisie.justif { width: 100%; }
table.saisie.justif td.donnee.num:first-child { width: 34px; }
table.saisie.justif td:nth-child(2) select.choix { width: 100%; min-width: 175px; }
table.saisie.justif td:nth-child(n+5) select.choix { width: 100%; min-width: 170px; }
table.saisie.justif .champ-mt { width: 96px; }
table.saisie.justif .champ-date { width: 100px; }
/* Journal (panneau) */
table.saisie.journal td.donnee.texte { white-space: nowrap; min-width: 190px; }
table.saisie.journal tr.ligne-groupe td { font-weight: 700; }
@media print {
	table.saisie.grand-livre thead th, table.saisie.grand-livre tr.gl-total td, table.saisie.grand-livre tr.gl-final td, .gl-barre, table.saisie.grand-livre td { background: none !important; color: #000 !important; }
	.gl-barre > div { padding: 1mm 2mm !important; } .gl-barre span { font-size: 6pt !important; } .gl-barre strong { font-size: 7.5pt !important; }
	table.saisie.grand-livre td { height: auto !important; padding: .3mm 1.5mm !important; }
	table.saisie.grand-livre tr.gl-final td { border-top: 1pt solid #000 !important; }
}
.gl-barre { flex-wrap: nowrap; }
.gl-barre > div { padding: 7px 11px; flex: 0 1 auto; min-width: 0; }
.gl-barre > div:last-child { border-right: 0; margin-left: auto; }
table.saisie.grand-livre thead th { white-space: nowrap; }
.gl-barre span { white-space: nowrap; }

/* Zone haute (panneau collant + tâches) puis zone large : le panneau ne recouvre plus la justification */
#contenu.avec-large { display: block; }
.zone-haute { display: grid; grid-template-columns: var(--larg-panneau, 460px) minmax(0, 1fr); gap: 0 20px; align-items: start; }
.zone-large { margin-top: 18px; }
@media (max-width: 1000px) { .zone-haute { display: block; } }
@media print { .zone-haute { display: block !important; } }
/* Grand livre : en-tête bleu */
.carte-gl { border-color: #C7D9EF; }
/* Justification : orange et jaune, en version sobre */
.carte-justif { border-color: #F1D9C4; }
table.saisie.justif thead th { background: #FFF8E6; color: var(--brun, #6D3109); border: 0; border-bottom: 1px solid #F3E2B8; font-size: 11px; letter-spacing: .04em; }
table.saisie.justif thead tr:first-child th { background: #FDEFC8; color: var(--brun, #6D3109); font-size: 11.5px; border-bottom: 2px solid #F0CF7A; }
table.saisie.justif thead tr:first-child th + th { border-left: 1px solid #F3E2B8; }
table.saisie.justif thead th.th-etat { background: #FDEFC8; }
table.saisie.justif td { border-left: 0; border-right: 0; border-bottom: 1px solid #F5EEE6; }
table.saisie.justif td.donnee.num:first-child { color: var(--pourpre-fonce); background: #FFFBF2; }
table.saisie.justif .champ { background: #fff; border: 1px solid #E6D3B8; border-radius: 4px; box-shadow: none; }
table.saisie.justif select.champ:has(option[value=""]:checked) { color: #9A8C7D; }
table.saisie.justif .champ:focus { border-color: var(--pourpre); outline: 2px solid var(--pourpre-clair); outline-offset: 0; }
table.saisie.justif td.ok .champ { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
table.saisie.justif td.ko .champ { border-color: var(--ko); box-shadow: inset 3px 0 0 var(--ko); }
table.saisie.grand-livre td.gl-saisie { width: 100px; padding: 2px 4px; }
table.saisie.grand-livre td.gl-saisie .champ { width: 92px; height: 26px; text-align: right; }
table.saisie.grand-livre tr.ligne-rectif td { background: #F3F7FC; }
table.saisie.grand-livre tr.ligne-rectif td.jnl, table.saisie.grand-livre tr.ligne-rectif td.gl-lib { color: #1F5FA8; font-weight: 700; }
table.saisie.grand-livre td.gl-lt { text-align: center; font-weight: 700; color: var(--brun); }
table.saisie.grand-livre td.gl-analyse { width: 172px; padding: 2px 4px; }
table.saisie.grand-livre td.gl-analyse select.choix { width: 166px; min-width: 0; height: 28px; font-size: 12.5px; }
.carte-gl:has(.gl-analyse) table.saisie.grand-livre td.donnee.num { width: 84px; }
.carte-gl:has(.gl-analyse) table.saisie.grand-livre td { padding-left: 5px; padding-right: 5px; }
.carte-gl:has(.gl-analyse) table.saisie.grand-livre td.donnee.date { width: 84px; }
.gl-note { padding: 8px 14px 10px; font-size: 13px; color: #334155; background: #F4F6F8; border-top: 1px solid #D5DCE3; }
.gl-note ul { margin: 4px 0 0; padding-left: 18px; }
#contenu > .section-grandlivre { width: 100%; }
#contenu > .section-grandlivre .carte-gl { width: 100%; }
@media print {
	table.saisie.grand-livre th.gl-lettrage, table.saisie.grand-livre td.saisie-lt, table.saisie.grand-livre td.gl-lt { width: 13mm !important; }
	table.saisie.grand-livre td.gl-lib { width: auto !important; }
	table.saisie.grand-livre td.gl-analyse { width: 30mm !important; }
}

/* Page centrée sans panneau : tous les tableaux à la même largeur */
#contenu.centre { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 22px; }
#contenu.centre > .section { width: 100%; max-width: var(--larg-centre, 900px); }
#contenu.centre > .section .carte, #contenu.centre > .section .carte-gl { width: 100%; }
#contenu.centre > .section-titre { max-width: var(--larg-centre, 900px); }
#contenu.centre > .section-ecriture { width: auto; max-width: 439px; flex: 0 1 439px; }
#contenu.centre > .section-ecriture .carte { width: 100%; }
#contenu.centre > .section-ecriture table.saisie.ecriture { width: 100%; }
#contenu.centre > .section-ecriture select.choix { width: 190px; }
#contenu.centre > .section-ecriture .champ-mt { width: 76px; }
/* Titre intermédiaire */
.titre-section { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 12px; padding: 9px 14px; border-left: 5px solid #7B4FA8; background: #F4EEFA; border-radius: 6px; color: #4A2D6E; }
.titre-section span { font-size: 17px; font-weight: 800; }
.titre-section small { font-size: 13px; color: #6B5A80; }
/* Écritures « Pour aller plus loin » : violet */
.carte-violet { border-color: #D9C9EC; }
.carte-titre.violet { background: #7B4FA8; color: #fff; }
.carte-violet table.saisie th { background: #F1EAF8; color: #4A2D6E; border-color: #D9C9EC; }
.carte-violet table.saisie td { border-color: #E6DCF2; }
.carte-violet table.saisie td.donnee.date { color: #4A2D6E; }
.carte-violet .champ { background: #FBF8FE; border-color: #D9C9EC; }
.carte-violet .champ:focus { border-color: #7B4FA8; box-shadow: 0 0 0 3px #EADDF6; background: #fff; }
.carte-violet + .verif-cas .btn-verif-cas, .section-ecriture .btn-verif-cas { background: #7B4FA8; }
@media print { .titre-section { background: none !important; border-left: 2pt solid #000 !important; color: #000 !important; padding: 1mm 2mm !important; margin: 2mm 0 !important; } .carte-titre.violet { background: none !important; color: #000 !important; } }
#contenu.centre > .section-ecriture { max-width: 560px; flex: 0 1 560px; }
#contenu.centre > .section-ecriture { flex: 0 0 auto; max-width: none; width: auto; }
#contenu.centre > .section-ecriture .carte { width: auto; }
#contenu.centre > .section-ecriture table.saisie.ecriture { width: auto; }
#contenu.centre > .section-ecriture { flex: 0 0 calc((var(--larg-centre, 900px) - 22px) / 2); width: calc((var(--larg-centre, 900px) - 22px) / 2); }
#contenu.centre > .section-ecriture .carte, #contenu.centre > .section-ecriture table.saisie.ecriture { width: 100%; }
#contenu.centre > .section-ecriture select.choix { width: 100%; min-width: 0; }
#contenu.centre > .section-ecriture td.saisie-mt { width: 92px; }
#contenu.centre > .section-ecriture .champ-mt { width: 84px; }
#contenu.centre > .section-ecriture table.saisie.ecriture { table-layout: fixed; }
#contenu.centre > .section-ecriture table.saisie.ecriture th:nth-child(1) { width: auto; }
#contenu.centre > .section-ecriture table.saisie.ecriture th:nth-child(2), #contenu.centre > .section-ecriture table.saisie.ecriture th:nth-child(3) { width: 96px; }
#contenu.centre > .section-ecriture table.saisie.ecriture th.th-etat { width: 30px; }

/* Onglets : un onglet par compte à lettrer */
.onglets-taches { width: 100%; max-width: var(--larg-centre, 900px); }
#contenu.centre > .onglets-taches { flex: 0 0 100%; max-width: var(--larg-centre, 900px); }
.colonne-taches > .onglets-taches { max-width: none; }
.onglets-comptes { display: flex; gap: 4px; padding: 0 4px; border-bottom: 3px solid #1F5FA8; margin-bottom: 14px; }
.onglets-comptes .onglet { padding: 9px 18px; border: 1px solid #C7D9EF; border-bottom: 0; border-radius: 8px 8px 0 0; background: #EEF4FB; color: #1F5FA8; font-weight: 700; font-size: 14px; cursor: pointer; }
.onglets-comptes .onglet.actif { background: #1F5FA8; color: #fff; border-color: #1F5FA8; }
.onglets-comptes .onglet:hover:not(.actif) { background: #DCE8F6; }
.ong-corps > .section { width: 100%; }
.ong-corps > .section .carte, .ong-corps > .section .carte-gl { width: 100%; }
@media print { .onglets-comptes { display: none !important; } .ong-corps[hidden] { display: block !important; } }
#contenu.centre table.saisie.justif, .ong-corps table.saisie.justif { width: 100%; }
.onglets-comptes { background: none !important; flex-wrap: nowrap; } .onglets-comptes .onglet { padding: 9px 14px; }
.ent-ape { margin-left: 18px; white-space: nowrap; } .ent-ape strong { color: var(--vert-fonce); margin-right: 6px; }

#contenu.centre .ong-corps > .section { margin-bottom: 14px; }
#contenu.centre .ong-corps .carte-donnees { width: 100%; }
@media print { .ong-corps .section-memo { display: none !important; } .ong-corps .section-tableau:has(table.journal) { display: none !important; } }

/* Tous les comptes à lettrer ont la même largeur (celle du niveau 2-1), centrés dans la page */
#contenu.centre .section-grandlivre { width: 100%; max-width: 900px; margin-left: auto; margin-right: auto; }
/* Grand livre compact pour tenir dans 900 px (colonnes de saisie, analyse) */
table.saisie.grand-livre td.saisie-lt { width: 58px; padding: 2px 4px; }
table.saisie.grand-livre td.saisie-lt .champ { width: 50px; }
table.saisie.grand-livre td.gl-saisie { width: 84px; padding: 2px 3px; }
table.saisie.grand-livre td.gl-saisie .champ { width: 78px; }
table.saisie.grand-livre td.gl-analyse { width: 150px; }
table.saisie.grand-livre td.gl-analyse select.choix { width: 144px; }
.carte-gl:has(.gl-analyse) table.saisie.grand-livre td.gl-lib { white-space: normal; min-width: 140px; }
table.saisie.grand-livre td.gl-lib-choix select.champ.choix { width: 230px; min-width: 230px; }
.gl-barre > div:nth-child(4) strong { white-space: normal; }
/* Barre du grand livre : la colonne « Conditions de règlement » occupe l'espace libre, le trait reste collé à « Prochaine lettre » */
.gl-barre > div:nth-child(4) { flex: 1 1 auto; }
.gl-barre > div:last-child { margin-left: 0; flex: 0 0 auto; }

/* ===== Contrôle des écritures comptables d'achat ===== */
.section-ecriture .carte-bleue + .verif-cas .btn-verif-cas { background: var(--bleu); }
#contenu.centre > .section-ecriture select.choix { width: 305px; }
table.saisie.ecriture tfoot td { font-weight: 700; background: var(--gris-clair, #F3F4F6); text-align: right; padding: 6px 8px; border-top: 2px solid #CBD5E1; }
table.saisie.ecriture tfoot td:first-child { text-align: left; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
table.saisie.controle td.donnee { white-space: nowrap; }
table.saisie.controle tr.debut-ecriture td { border-top: 2px solid #CBD5E1; }
table.saisie.controle tr.ligne-vide td.donnee { color: #94A3B8; font-style: italic; }
table.saisie.controle select.choix { width: 330px; }
table.saisie.controle tr.ligne-total td { font-weight: 700; background: #F3F4F6; }
table.saisie.plan td.donnee.code { font-weight: 700; width: 70px; }
table.saisie.plan td.donnee { text-align: left; }
.fact-tva.sans-total tr:last-child:not(:first-child) td { font-weight: 400; }
/* Documents (factures, plan de comptes) : carte centrée sous les onglets, tableau sur toute la largeur de la carte */
.ong-corps > .section > .carte-donnees, .ong-corps .carte-donnees { max-width: 800px; margin-left: auto; margin-right: auto; }
.ong-corps .carte-donnees table.saisie.facture, .ong-corps .carte-donnees table.saisie.plan { width: 100%; }
table.saisie.facture tr.ligne-produit td.donnee.texte { width: 45%; }

/* ===== Factures reçues : présentation de document professionnel ===== */
table.saisie.fact-doc { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.saisie.fact-doc thead th { background: #3B3633; color: #fff; border: 1px solid #3B3633; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
	text-transform: uppercase; padding: 6px 8px; line-height: 1.2; text-align: right; white-space: normal; }
table.saisie.fact-doc thead th:first-child { text-align: left; }
table.saisie.fact-doc td { padding: 4px 8px; border: 0; border-bottom: 1px solid #ECE7E2; background: #fff; color: #2B2724; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.saisie.fact-doc td.donnee.num { text-align: right; }
table.saisie.fact-doc td.donnee.texte { text-align: left; min-width: 0; }
.carte-donnees table.saisie.fact-doc tbody tr:nth-child(even):not(.ligne-groupe) td { background: #fff; }
table.saisie.fact-doc tr.ligne-produit:nth-child(even) td { background: #FAF8F6; }
table.saisie.fact-doc tr.ligne-remise td { font-style: italic; color: #5C544E; }
.carte-donnees table.saisie.fact-doc tr.ligne-groupe td, table.saisie.fact-doc tr.ligne-groupe td { background: #F1ECE6; color: #3B3633; font-size: 10.5px; font-weight: 700;
	letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-bottom: 1px solid #DDD5CC; }
table.saisie.fact-doc tr.ligne-tot td.donnee.vide { background: #fff !important; border: 0; }
table.saisie.fact-doc tr.ligne-tot td.donnee:not(.vide) { background: #F7F4F1 !important; font-weight: 600; border-bottom: 1px solid #E6DFD8; }
table.saisie.fact-doc tr.ligne-tot td.donnee.texte { border-left: 1px solid #E6DFD8; }
table.saisie.fact-doc tr.ligne-sous td.donnee:not(.vide) { border-top: 1.5px solid #3B3633; }
table.saisie.fact-doc tr.ligne-net td.donnee:not(.vide) { background: #3B3633 !important; color: #fff; font-weight: 800; font-size: 13px; }
/* largeur des colonnes selon le modèle de facture */
table.saisie.fact-doc.f7 th:nth-child(1) { width: 37%; } table.saisie.fact-doc.f7 th:nth-child(2) { width: 9%; }
table.saisie.fact-doc.f7 th:nth-child(3) { width: 10%; } table.saisie.fact-doc.f7 th:nth-child(4) { width: 10%; }
table.saisie.fact-doc.f7 th:nth-child(5) { width: 11%; } table.saisie.fact-doc.f7 th:nth-child(6) { width: 8%; }
table.saisie.fact-doc.f7 th:nth-child(7) { width: 15%; }
table.saisie.fact-doc.f7 th:nth-child(2), table.saisie.fact-doc.f7 tr.ligne-produit td:nth-child(2) { text-align: center; }
table.saisie.fact-doc.f4 th:nth-child(1) { width: 50%; } table.saisie.fact-doc.f4 th:nth-child(2) { width: 10%; }
table.saisie.fact-doc.f4 th:nth-child(3) { width: 20%; } table.saisie.fact-doc.f4 th:nth-child(4) { width: 20%; }
table.saisie.fact-doc.f4 th:nth-child(2), table.saisie.fact-doc.f4 tr.ligne-produit td:nth-child(2) { text-align: center; }
table.saisie.fact-doc.f2 th:nth-child(1) { width: 72%; } table.saisie.fact-doc.f2 th:nth-child(2) { width: 28%; }
@media print {
	table.saisie.fact-doc { font-size: 7.5pt; }
	table.saisie.fact-doc thead th, table.saisie.fact-doc tr.ligne-net td.donnee:not(.vide) { background: none !important; color: #000 !important; border: 0.6pt solid #000 !important; }
	table.saisie.fact-doc td { background: none !important; padding: .4mm 1.2mm !important; }
	table.saisie.fact-doc tr.ligne-groupe td, table.saisie.fact-doc tr.ligne-tot td.donnee:not(.vide) { background: none !important; }
}

/* ===== Bordereau de saisie : l'écriture existante en couleur « document », l'analyse en couleur « travail » ===== */
table.saisie.controle thead th:nth-child(-n+6) { background: var(--menthe); color: var(--vert-fonce); border-color: #CFE5CA; }
table.saisie.controle tbody td:nth-child(-n+6) { background: var(--menthe-clair); border-color: #DCEBD8; }
table.saisie.controle tbody td.donnee.code { color: var(--vert); font-weight: 700; }
table.saisie.controle tr.ligne-total td:nth-child(-n+3) { background: var(--menthe) !important; color: var(--vert-fonce); border-top: 2px solid var(--vert); }
table.saisie.controle tr.ligne-total td.donnee.vide { background: #fff !important; }
/* En-tête des factures : émetteur à gauche ; « FACTURE » et destinataire à droite ; cartouche sur toute la largeur */
.carte-donnees:has(table.fact-doc) .doc-entete { display: grid; grid-template-columns: minmax(0, 1fr) 250px; grid-template-areas: "em ti" "em de" "ca ca";
	gap: 8px 24px; padding: 14px 16px 12px; border-bottom: 0; }
.carte-donnees:has(table.fact-doc) .doc-emetteur { grid-area: em; display: flex; gap: 12px; align-items: flex-start; }
.carte-donnees:has(table.fact-doc) .doc-emetteur > div { white-space: normal; line-height: 1.45; }
.carte-donnees:has(table.fact-doc) .doc-logo { max-height: 56px; max-width: 72px; }
.carte-donnees:has(table.fact-doc) .doc-titre { grid-area: ti; text-align: right; max-width: none; }
.carte-donnees:has(table.fact-doc) .doc-nom { font-size: 20px; letter-spacing: .12em; color: #3B3633; }
.carte-donnees:has(table.fact-doc) .doc-dest { grid-area: de; justify-self: stretch; min-width: 0; background: #FAF8F6; border: 1px solid #DDD5CC; border-left: 3px solid #3B3633; }
.carte-donnees:has(table.fact-doc) .doc-etiq { color: #6B625B; }
.carte-donnees:has(table.fact-doc) .doc-cartouche { grid-area: ca; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 6px; border: 1px solid #DDD5CC; border-radius: 4px; }
.carte-donnees:has(table.fact-doc) .doc-cartouche > div { padding: 4px 8px; border-left: 1px solid #DDD5CC; }
.carte-donnees:has(table.fact-doc) .doc-cartouche > div:first-child { border-left: 0; }
.carte-donnees:has(table.fact-doc) .defile { padding: 0 16px; }
.carte-donnees:has(table.fact-doc) > .note { padding: 8px 16px 12px; }
/* Cartouche : autant de cases que de références (2 à 4) */
.carte-donnees:has(table.fact-doc) .doc-cartouche { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
table.saisie.controle td.sans-justif { background: #fff; }

/* ===== Analyse comptable des factures : la facture en couleur « document », l'analyse en couleur « travail » ===== */
table.saisie.analyse-fact { width: 100%; }
table.saisie.analyse-fact thead th:nth-child(-n+2) { background: var(--menthe); color: var(--vert-fonce); border-color: #CFE5CA; }
table.saisie.analyse-fact tbody td:nth-child(-n+2) { background: var(--menthe-clair); border-color: #DCEBD8; }
table.saisie.analyse-fact td.donnee.texte { text-align: left; white-space: normal; min-width: 220px; }
table.saisie.analyse-fact td.donnee.num { width: 110px; font-variant-numeric: tabular-nums; }
table.saisie.analyse-fact tr.ligne-remise td.donnee { font-style: italic; color: #5C544E; }
table.saisie.analyse-fact tr.ligne-tot td.donnee { font-weight: 700; }
table.saisie.analyse-fact tr.ligne-ttc td.donnee { font-weight: 800; border-top: 2px solid var(--vert); }
table.saisie.analyse-fact tr.ligne-ech td { border-top: 2px dashed var(--jaune); }
table.saisie.analyse-fact tr.ligne-ech td.donnee { background: var(--jaune-clair) !important; color: var(--brun); font-weight: 700; }
table.saisie.analyse-fact select.champ.choix { width: 100%; min-width: 0; }
table.saisie.analyse-fact td.saisie-ch:nth-child(3) { width: 190px; }
table.saisie.analyse-fact td.saisie-ch:nth-child(4) { width: 300px; }
.carte:has(table.analyse-fact) .doc-entete { grid-template-columns: minmax(0, 1fr) 250px; grid-template-areas: "em ti" "em de" "ca ca"; }
.carte:has(table.analyse-fact) .doc-cartouche { grid-area: ca; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid #DDD5CC; border-radius: 4px; }
.carte:has(table.analyse-fact) .doc-cartouche > div { padding: 4px 8px; border-left: 1px solid #DDD5CC; } .carte:has(table.analyse-fact) .doc-cartouche > div:first-child { border-left: 0; }
.carte:has(table.analyse-fact) .doc-emetteur { grid-area: em; } .carte:has(table.analyse-fact) .doc-titre { grid-area: ti; } .carte:has(table.analyse-fact) .doc-dest { grid-area: de; }
table.saisie.analyse-fact td.saisie-ch:nth-child(3), table.saisie.analyse-fact thead th:nth-child(3) { width: 205px; }
table.saisie.analyse-fact td.saisie-ch:nth-child(4), table.saisie.analyse-fact thead th:nth-child(4) { width: 285px; }
table.saisie.analyse-fact td.donnee.texte { min-width: 0; }
.carte:has(table.analyse-fact) .doc-entete { grid-template-columns: minmax(0, 1fr) 240px; grid-template-areas: "em ti" "ca de"; align-items: end; gap: 10px 18px; padding: 14px 16px 12px; }
.carte:has(table.analyse-fact) .doc-cartouche { align-self: end; }
.carte:has(table.analyse-fact) .doc-emetteur strong { font-size: 17px; letter-spacing: .02em; color: var(--brun, #5C3A21); }
table.saisie.plan-1col { width: 100%; }
table.saisie.plan-1col td.donnee.code { width: 92px; }
table.saisie.plan-1col tr.plan-sous td.donnee.texte { padding-left: 22px; }
table.saisie.plan-1col tr.plan-sous td.donnee.code { font-weight: 500; }
.memo table.memo-ex { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 8px; }
.memo table.memo-ex th, .memo table.memo-ex td { border: 1px solid #DCEBD8; padding: 5px 7px; text-align: left; }
.memo table.memo-ex th { background: var(--menthe); color: var(--vert-fonce); }
.memo table.memo-ex td.num { text-align: right; white-space: nowrap; }
.memo .ent-liste, .ent-liste { margin: 0; padding-left: 18px; }
@media print {
	.panneau-docs { display: none !important; }
	#contenu.avec-panneau { display: block; }
	.onglets-taches > .ong-corps { display: inline-block !important; width: 49.4%; vertical-align: top; }
	.onglets-taches > .ong-corps:nth-of-type(odd) { margin-right: 1%; }
	table.saisie.analyse-fact td.saisie-ch:nth-child(3), table.saisie.analyse-fact thead th:nth-child(3) { width: auto; }
	table.saisie.analyse-fact td.saisie-ch:nth-child(4), table.saisie.analyse-fact thead th:nth-child(4) { width: auto; }
}
table.saisie.analyse-fact td.saisie-ch:nth-child(3), table.saisie.analyse-fact thead th:nth-child(3) { width: 185px; }
table.saisie.analyse-fact td.saisie-ch:nth-child(4), table.saisie.analyse-fact thead th:nth-child(4) { width: 250px; }
table.saisie.analyse-fact td.donnee.num { width: 96px; }
table.saisie.analyse-fact input.champ-date { width: 120px; text-align: center; }
table.saisie.analyse-fact { table-layout: fixed; }
table.saisie.analyse-fact thead th:nth-child(1) { width: auto; }
table.saisie.analyse-fact thead th:nth-child(2) { width: 100px; }
table.saisie.analyse-fact thead th:nth-child(3) { width: 175px; }
table.saisie.analyse-fact thead th:nth-child(4) { width: 245px; }
table.saisie.analyse-fact thead th.th-etat { width: 34px; }
table.saisie.analyse-fact thead th:nth-child(2) { width: 92px; }
table.saisie.analyse-fact thead th:nth-child(3) { width: 195px; }
table.saisie.analyse-fact thead th:nth-child(4) { width: 240px; }
@media print {
	.carte:has(table.analyse-fact) .doc-entete { display: block; padding: 1.5mm 2mm; }
	.carte:has(table.analyse-fact) .doc-emetteur, .carte:has(table.analyse-fact) .doc-titre, .carte:has(table.analyse-fact) .doc-dest { display: none; }
}
table.saisie.analyse-fact span.code-tva { float: right; margin-left: 8px; min-width: 18px; padding: 0 5px; border: 1px solid #B9D6B2; border-radius: 3px; font-size: 11px; font-weight: 700; text-align: center; color: var(--vert-fonce); background: #fff; }
/* Fournisseur bien visible : sigle, raison sociale, adresse, SIRET */
.fa-four { display: flex; gap: 12px; align-items: center; padding: 8px 12px 8px 10px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 7%, #fff); border-radius: 0 6px 6px 0; }
.fa-sigle { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 8px; background: var(--c); color: #fff; font: 800 17px/1 Georgia, 'Times New Roman', serif; letter-spacing: .03em; }
.fa-coord { display: flex; flex-direction: column; line-height: 1.35; font-size: 12.5px; color: #4A433D; white-space: normal; }
.carte:has(table.analyse-fact) .fa-coord strong { font-size: 17px; letter-spacing: .02em; color: var(--c); margin-bottom: 1px; }
.fa-siret { font-size: 11.5px; color: #6B625A; font-variant-numeric: tabular-nums; }
.carte:has(table.analyse-fact) .doc-emetteur > div { white-space: normal; }
/* Plan de comptes : colonne N° étroite, intitulé plus large */
table.saisie.plan-1col { table-layout: fixed; }
table.saisie.plan-1col thead th:first-child { width: 74px; white-space: normal; line-height: 1.2; }
table.saisie.plan-1col td.donnee.code { width: 74px; padding-left: 6px; padding-right: 4px; }
table.saisie.plan-1col td.donnee.texte { white-space: normal; }
@media print { .carte:has(table.analyse-fact) .doc-emetteur { display: none; } }
table.saisie.plan-1col { table-layout: auto; }
table.saisie.plan-1col thead th:first-child { width: 1%; white-space: nowrap; }
table.saisie.plan-1col td.donnee.code { width: 1%; white-space: nowrap; }
.carte:has(table.analyse-fact) .doc-entete { grid-template-columns: minmax(0, 1fr) 240px; grid-template-areas: "em ti" "em de" "ca ca"; align-items: start; }
.carte:has(table.analyse-fact) .doc-titre { align-self: start; }
.carte:has(table.analyse-fact) .doc-dest { align-self: end; }
.carte:has(table.analyse-fact) .fa-four { width: 100%; box-sizing: border-box; }
.carte:has(table.analyse-fact) .doc-emetteur > div { flex: 1; min-width: 0; }
.carte:has(table.analyse-fact) .fa-four { padding: 10px 14px 10px 12px; }
.memo-aide p { margin: 0 0 8px; }
.carte:has(table.analyse-fact) .fa-four { background: none; }
/* Sens : boutons Débit / Crédit (/ NC / D net) */
.bascule.bascule-sens { display: flex; width: 100%; border-radius: 7px; border-color: #D9CFC7; background: #fff; }
.bascule.bascule-sens button { flex: 1; padding: 6px 4px; font-size: 13px; white-space: nowrap; transition: background .15s, color .15s; }
.bascule.bascule-sens button:hover { background: #F6F1EC; }
.bascule.bascule-sens button[data-v="D"].actif { background: #1F5FA8; color: #fff; }
.bascule.bascule-sens button[data-v="C"].actif { background: #B5531C; color: #fff; }
.bascule.bascule-sens button[data-v="NC"].actif { background: #6B625A; color: #fff; }
.bascule.bascule-sens button[data-v="Dnet"].actif { background: #2C7A9B; color: #fff; }
td.ok .bascule.bascule-sens { border-color: var(--ok); } td.ok .bascule.bascule-sens button.actif { background: var(--ok); }
td.ko .bascule.bascule-sens { border-color: var(--ko); } td.ko .bascule.bascule-sens button.actif { background: var(--ko); }
td.ok .bascule.bascule-sens button.actif { background: #2E7D32 !important; color: #fff !important; }
td.ko .bascule.bascule-sens button.actif { background: #C62828 !important; color: #fff !important; }
td.ok .bascule.bascule-sens, td.ko .bascule.bascule-sens { background: #fff; }
@media print {
	.bascule.bascule-sens, td.ok .bascule.bascule-sens, td.ko .bascule.bascule-sens { border: 0 !important; background: none !important; display: block; text-align: center; }
	.bascule.bascule-sens button.actif, td.ok .bascule.bascule-sens button.actif, td.ko .bascule.bascule-sens button.actif { background: none !important; color: #000 !important; font-weight: 700; }
	table.saisie.analyse-fact thead th:nth-child(2) { width: 17%; }
	table.saisie.analyse-fact thead th:nth-child(3) { width: 13%; }
	table.saisie.analyse-fact thead th:nth-child(4) { width: 30%; }
}
.carte:has(table.analyse-fact) .fa-four { border-left: 0; border-radius: 0; padding-left: 0; }
/* Sens au plus juste, intitulé du compte plus large */
.bascule.bascule-sens { width: auto; display: inline-flex; }
.bascule.bascule-sens button { flex: none; padding: 5px 8px; font-size: 12.5px; }
table.saisie.analyse-fact td:has(> .bascule-sens) { text-align: center; padding-left: 4px; padding-right: 4px; }
table.saisie.analyse-fact thead th:nth-child(3) { width: 118px; }
table.saisie.analyse-fact:has(.bascule-sens button:nth-child(4)) thead th:nth-child(3) { width: 196px; }
table.saisie.analyse-fact thead th:nth-child(4) { width: 320px; }
table.saisie.analyse-fact:not(:has(.bascule-sens button:nth-child(4))) thead th:nth-child(4) { width: 380px; }
/* ===== En-tête de facture : fournisseur à gauche ; FACTURE { display: grid; grid-template-columns: minmax(0, 1fr) 230px; grid-template-areas: "em ti" "em ca" "de de"; gap: 6px 24px; align-items: start; padding: 16px 18px 12px; border-bottom: 1px solid #E8E1DA; } n°/date et destinataire à droite ===== */
.carte:has(table.analyse-fact) .doc-entete { display: grid; grid-template-columns: minmax(0, 1fr) 230px; grid-template-areas: "em ti" "em ca" "de de"; gap: 6px 24px; align-items: start; padding: 16px 18px 12px; border-bottom: 1px solid #E8E1DA; }
.carte:has(table.analyse-fact) .doc-titre { grid-area: ti; text-align: right; font-size: 22px; letter-spacing: .14em; line-height: 1; margin: 2px 0 4px; }
.carte:has(table.analyse-fact) .doc-cartouche { grid-area: ca; display: block; border: 0; border-radius: 0; padding: 0; background: none; }
.carte:has(table.analyse-fact) .doc-cartouche > div { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; padding: 3px 0; border: 0 !important; border-bottom: 1px dotted #D9CFC7 !important; }
.carte:has(table.analyse-fact) .doc-cartouche > div:last-child { border-bottom: 0 !important; }
.carte:has(table.analyse-fact) .doc-cartouche span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8A8079; }
.carte:has(table.analyse-fact) .doc-cartouche strong { font-size: 14px; color: var(--texte); min-width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.carte:has(table.analyse-fact) .doc-dest { grid-area: de; justify-self: end; width: 230px; box-sizing: border-box; margin-top: 4px; }
@media print {
	.carte:has(table.analyse-fact) .doc-entete { display: flex; justify-content: flex-start; padding: 1mm 2mm; border: 0; }
	.carte:has(table.analyse-fact) .doc-cartouche > div { display: inline-flex; border: 0 !important; margin-right: 6mm; }
}
/* Information de la ligne (montant ventilé, net remise déduite) affichée quand le sens correspondant est choisi */
.sens-info { display: none; margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--vert-fonce); white-space: nowrap; }
td:has(.bascule-sens button[data-v="Dvent"].actif) .sens-info[data-pour="Dvent"],
td:has(.bascule-sens button[data-v="Cvent"].actif) .sens-info[data-pour="Cvent"],
td:has(.bascule-sens button[data-v="Dnet"].actif) .sens-info[data-pour="Dnet"] { display: block; }
.bascule.bascule-sens button[data-v="Dvent"].actif { background: #4A6FA5; color: #fff; }
.bascule.bascule-sens button[data-v="Cvent"].actif { background: #C77A3C; color: #fff; }
table.saisie.analyse-fact:has(.bascule-sens button:nth-child(5)) thead th:nth-child(3) { width: 250px; }
table.saisie.analyse-fact:has(.bascule-sens button:nth-child(6)) thead th:nth-child(3) { width: 300px; }
table.saisie.analyse-fact:has(.bascule-sens button:nth-child(5)) thead th:nth-child(4) { width: 290px; }
table.saisie.analyse-fact tr.ligne-vent td.donnee.texte { color: #6B625A; font-style: italic; padding-left: 18px; }
table.saisie.analyse-fact tr.ligne-note td.donnee { font-style: italic; font-size: 12px; color: #5C544E; }
@media print { .sens-info { display: none !important; } }
table.saisie.analyse-fact:has(.bascule-sens button:nth-child(6)) thead th:nth-child(4) { width: 240px; }
table.saisie.analyse-fact:has(.bascule-sens button:nth-child(5)):not(:has(.bascule-sens button:nth-child(6))) thead th:nth-child(4) { width: 260px; }
/* ===== Sens : couleurs plus marquées (teinte visible avant choix, aplat franc une fois choisi) ===== */
.bascule.bascule-sens { border: 1.5px solid #CFC6BE; }
.bascule.bascule-sens button { font-weight: 700; border-left: 1px solid #E2DAD3; }
.bascule.bascule-sens button[data-v="D"] { --s: #0B4F9C; } .bascule.bascule-sens button[data-v="C"] { --s: #D35400; }
.bascule.bascule-sens button[data-v="NC"] { --s: #424242; } .bascule.bascule-sens button[data-v="Dnet"] { --s: #00838F; }
.bascule.bascule-sens button[data-v="Dvent"] { --s: #5E35B1; } .bascule.bascule-sens button[data-v="Cvent"] { --s: #AD1457; }
.bascule.bascule-sens button { color: var(--s); background: color-mix(in srgb, var(--s) 9%, #fff); }
.bascule.bascule-sens button:hover { background: color-mix(in srgb, var(--s) 20%, #fff); }
.bascule.bascule-sens button.actif, .bascule.bascule-sens button[data-v].actif { background: var(--s); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25); }
.sens-info { color: #5E35B1; }
td.ok .bascule.bascule-sens button.actif { background: #2E7D32 !important; color: #fff !important; }
td.ko .bascule.bascule-sens button.actif { background: #C62828 !important; color: #fff !important; }
@media print { .bascule.bascule-sens button { background: none !important; } .bascule.bascule-sens button.actif { color: #000 !important; box-shadow: none; } }
/* ===== Sens : boutons d'égale largeur ; Débit / Crédit en vue principale, autres situations derrière « Autre… » ===== */
.bascule.bascule-sens { display: inline-grid !important; grid-template-columns: repeat(var(--n, 3), 68px); width: auto !important; border-radius: 7px; overflow: hidden; }
.bascule.bascule-sens:not(:has(.sens-autre)) { grid-template-columns: repeat(2, 68px); }
.bascule.bascule-sens > button, .bascule.bascule-sens .sens-autres > button { width: 100%; padding: 6px 2px; font-size: 12.5px; text-align: center; white-space: nowrap; }
.bascule.bascule-sens .sens-autre { color: #5C544E; background: #F4EFEA; font-weight: 700; border-left: 1px solid #E2DAD3; }
.bascule.bascule-sens .sens-autre::after { content: ' ▾'; font-size: 10px; }
.bascule.bascule-sens.ouvert .sens-autre::after { content: ' ▴'; }
.bascule.bascule-sens .sens-autre.actif-autre { background: #5C544E; color: #fff; }
.bascule.bascule-sens .sens-autres { display: none; grid-column: 1 / -1; grid-template-columns: repeat(var(--n, 3), 68px); border-top: 1.5px solid #CFC6BE; }
.bascule.bascule-sens.ouvert .sens-autres { display: grid; }
.bascule.bascule-sens .sens-autres > button:first-child { border-left: 0; }
table.saisie.analyse-fact thead th:nth-child(3) { width: 240px !important; }
table.saisie.analyse-fact:has(.bascule-sens[style*="--n:4"]) thead th:nth-child(3) { width: 300px !important; }
table.saisie.analyse-fact:not(:has(.sens-autre)) thead th:nth-child(3) { width: 165px !important; }
table.saisie.analyse-fact thead th:nth-child(4) { width: 300px !important; }
@media print {
	.bascule.bascule-sens { display: block !important; }
	.bascule.bascule-sens .sens-autre, .bascule.bascule-sens > button:not(.actif), .bascule.bascule-sens .sens-autres > button:not(.actif) { display: none !important; }
	.bascule.bascule-sens .sens-autres { display: block !important; border: 0; }
}
.bascule.bascule-sens .sens-autre { grid-column: 3 / -1; }
table.saisie.analyse-fact thead th:nth-child(4) { width: 250px !important; }
/* ===== Infobulle du sens : légende illustrée au survol ===== */
.sens-zone { position: relative; display: inline-block; }
.sens-bulle { position: absolute; left: 50%; top: calc(100% + 8px); z-index: 60; width: 300px; transform: translateX(-50%) translateY(4px);
	background: #fff; border: 1px solid #E2DAD3; border-radius: 10px; box-shadow: 0 10px 28px rgba(60, 40, 20, .18); padding: 10px 12px 8px;
	text-align: left; white-space: normal; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s ease .35s, transform .15s ease .35s, visibility 0s linear .5s; }
.sens-bulle::before { content: ''; position: absolute; top: -6px; left: 50%; width: 10px; height: 10px; background: #fff; border-left: 1px solid #E2DAD3; border-top: 1px solid #E2DAD3; transform: translateX(-50%) rotate(45deg); }
.sens-zone:hover .sens-bulle, .sens-zone:focus-within .sens-bulle { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); transition-delay: .45s, .45s, .45s; }
.sens-bulle-titre { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8A8079; margin-bottom: 6px; }
.sens-bulle-ligne { display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: center; padding: 3px 0; font-size: 12.5px; line-height: 1.3; color: #3D3632; }
.sens-bulle-ligne + .sens-bulle-ligne { border-top: 1px dashed #EEE7E1; }
.sens-puce { display: block; text-align: center; padding: 3px 0; border-radius: 5px; font-size: 11.5px; font-weight: 800; color: #fff; background: var(--s); }
.sens-puce[data-v="D"] { --s: #0B4F9C; } .sens-puce[data-v="C"] { --s: #D35400; } .sens-puce[data-v="NC"] { --s: #424242; }
.sens-puce[data-v="Dnet"] { --s: #00838F; } .sens-puce[data-v="Dvent"] { --s: #5E35B1; } .sens-puce[data-v="Cvent"] { --s: #AD1457; }
.carte:has(table.analyse-fact), .carte:has(table.analyse-fact) .table-defile, .carte:has(table.analyse-fact) .carte-corps { overflow: visible; }
@media print { .sens-bulle { display: none !important; } .sens-zone { display: block; } }
.sens-bulle { width: 330px; }
/* Infobulle du sens : une seule indication, celle du bouton survolé */
.sens-bulle { display: none !important; }
.bulle-sens { position: fixed; z-index: 1000; width: 260px; display: grid; grid-template-columns: auto 1fr; gap: 9px; align-items: center;
	background: #fff; border: 1px solid #E2DAD3; border-radius: 9px; box-shadow: 0 10px 26px rgba(60, 40, 20, .18); padding: 8px 11px;
	font-size: 12.5px; line-height: 1.35; color: #3D3632; opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .12s, transform .12s; }
.bulle-sens.visible { opacity: 1; transform: translateY(0); }
.bulle-sens::before { content: ''; position: absolute; top: -6px; left: var(--fleche, 50%); width: 10px; height: 10px; background: #fff;
	border-left: 1px solid #E2DAD3; border-top: 1px solid #E2DAD3; transform: translateX(-50%) rotate(45deg); }
.bulle-sens .sens-puce { padding: 3px 9px; white-space: nowrap; }
.sens-puce[data-v="autre"] { --s: #5C544E; }
@media print { .bulle-sens { display: none !important; } }

/* Code couleur commun (lettrage, rapprochement, contrôle compta) : documents en bleu, travail de l'élève en jaune/orange, contexte en vert */
.panneau-docs.carte-doc { border-color: #C7D9EF; }
.panneau-docs.carte-doc .onglets { background: var(--bleu-pale, #F5F9FD); border-bottom-color: #C7D9EF; }
.panneau-docs.carte-doc .onglet { border-color: #C7D9EF; color: var(--bleu-fonce, #174A84); }
.panneau-docs.carte-doc .onglet:hover { background: var(--bleu-clair, #E6EFF9); }
.panneau-docs.carte-doc .onglet.actif { background: var(--bleu, #1F5FA8); border-color: var(--bleu, #1F5FA8); color: #fff; }
.carte-doc table.saisie th { background: var(--bleu-clair, #E6EFF9) !important; color: var(--bleu-fonce, #174A84) !important; border-color: #C7D9EF !important; }
.carte-doc table.saisie td { border-color: #DCE6F2 !important; }
.carte-doc table.saisie tbody tr:nth-child(even) td { background: var(--bleu-pale, #F5F9FD); }
.carte-doc table.saisie td.donnee.code, .carte-doc table.saisie td.donnee.num { color: var(--bleu, #1F5FA8) !important; }
.ent-grille { font-size: 14.5px; line-height: 1.45; }

/* ----- Calculatrice embarquée ----- */
.btn-calc { border: 0; cursor: pointer; font: inherit; color: inherit; }
.btn-calc:hover, .btn-calc.actif { background: rgba(255,255,255,.32); }
.calc { position: fixed; z-index: 900; width: 260px; background: #fff; border-radius: 12px; box-shadow: 0 12px 34px rgba(0,0,0,.28); overflow: hidden; font-family: inherit; user-select: none; }
.calc[hidden] { display: none; }
.calc-titre { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px 7px 14px; background: var(--pourpre); color: #fff; font-weight: 600; font-size: 14px; cursor: move; touch-action: none; }
.calc-fermer { border: 0; background: transparent; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px; }
.calc-fermer:hover { background: rgba(255,255,255,.2); }
.calc-ecran { margin: 10px 10px 6px; padding: 6px 10px; background: #F4F1EC; border-radius: 8px; text-align: right; cursor: copy; min-height: 58px; }
.calc-memo { font-size: 12px; color: var(--texte-doux, #666); min-height: 16px; }
.calc-valeur { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.calc-valeur.petit { font-size: 18px; line-height: 31px; }
.calc.copie .calc-ecran { box-shadow: inset 0 0 0 2px var(--ok, #2E7D32); }
.calc-touches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px 10px 12px; }
.calc-t { height: 42px; border: 1px solid #E2DDD5; border-radius: 8px; background: #fff; font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; color: #333; }
.calc-t:hover { background: #F7F4EF; }
.calc-t.appui, .calc-t:active { transform: scale(.95); background: #EFE9E0; }
.calc-op { background: var(--pourpre-clair, #FDEBDD); color: var(--pourpre-fonce, #8A3A0A); border-color: transparent; }
.calc-efface, .calc-retour { color: var(--ko, #C62828); }
.calc-egal { background: var(--pourpre); color: #fff; border-color: transparent; }
.calc-egal:hover { background: var(--pourpre-fonce, #A84B0D); }
@media print { .calc, .btn-calc { display: none !important; } }
@media (max-width: 860px) { .btn-calc span { display: none; } }
/* Facture analysée : colonnes du document (désignation, montant) en bleu, colonnes de l'élève en jaune */
table.saisie.analyse-fact thead th:nth-child(-n+2) { background: var(--bleu-clair) !important; color: var(--bleu-fonce) !important; border-color: #C7D9EF !important; }
table.saisie.analyse-fact tbody td.donnee { background: var(--bleu-pale) !important; border-color: #DCE6F2 !important; }
table.saisie.analyse-fact tr.ligne-ttc td.donnee { border-top-color: var(--bleu) !important; }
@media print { table.saisie.analyse-fact thead th, table.saisie.analyse-fact tbody td.donnee { background: none !important; color: #000 !important; } }
/* Onglets du panneau « Document(s) » : l'onglet actif est blanc et se prolonge dans le document (trait vert en haut), les autres sont grisés */
.panneau-docs .onglets { background: var(--menthe-clair); border-bottom: 1px solid #CFE5CA; }
.panneau-docs .onglet { background: #E4EEE1; color: #5E6E5A; border: 1px solid #CFE5CA; border-bottom: 0; border-top: 3px solid transparent; }
.panneau-docs .onglet:hover:not(.actif) { background: #D8E8D3; color: var(--vert-fonce); }
.panneau-docs .onglet.actif { background: #fff; color: var(--vert-fonce); border-color: #CFE5CA; border-top: 3px solid var(--vert); position: relative; z-index: 1; margin-bottom: -1px; padding-bottom: 7px; }

/* ===== Impression lisible des factures analysées (2 par ligne sur A4) : colonnes en proportions, pas de largeurs d'écran ===== */
@media print {
	table.saisie.analyse-fact:not(#_) { table-layout: fixed !important; width: 100% !important; }
	table.saisie.analyse-fact:not(#_) thead th:nth-child(1) { width: 36% !important; }
	table.saisie.analyse-fact:not(#_) thead th:nth-child(2) { width: 19% !important; }
	table.saisie.analyse-fact:not(#_) thead th:nth-child(3) { width: 14% !important; }
	table.saisie.analyse-fact:not(#_) thead th:nth-child(4) { width: 31% !important; }
	table.saisie.analyse-fact:not(#_) thead th.th-etat { width: 0 !important; padding: 0 !important; border: 0 !important; }
	table.saisie.analyse-fact:not(#_) td.etat { width: 0 !important; padding: 0 !important; border: 0 !important; }
	table.saisie.analyse-fact:not(#_) th, table.saisie.analyse-fact:not(#_) td { min-width: 0 !important; overflow: hidden; word-break: normal; overflow-wrap: anywhere; }
	table.saisie.analyse-fact:not(#_) td.donnee.texte { min-width: 0 !important; white-space: normal !important; }
	table.saisie.analyse-fact:not(#_) td.donnee.num { width: auto !important; white-space: nowrap !important; text-align: right; }
	table.saisie.analyse-fact:not(#_) td:has(> .bascule-sens), table.saisie.analyse-fact:not(#_) td:has(> .sens-zone) { text-align: center; }
}
@media print {
	table.saisie.analyse-fact:not(#_) .bascule-sens button.actif { color: #000 !important; background: none !important; border: 0 !important; font-weight: 700 !important; font-size: 8.5pt !important; padding: 0 !important; }
	table.saisie.analyse-fact:not(#_) thead th { color: #000 !important; }
}
@media print { table.saisie.analyse-fact:not(#_) .bascule-sens, table.saisie.analyse-fact:not(#_) .bascule-sens button, table.saisie.analyse-fact:not(#_) .sens-zone { box-shadow: none !important; border: 0 !important; background: none !important; } }
