.save-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 8px;
    justify-content: center;
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 50;
    width: min(9in, calc(100% - 32px));
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.save-bar button {
	background: transparent;
	border: none;
	padding: 2px;
	border-radius: 8px;
	cursor: pointer;
	line-height: 0;
}

.save-bar button:hover {
	background: #e5e7eb;
}

.save-bar button:disabled {
	opacity: 0.45;
	cursor: wait;
}

body.is-pdf-capture .add,
body.is-pdf-capture .cut,
body.is-pdf-capture .ins,
body.is-pdf-capture .tva-add,
body.is-pdf-capture .tva-cut,
body.is-pdf-capture .col-add,
body.is-pdf-capture .col-cut,
body.is-pdf-capture select.qty-unit {
	display: none !important;
}

body.is-pdf-capture .qty-unit-label {
	display: inline !important;
}

.save-bar button img {
    display: block;
    width: 25px;
    height: 25px;
    object-fit: contain;
    pointer-events: none;
}

.save-bar .btn-import {
	line-height: 1.2;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 8px;
	font-family: Arial, sans-serif;
	font-size: 14px;
	font-weight: bold;
	color: #111;
}
 
 @media print {
	.save-bar,
	.add,
	button,
	.btn-save,
	.btn-load {
		display: none !important;
	}
}

.doc-title-wrap {
	text-align: center;
	margin: 0 0 16px 0;
}

.doc-type-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background: transparent;
	border: none;
	border-bottom: 2px solid #222;
	cursor: pointer;
	display: inline-block;
	font-family: Arial, sans-serif;
	font-size: 22px;
	font-weight: bold;
	height: auto;
	letter-spacing: 0.14em;
	line-height: 1.2;
	padding: 2px 8px 4px;
	text-align: center;
	text-align-last: center;
	text-transform: uppercase;
	min-width: 280px;
}

.doc-type-select:hover,
.doc-type-select:focus {
	background: #DEF;
	outline: none;
}

body.doc-livraison .balance-block,
body.doc-livraison .row-montant,
body.doc-livraison .col-prix,
body.doc-livraison .col-tva,
body.doc-livraison .col-total,
body.doc-facture .col-observations {
	display: none;
}

.balance-wrapper {
	display: flex;
	gap: 30px;
	justify-content: space-between;
	align-items: flex-start;
	margin-top: 15px;
}

.balance-block {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	flex: 0 1 62%;
	min-width: 0;
}

.qr-box {
	flex: 0 0 92px;
	width: 92px;
	height: 92px;
}

.qr-box svg {
	display: block;
	width: 92px;
	height: 92px;
}

/* La table balance garde sa taille */
.balance-block > table.balance {
	flex: 1 1 auto;
	float: none;
	width: auto;
	margin: 0;
}

/* Bloc signature à droite */
.signature-box {
	flex: 1;
	text-align: center;
	padding-top: 10px;
}

.signature-label {
	margin: 0 0 30px 0;
	font-weight: bold;
	font-size: 13px;
	color: #333;
}

.signature-line {
	border-bottom: 1.5px solid #333;
	width: 100%;
	max-width: 250px;
	margin: 0 auto;
	height: 40px;
}

.signatures-bl {
	display: none;
    margin: auto;
    gap: 50px;
    width: 90%;
}
 

body.doc-livraison .signature-box {
	display: none;
}

body.doc-livraison .signatures-bl {
	display: flex;
}

.signature-card {
	flex: 1;
	border: 1px solid #fff;
	border-radius: 0.25em;
	padding: 12px 14px 16px;
	text-align: left;
	background: #fff;
}

.signature-who {
	margin: 0 0 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid #e5e5e5;
	font-weight: bold;
	font-size: 13px;
	letter-spacing: 0.08em;
	text-align: center;
	text-transform: uppercase;
}

.signature-field {
	margin: 12px 0 4px;
	font-size: 12px;
	font-weight: bold;
}

.signature-card .signature-line {
	max-width: none;
	margin: 0 0 4px;
	height: 42px;
}

.signature-stamp {
	border: 1px dashed #bbb;
	border-radius: 0.25em;
	height: 72px;
	margin-top: 2px;
}

/* Responsive : sur petits écrans, on empile */
@media (max-width: 700px) {
	.balance-wrapper {
		flex-direction: column;
	}
	.balance-block {
		flex: 1 1 100%;
		width: 100%;
	}
	.signature-box {
		width: 100%;
		margin-top: 20px;
	}
	.signatures-bl {
		flex-direction: column;
	}
}


.meta-wrapper {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-direction: row;
}

.meta-wrapper > table.meta {
	flex: 1;
	margin: 0;
}

.meta-wrapper > table.meta.meta-right {
	flex: 1;
}

