/* 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; }

/* Code couleur commun (lettrage, rapprochement) : documents = bleu ; travail = orange ; violet réservé à « Pour aller plus loin » */
.carte-doc { border-color: #C7D9EF; }
.carte-doc table.saisie th { background: var(--bleu-clair); color: var(--bleu-fonce); border-color: #C7D9EF; }
.carte-doc table.saisie td { border-color: #DCE6F2; }
.carte-doc table.saisie tbody tr:nth-child(even):not(.ligne-total):not(.ligne-groupe) td { background: var(--bleu-pale); }
.carte-doc table.saisie td.donnee.code { color: var(--bleu); }
.carte-doc table.saisie tr.ligne-total td { border-top-color: var(--bleu); background: var(--bleu-clair); color: var(--bleu-fonce); }
.carte-doc table.saisie tr.ligne-groupe td { background: var(--bleu-clair); color: var(--bleu-fonce); }
/* « Pour aller plus loin » : violet inversé #7B4FA8 (comme le lettrage et le rapprochement) */
.titre-section { background: #7B4FA8 !important; border-left: 0 !important; color: #fff !important; }
.titre-section span, .titre-section small { color: #fff !important; }
.titre-section small { opacity: .92; font-weight: 500; }
@media print { .titre-section { background: none !important; border-left: 2pt solid #000 !important; } .titre-section, .titre-section span, .titre-section small { color: #000 !important; } }
/* Bordereau à contrôler : bandeau « Extrait du journal des achats » en bleu (documents) */
table.saisie.controle thead th.th-extrait { background: var(--bleu) !important; color: #fff !important; text-align: left; font-size: 13px; letter-spacing: .02em; text-transform: none; border-color: var(--bleu) !important; }
table.saisie.controle thead th.th-controle { background: transparent !important; border: 0 !important; }
@media print { table.saisie.controle thead th.th-extrait { background: none !important; color: #000 !important; border: 0.5pt solid #888 !important; } }
.ong-corps table.saisie.controle { width: 100%; }
/* Données de l'extrait du journal : bleu (documents) */
table.saisie.controle thead tr:nth-child(2) th:nth-child(-n+6) { background: var(--bleu-clair) !important; color: var(--bleu-fonce) !important; border-color: #C7D9EF !important; }
table.saisie.controle tbody td.donnee { background: var(--bleu-pale) !important; border-color: #DCE6F2; }
table.saisie.controle tbody td.donnee.code { color: var(--bleu) !important; }
table.saisie.controle tr.ligne-total td { background: var(--bleu-clair) !important; color: var(--bleu-fonce) !important; border-top-color: var(--bleu) !important; }
@media print { table.saisie.controle thead th, table.saisie.controle tbody td.donnee, table.saisie.controle tr.ligne-total td { background: none !important; color: #000 !important; } }
table.saisie.controle thead th.th-etat { background: #fff !important; border-color: var(--gris-ligne) !important; }
table.saisie.controle tr.ligne-total td:first-child { background: var(--bleu-clair) !important; color: var(--bleu-fonce) !important; }
.ong-corps > .section .carte.carte-violet { width: fit-content; max-width: 100%; }
.carte table.saisie.controle tbody tr.ligne-total td { background: var(--bleu-clair) !important; color: var(--bleu-fonce) !important; }
@media print { .carte table.saisie.controle tbody td.donnee.code, .carte table.saisie.controle tbody tr.ligne-total td, .carte table.saisie.controle thead th { color: #000 !important; background: none !important; } }
/* Factures moins larges ; écritures rectifiées côte à côte ; contexte plus lisible */
.ong-corps > .section > .carte-donnees, .ong-corps .carte-donnees { max-width: 660px; }
.ong-corps:has(.carte-violet) > .section { width: auto; flex: 1 1 420px; min-width: 0; }
.ong-corps:has(.carte-violet) > .section:has(.titre-section) { flex-basis: 100%; }
.ong-corps:has(.carte-violet) > .section .carte.carte-violet { width: 100%; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture { width: 100%; }
.ent-grille { font-size: 14.5px; line-height: 1.45; }
.ong-corps:has(.carte-violet) .carte-violet .defile { overflow-x: visible; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture { table-layout: fixed; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture th:nth-child(2), .ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture th:nth-child(3) { width: 104px !important; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture th.th-etat, .ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture th:last-child:empty { width: 34px !important; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture select { width: 100%; min-width: 0; max-width: none; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture input { width: 100%; min-width: 0; box-sizing: border-box; }
.ong-corps:has(.carte-violet) .carte-violet table.saisie.ecriture th:first-child { width: auto !important; }

/* Documents : onglets (factures, écritures à rectifier) + plan de comptes affiché à côté */
.ong-avec-doc { display: flex; gap: 18px; align-items: flex-start; }
.ong-avec-doc > .ong-zone { flex: 1 1 auto; min-width: 0; }
.ong-avec-doc > .doc-lateral { flex: 0 0 auto; width: 380px; max-width: 40%; position: sticky; top: 12px; }
.ong-avec-doc > .doc-lateral .carte { width: 100%; margin-top: 0; }
.ong-avec-doc > .doc-lateral table.saisie { width: 100%; }
.ong-avec-doc .ong-corps > .section > .carte-donnees, .ong-avec-doc .ong-corps .carte-donnees { max-width: 660px; }
.ong-corps:has(.carte-violet) > .section { flex: none; width: 100%; }
.ong-corps:has(.carte-violet) > .section .carte.carte-violet { width: 100%; max-width: 660px; margin-left: auto; margin-right: auto; }
.onglet[data-apres] { border-top-color: #7B4FA8; }
.onglet[data-apres].actif { background: #7B4FA8 !important; color: #fff !important; border-color: #7B4FA8 !important; }
.onglet.onglet-nouveau { animation: onglet-nouveau 1.2s ease 2; }
@keyframes onglet-nouveau { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px #E3D6F2; } }
@media (max-width: 1000px) { .ong-avec-doc { flex-direction: column; } .ong-avec-doc > .doc-lateral { width: 100%; max-width: none; position: static; } }
@media print { .ong-avec-doc { display: block !important; } .ong-avec-doc > .doc-lateral { display: none !important; } }
.ong-avec-doc > .ong-zone { flex: 1 1 480px; }
.ong-avec-doc > .doc-lateral { flex: 0 1 560px; width: auto; max-width: 50%; }
.ong-avec-doc > .doc-lateral table.saisie td.donnee.texte { white-space: normal; }
/* Impression : le bordereau contrôlé d'abord, puis « Pour aller plus loin » (une seule fois) et les écritures rectifiées */
@media print {
	#contenu:has(> .ong-avec-doc) { display: flex !important; flex-direction: column !important; }
	#contenu > .ong-avec-doc { order: 2; }
	.ong-avec-doc .ong-corps:has(.titre-section) ~ .ong-corps .titre-section { display: none !important; }
}

/* ===== Impression : bordereau pleine largeur, puis « Pour aller plus loin » et les écritures rectifiées côte à côte ===== */
@media print {
	.ong-avec-doc .onglets-taches:has(.carte-violet) { display: flex !important; flex-wrap: wrap; gap: 0 4mm; align-items: flex-start; }
	.ong-avec-doc .onglets-taches:has(.carte-violet)::before { content: 'Pour aller plus loin – Écritures rectifiées'; flex: 0 0 100%; font-weight: 700; font-size: 10pt;
		border-left: 2pt solid #000; padding: .8mm 2mm; margin: 3mm 0 2mm; }
	.ong-avec-doc .ong-corps:not(:has(.carte-violet)) { display: none !important; }
	.ong-avec-doc .ong-corps:has(.carte-violet) { display: block !important; flex: 1 1 45%; min-width: 0; }
	.ong-avec-doc .ong-corps .titre-section { display: none !important; } .ong-avec-doc .ong-corps .section:has(> .titre-section) { display: none !important; }
	.ong-avec-doc .ong-corps:has(.carte-violet) > .section .carte.carte-violet { max-width: none !important; width: 100% !important; margin: 0 !important; }
	.ong-avec-doc .ong-corps .carte-violet table.saisie.ecriture { width: 100% !important; }
	table.saisie.controle .bascule button.actif, table.saisie.controle .bascule button { font-size: 8.5pt !important; }
	table.saisie.controle td.saisie-ch { min-width: 0 !important; } table.saisie.controle td:has(> select) { min-width: 0 !important; }
}
@media print {
	#contenu > .section:has(table.controle), #contenu > .section:has(table.controle) > .carte { width: 100% !important; max-width: 100% !important; }
	#contenu > .section:has(table.controle) .defile { overflow: visible !important; }
	table.saisie.controle { width: 100% !important; }
	table.saisie.controle thead th, .carte table.saisie.controle thead th { color: #000 !important; }
	.ong-avec-doc .carte-violet table.saisie.ecriture { table-layout: fixed; }
	.ong-avec-doc .carte-violet table.saisie.ecriture th:first-child { width: 52% !important; }
	.ong-avec-doc .carte-violet table.saisie.ecriture th:nth-child(2), .ong-avec-doc .carte-violet table.saisie.ecriture th:nth-child(3) { width: 20% !important; }
	.ong-avec-doc .carte-violet table.saisie.ecriture th:last-child:not(:nth-child(-n+3)) { width: 8% !important; }
}
@media print {
	table.saisie.controle:not(#_) thead tr th { color: #000 !important; }
	#contenu > .section:has(table.controle) > .carte { box-sizing: border-box; }
	.ong-avec-doc .carte-violet table.saisie.ecriture:not(#_) { table-layout: fixed !important; width: 100% !important; }
	.ong-avec-doc .carte-violet table.saisie.ecriture:not(#_) thead th:first-child { width: 54% !important; }
	.ong-avec-doc .carte-violet table.saisie.ecriture:not(#_) thead th:nth-child(2), .ong-avec-doc .carte-violet table.saisie.ecriture:not(#_) thead th:nth-child(3) { width: 19% !important; }
	.ong-avec-doc .carte-violet table.saisie.ecriture:not(#_) thead th:nth-child(4) { width: 8% !important; }
}
@media print {
	.ong-avec-doc .carte-violet tbody tr.vide-impr { display: none !important; }
	.ong-avec-doc .ong-corps .section.vide-impr { display: none !important; } .ong-avec-doc .ong-corps:has(> .section.vide-impr):not(:has(> .section:not(.vide-impr) .carte-violet)) { display: none !important; }
	.ong-avec-doc .onglets-taches.sans-ecriture::after { content: 'Pas d’écriture.'; flex: 0 0 100%; font-style: italic; padding: 0 2mm 2mm; }
}
.verif-cas .btn-stop { margin-left: 10px; }
@media print { .ong-avec-doc .onglets-taches.non-faites::after { content: 'Non réalisées : l’élève a choisi de ne pas aller plus loin.'; } }

/* ----- 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; } }
/* 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; }
/* Montants à 6 chiffres (ex. 126 700,00) visibles en entier */
.champ-mt { min-width: 98px; }
#contenu.centre > .section-ecriture .champ-mt { width: 96px; padding-left: 4px; padding-right: 4px; }
/* Justification masquée tant que « Non » n'est pas choisi */
table.controle td.justif-cachee > select { visibility: hidden; }
@media print { table.controle td.justif-cachee > select { visibility: hidden !important; } }

/* Plan de comptes (document de référence) en vert, comme le panneau « Document(s) » des autres ateliers */
.doc-lateral .carte-doc:not(#_) { border-color: #CFE5CA; }
.doc-lateral .carte-doc:not(#_) > .carte-titre { background: var(--vert); color: #fff; }
.doc-lateral .carte-doc:not(#_) table.saisie th { background: var(--menthe); color: var(--vert-fonce); border-color: #CFE5CA; }
.doc-lateral .carte-doc:not(#_) table.saisie td { border-color: #DCEBD8; }
.doc-lateral .carte-doc:not(#_) table.saisie tbody tr:nth-child(even) td { background: var(--menthe-clair); }
.doc-lateral .carte-doc:not(#_) table.saisie td.donnee.code { color: var(--vert); }

/* Choix après la vérification du contrôle : « Je ne vais pas plus loin » / « + Je passe les écritures » (bonus) */
.verif-cas .btn-plus-loin { margin-left: 10px; background: #7B4FA8; color: #fff; border: 1px solid #7B4FA8; display: inline-flex; align-items: center; gap: 7px; }
.verif-cas .btn-plus-loin:hover:not(:disabled) { background: #63408A; border-color: #63408A; }
.verif-cas .btn-plus-loin[hidden] { display: none; }
.btn-plus-loin .plus { font-size: 18px; font-weight: 800; line-height: 1; }
.btn-plus-loin .badge-bonus { background: #FCC419; color: #4A2D6E; font-size: 11.5px; font-weight: 800; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }
@media print { .btn-plus-loin { display: none !important; } }

/* Bouton « Vérifier » violet (Pour aller plus loin) : survol lisible */
.carte-violet + .verif-cas .btn-verif-cas:not(#_):hover:not(:disabled), .verif-cas .btn-verif-cas.violet:not(#_):hover:not(:disabled) { background: #63408A; color: #fff; }

/* « Pour aller plus loin » : écriture allégée (sans fond de couleur) */
.carte-violet table.saisie th:not(#_) { background: #fff; color: #4A2D6E; border-color: #EAE3F2; border-bottom: 2px solid #D9C9EC; }
.carte-violet table.saisie td:not(#_) { background: #fff; }
.carte-violet table.saisie tr.ecr-total td:not(#_) { background: #FAF9F7; }
.carte-violet .champ:not(#_) { background: #fff; border-color: #D9CFC7; }
.carte-violet td.ok .champ:not(#_) { border-color: var(--ok); background: var(--ok-fond); }
.carte-violet td.ko .champ:not(#_) { border-color: var(--ko); background: var(--ko-fond); }

/* Débit OU crédit : la case d'en face est bloquée dès qu'un montant est saisi (sans changer son aspect) */
input.champ.mt-bloque { cursor: not-allowed; }