.meta-wrapper > table.meta:last-child {
	flex: 0 0 32%;
}

/* Alignement vertical propre */
table.meta th {
	vertical-align: top;
	white-space: nowrap;
}

table.meta td {
	vertical-align: top;
	word-wrap: break-word;
	word-break: break-word;
}

table.meta.meta-right td span[contenteditable] {
	display: inline-block;
	line-height: 1.4;
}

/* Responsive : sur petits écrans, on empile */
@media (max-width: 700px) {
	.meta-wrapper {
		flex-direction: column;
	}
	.meta-wrapper > table.meta:last-child {
		flex: 1 1 100%;
	}
}


*
{
	border: 0;
	box-sizing: content-box;
	color: inherit;
	font-family: inherit;
	font-size: inherit;
	font-style: inherit;
	font-weight: inherit;
	line-height: inherit;
	list-style: none;
	margin: 0;
	padding: 0;
	text-decoration: none;
	vertical-align: top;
}

/* content editable */

*[contenteditable] { border-radius: 0.25em; min-width: 1em; outline: 0; }

*[contenteditable] { cursor: pointer; }

*[contenteditable]:hover, *[contenteditable]:focus, td:hover *[contenteditable], td:focus *[contenteditable], img.hover { background: #DEF; box-shadow: 0 0 1em 0.5em #DEF; }

span[contenteditable] { display: inline-block; }

/* heading */

h1 { font: bold 100% sans-serif; letter-spacing: 0.5em; text-align: center; text-transform: uppercase; }

/* table */

table { font-size: 75%; table-layout: fixed; width: 100%; }
table { border-collapse: separate; border-spacing: 2px; }
th, td { border-width: 1px; padding: 0.5em; position: relative; text-align: left; box-sizing: border-box; background-clip: padding-box; }
th, td { border-radius: 0.25em; border-style: solid; }
th { background: #EEE; border-color: #BBB; }
td { 
    border-color: #DDD;
    text-align: center;
}  
.amount {font-weight: bold; font-size: 125%;}
.amountdate {font-weight: bold; font-size: 100%;}
/* page */

html { font: 16px/1 'Open Sans', sans-serif; overflow: auto; padding: 0.5in; }
html { background: #FFF; cursor: default; }

body { box-sizing: border-box; min-height: 11in; height: auto; margin: 0 auto; padding: 0 20px 90px; width: 9in; }
body { background: #FFF; border-radius: 6px }

/* header */

header { margin: 0px 0 20px 0; }
header:after { clear: both; content: ""; display: table; }

header h1 { border-radius: 0.25em;padding: 17px 0;text-align: revert;}
header address { float: left; font-size: 75%; font-style: normal; line-height: 1.25; margin: 0 1em 1em 0; }
header address p { margin: 0 0 0.25em; }
header span, header img { display: block; float: right; }
header span { margin: 0 0 1em 1em; max-height: 25%; max-width: 60%; position: relative; }
header img { max-height: 100%; max-width: 100%; }
header input { cursor: pointer; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; height: 100%; left: 0; opacity: 0; position: absolute; top: 0; width: 100%; }

/* article */

article, article address, table.meta, table.inventory { margin: 0 0 3em; }
article:after { clear: both; content: ""; display: table; }
article h1 { clip: rect(0 0 0 0); position: absolute; }

article address { float: left; font-size: 125%; font-weight: bold; }

/* table meta & balance */

table.meta, table.balance { float: right; width: 36%; }
table.meta:after, table.balance:after { clear: both; content: ""; display: table; }

/* table meta */

/* table.meta th { width: 40%; } */
/* table.meta td { width: 60%; } */

/* table items */

table.inventory { clear: both; width: 100%; }
table.inventory th { font-weight: bold; text-align: center; }

table.inventory .col-num { width: 6%; text-align: center; }
table.inventory .col-produit { text-align: left; }
table.inventory .col-designation { text-align: left; }
table.inventory .col-extra { text-align: left; }
table.inventory .is-col-hidden { display: none !important; }
table.inventory .col-prix,
table.inventory .col-total { text-align: right; }
table.inventory .col-tva { text-align: center; }
table.inventory .col-qty { text-align: right; }
table.inventory .col-observations { text-align: left; }

.qty-cell { white-space: nowrap; }
.qty-value { min-width: 1.5em; }
.qty-unit-label { display: none; margin-left: 0.35em; }
.qty-unit {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-color: transparent;
	background-image:
		linear-gradient(45deg, transparent 50%, #444 50%),
		linear-gradient(135deg, #444 50%, transparent 50%);
	background-position: right 1px center, right 5px center;
	background-repeat: no-repeat;
	background-size: 4px 4px, 4px 4px;
	border: 0;
	border-radius: 0;
	color: inherit;
	cursor: pointer;
	display: inline-block;
	font: inherit;
	height: 1.2em;
	line-height: 1;
	margin-left: 0.35em;
	max-width: 4.5em;
	min-height: 0;
	outline: 0;
	padding: 0 12px 0 0;
	vertical-align: baseline;
}

/* table balance */

table.balance th, table.balance td { width: 50%; }
table.balance td { text-align: right; }

table.balance tr.row-lettres th {
	font-size: 12px;
	font-weight: normal;
	text-align: left;
	vertical-align: middle;
}
table.balance tr.row-lettres td {
	text-align: right;
	vertical-align: middle;
	line-height: 1.4;
	font-weight: normal;
	font-size: 12px;
}



/* aside */

aside h1 { border: none; border-width: 0 0 1px; margin: 6px; }
aside h1 { border-color: #e5e5e5; border-bottom-style: solid; }

/* javascript */

.add, .cut, .ins, .tva-add, .tva-cut, .col-add, .col-cut
{
	border-width: 1px;
	display: block;
	font-size: .8rem;
	padding: 0.25em 0.5em;	
	float: left;
	text-align: center;
	width: 0.6em;
}

.add, .cut, .ins, .tva-add, .tva-cut, .col-add, .col-cut
{
	background: #9AF;
	box-shadow: 0 1px 2px rgba(0,0,0,0.2);
	background-image: -moz-linear-gradient(#00ADEE 5%, #0078A5 100%);
	background-image: -webkit-linear-gradient(#00ADEE 5%, #0078A5 100%);
	border-radius: 0.5em;
	border-color: #0076A3;
	color: #FFF;
	cursor: pointer;
	font-weight: bold;
	text-shadow: 0 -1px 2px rgba(0,0,0,0.333);
}

.add { margin: -2.5em 0 0; }

.add:hover { background: #00ADEE; }

.cut, .ins, .tva-add, .tva-cut, .col-add, .col-cut { opacity: 0; position: absolute; -webkit-transition: opacity 100ms ease-in; }
.cut, .tva-cut, .col-cut { left: -1.5em; top: 0; }
.ins, .tva-add, .col-add { left: -3em; top: auto; bottom: 0; }

tr:hover .cut, tr:hover .ins, tr:hover .tva-add, tr:hover .tva-cut, tr:hover .col-add, tr:hover .col-cut { opacity: 1; }

@media print {
	* {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
	html, body {
		background: none;
		box-shadow: none;
		overflow: visible !important;
		margin: 0 !important;
		padding: 0 !important;
		width: auto !important;
		height: auto !important;
		min-height: 0 !important;
	}
	#invoice-sheet {
		width: auto;
		-webkit-box-decoration-break: clone;
		box-decoration-break: clone;
		padding: 12mm 10mm 2mm;
	}
	#gate { display: none !important; }
	span:empty { display: none; }
	.add, .cut, .ins, .tva-add, .tva-cut, .col-add, .col-cut { display: none; }
	select.qty-unit { display: none !important; }
	.qty-unit-label { display: inline !important; }
	.qty-unit { appearance: none; -webkit-appearance: none; background: none; }
	header span {
		float: right;
		max-height: none !important;
		max-width: none !important;
		width: 200px;
	}
	header img {
		display: block !important;
		float: none !important;
		width: 200px !important;
		height: auto !important;
		max-width: none !important;
		max-height: none !important;
	}
	.doc-type-select {
		border-bottom: none;
		background: transparent !important;
		box-shadow: none !important;
	}
	.pdf-export-host { display: none !important; }
}

@page {
	size: A4;
	margin: 0 0 8mm 0;
	@bottom-right {
		content: counter(page) "/" counter(pages);
		font-family: Arial, sans-serif;
		font-size: 9pt;
		color: #393939;
		margin-right: 8mm;
		margin-bottom: 2mm;
	}
}

#gate {
	display: none;
}

html:has(body.is-locked) {
	overflow: hidden;
	padding: 0;
	height: 100%;
}

body.is-locked {
	overflow: hidden;
	height: 100vh;
	width: 100%;
	padding: 0;
}

body.is-locked #gate {
	display: flex;
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 10000;
	background: #fff;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 28px;
}

body.is-locked #invoice-sheet,
body.is-locked .save-bar {
	display: none !important;
}

#gate img {
	width: 240px;
	height: auto;
}

#gate-form {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

#gate-field {
	position: relative;
	width: 260px;
}

#gate-password {
	width: 100%;
	height: 44px;
	padding: 0 14px;
	border: 1px solid #ccc;
	border-radius: 12px;
	font-family: Arial, sans-serif;
	font-size: 16px;
	text-align: left;
	box-sizing: border-box;
}