/* ═══════════════════════════════════════════════════════════
   Facture Suisse Facile — App styles
   Couleurs du portfolio: pink #c2185b, cyan #0d8db8, gold #d4a20a
   ═══════════════════════════════════════════════════════════ */

:root {
	--pink: #c2185b;
	--pink-dark: #a01550;
	--pink-light: #e91e73;
	--pink-soft: #fde4ec;
	--cyan: #0d8db8;
	--cyan-dark: #0a6e8f;
	--gold: #d4a20a;
	--gold-light: #eab80e;

	--ink: #0c0c0f;
	--ink-2: #24242b;
	--ink-3: #55555f;
	--muted: #8b8b95;
	--line: #e8e8ed;
	--line-soft: #f1f1f5;
	--bg: #faf7f2;
	--bg-2: #f5f1ea;
	--card: #ffffff;

	--radius-sm: 8px;
	--radius: 14px;
	--radius-lg: 22px;
	--shadow-sm: 0 1px 2px rgba(12, 12, 15, 0.04), 0 1px 3px rgba(12, 12, 15, 0.06);
	--shadow: 0 4px 14px rgba(12, 12, 15, 0.06), 0 1px 3px rgba(12, 12, 15, 0.04);
	--shadow-lg: 0 20px 40px -20px rgba(12, 12, 15, 0.25), 0 10px 20px -10px rgba(12, 12, 15, 0.1);

	--header-h: 72px;

	--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--font-display: 'Fraunces', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.55;
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.2; color: var(--ink); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: 2.25rem; letter-spacing: -0.02em; }
h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -0.01em; }
h3 { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 1.25rem; }
p { margin: 0 0 0.75em; }
a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; }

.req { color: var(--pink); }

/* ── Header ── */
.app-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--line);
	height: var(--header-h);
	display: flex;
	align-items: center;
	padding: 0 clamp(1rem, 3vw, 2rem);
	gap: 2rem;
}

.app-brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	color: var(--ink);
	text-decoration: none;
	font-family: var(--font-display);
	font-size: 1.12rem;
	font-weight: 500;
	letter-spacing: -0.01em;
}
.app-brand:hover { text-decoration: none; }
.app-brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	background: var(--pink-soft);
	color: var(--pink);
}
.app-brand-mark svg { width: 22px; height: 22px; }
.app-brand-text strong { font-weight: 700; color: var(--pink); }

.app-nav {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	margin-left: auto;
}
.app-nav a {
	color: var(--ink-3);
	font-weight: 500;
	font-size: 0.92rem;
	padding: 0.55rem 0.95rem;
	border-radius: 999px;
	transition: all 0.2s;
	text-decoration: none;
}
.app-nav a:hover { color: var(--ink); background: var(--line-soft); }
.app-nav a.active { color: var(--pink); background: var(--pink-soft); }

.app-menu-toggle {
	display: none;
	background: none;
	border: 0;
	padding: 0.5rem;
	cursor: pointer;
	flex-direction: column;
	gap: 4px;
	margin-left: auto;
}
.app-menu-toggle span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--ink);
	border-radius: 2px;
	transition: transform 0.2s;
}

/* ── Main ── */
.app-main {
	max-width: 1280px;
	margin: 0 auto;
	padding: 2.5rem clamp(1rem, 3vw, 2rem) 4rem;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}

.page-header { margin-bottom: 2rem; }
.page-header h1 { margin-bottom: 0.35rem; }
.page-sub { color: var(--muted); max-width: 60ch; margin: 0; }

.page-actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.75rem;
	flex-wrap: wrap;
}

.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.25rem;
	gap: 1rem;
}
.section-header h2, .section-header h3 { margin: 0; }

/* ── Hero (accueil) ── */
.hero {
	position: relative;
	background: var(--ink);
	color: #fff;
	border-radius: var(--radius-lg);
	padding: clamp(3.5rem, 8vw, 6rem) clamp(1.5rem, 5vw, 4rem);
	margin-bottom: 2.5rem;
	overflow: hidden;
	box-shadow: var(--shadow-lg);
	text-align: center;
}
.hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 80% 60% at 50% -10%, var(--pink) 0%, transparent 60%),
		radial-gradient(circle at 85% 80%, rgba(13, 141, 184, 0.3) 0%, transparent 35%),
		radial-gradient(circle at 10% 70%, rgba(194, 24, 91, 0.15) 0%, transparent 30%);
	pointer-events: none;
}
.hero::after {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
	background-size: 24px 24px;
	pointer-events: none;
}
.hero-inner { position: relative; max-width: 740px; margin: 0 auto; z-index: 1; }
.hero-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.45rem 1.1rem;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: var(--radius-sm);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: rgba(255, 255, 255, 0.7);
	margin-bottom: 1.75rem;
}
.hero-title {
	color: #fff;
	font-family: var(--font-sans);
	font-size: clamp(2.2rem, 5.5vw, 3.8rem);
	font-weight: 800;
	letter-spacing: -0.035em;
	line-height: 1.1;
	margin-bottom: 1.25rem;
}
.hero-title em {
	font-style: normal;
	background: linear-gradient(135deg, var(--cyan) 0%, #5ce1ff 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}
.hero-sub {
	font-size: clamp(1rem, 1.4vw, 1.15rem);
	color: rgba(255, 255, 255, 0.65);
	max-width: 50ch;
	margin: 0 auto 2.25rem;
	line-height: 1.65;
}
.hero-ctas {
	display: flex;
	justify-content: center;
	gap: 0.85rem;
	flex-wrap: wrap;
	margin-bottom: 3rem;
}
.hero-ctas .btn-ghost {
	background: rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.85);
	border-color: rgba(255, 255, 255, 0.15);
}
.hero-ctas .btn-ghost:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: rgba(255, 255, 255, 0.35);
	color: #fff;
}
.hero-ctas .btn-primary {
	background: var(--pink);
	color: #fff;
	box-shadow: 0 4px 20px -4px rgba(194, 24, 91, 0.5);
}
.hero-ctas .btn-primary:hover {
	background: var(--pink-light);
	box-shadow: 0 6px 28px -6px rgba(194, 24, 91, 0.6);
}
.hero-features {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 0.65rem;
	max-width: 620px;
	margin: 0 auto;
}
.hero-feature {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font-size: 0.82rem;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.55);
}
.hero-feature svg {
	width: 15px;
	height: 15px;
	color: var(--cyan);
	flex-shrink: 0;
}

/* ── Dashboard ── */
.dashboard { }
.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 1rem;
	margin-bottom: 2.5rem;
}
.stat-card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.5rem;
	box-shadow: var(--shadow-sm);
}
.stat-card-accent {
	background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
	color: #fff;
	border-color: transparent;
}
.stat-label {
	font-size: 0.78rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
	margin-bottom: 0.5rem;
}
.stat-card-accent .stat-label { color: rgba(255, 255, 255, 0.75); }
.stat-value {
	font-family: var(--font-display);
	font-size: 2rem;
	font-weight: 600;
	color: var(--ink);
	letter-spacing: -0.01em;
}
.stat-card-accent .stat-value { color: #fff; }

.dashboard-recent { margin-top: 2rem; }
.recent-list {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}
.empty-msg {
	padding: 2rem;
	text-align: center;
	color: var(--muted);
	margin: 0;
}

/* ── Buttons ── */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.7rem 1.3rem;
	border-radius: 10px;
	border: 1px solid transparent;
	font-family: var(--font-sans);
	font-weight: 600;
	font-size: 0.92rem;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
	white-space: nowrap;
	line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary {
	background: var(--pink);
	color: #fff;
	box-shadow: 0 4px 14px -4px rgba(194, 24, 91, 0.5);
}
.btn-primary:hover { background: var(--pink-dark); box-shadow: 0 6px 20px -6px rgba(194, 24, 91, 0.6); }
.btn-secondary {
	background: var(--ink);
	color: #fff;
}
.btn-secondary:hover { background: var(--ink-2); }
.btn-ghost {
	background: transparent;
	color: var(--ink);
	border-color: var(--line);
}
.btn-ghost:hover { background: var(--line-soft); border-color: var(--ink-3); }
.btn-lg { padding: 0.95rem 1.8rem; font-size: 1rem; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }

.btn-danger {
	background: transparent;
	color: #d03030;
	border-color: transparent;
}
.btn-danger:hover { background: #fde4e4; }

.link-btn {
	background: none;
	border: 0;
	color: var(--pink);
	cursor: pointer;
	padding: 0;
	font: inherit;
}
.link-btn:hover { text-decoration: underline; }

/* ── Forms ── */
.form-card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 2rem clamp(1.5rem, 3vw, 2.5rem);
	box-shadow: var(--shadow-sm);
	max-width: 880px;
}

.form-section {
	padding-bottom: 2rem;
	margin-bottom: 2rem;
	border-bottom: 1px solid var(--line-soft);
}
.form-section:last-of-type { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }

.form-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.1rem;
}

.form-field {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}
.form-field-wide { grid-column: 1 / -1; }
.form-field > span {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--ink-2);
}

.form-field input,
.form-field select,
.form-field textarea,
.search-input {
	width: 100%;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--line);
	border-radius: 10px;
	font-family: var(--font-sans);
	font-size: 0.95rem;
	color: var(--ink);
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.search-input:focus {
	outline: none;
	border-color: var(--pink);
	box-shadow: 0 0 0 3px rgba(194, 24, 91, 0.12);
}
.form-field input[type="color"] {
	padding: 4px;
	height: 42px;
	cursor: pointer;
}
.form-field textarea { resize: vertical; min-height: 80px; }

.form-hint {
	font-size: 0.82rem;
	color: var(--muted);
	margin: 0.5rem 0 0;
}

.form-actions {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding-top: 2rem;
	margin-top: 2rem;
	border-top: 1px solid var(--line-soft);
}
.form-status {
	color: var(--cyan-dark);
	font-size: 0.88rem;
	font-weight: 500;
	opacity: 0;
	transition: opacity 0.3s;
}
.form-status.show { opacity: 1; }

/* ── Logo uploader ── */
.logo-uploader {
	display: flex;
	gap: 1.5rem;
	align-items: center;
}
.logo-preview {
	width: 140px;
	height: 140px;
	border-radius: var(--radius);
	background: var(--line-soft);
	border: 2px dashed var(--line);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
}
.logo-preview img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}
.logo-placeholder {
	color: var(--muted);
	font-size: 0.82rem;
}
.logo-actions { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }

/* ── Search ── */
.search-input {
	max-width: 320px;
}

/* ── Clients grid ── */
.clients-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1rem;
}
.client-card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.25rem 1.35rem;
	box-shadow: var(--shadow-sm);
	transition: all 0.2s;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.client-card:hover {
	border-color: var(--pink);
	transform: translateY(-2px);
	box-shadow: var(--shadow);
}
.client-card h4 {
	font-family: var(--font-sans);
	font-size: 1.02rem;
	font-weight: 600;
	text-transform: none;
	letter-spacing: normal;
	color: var(--ink);
	margin: 0;
}
.client-card p {
	font-size: 0.86rem;
	color: var(--muted);
	margin: 0;
	line-height: 1.5;
}
.client-card-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--line-soft);
}

/* ── Modal ── */
.modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(12, 12, 15, 0.5);
	backdrop-filter: blur(4px);
}
.modal-content {
	position: relative;
	background: var(--card);
	border-radius: var(--radius);
	max-width: 560px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: var(--shadow-lg);
	animation: modalIn 0.2s ease;
}
@keyframes modalIn {
	from { opacity: 0; transform: scale(0.96) translateY(8px); }
	to { opacity: 1; transform: none; }
}
.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--line-soft);
}
.modal-header h3 {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.25rem;
	font-weight: 600;
	text-transform: none;
	letter-spacing: normal;
	color: var(--ink);
}
.modal-close {
	background: none;
	border: 0;
	font-size: 1.8rem;
	line-height: 1;
	color: var(--muted);
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	border-radius: 6px;
}
.modal-close:hover { background: var(--line-soft); color: var(--ink); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.1rem; }
.modal-footer {
	display: flex;
	gap: 0.75rem;
	justify-content: flex-end;
	padding-top: 1rem;
	margin-top: 0.5rem;
	border-top: 1px solid var(--line-soft);
}

/* ── Éditeur facture ── */
.editor-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1.5rem;
	flex-wrap: wrap;
}
.editor-actions {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.editor-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	gap: 2rem;
	align-items: start;
}

.editor-panel {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.75rem clamp(1.25rem, 2.5vw, 2rem);
	box-shadow: var(--shadow-sm);
}

.editor-preview {
	position: sticky;
	top: calc(var(--header-h) + 1.5rem);
}
.preview-scaler {
	background: var(--bg-2);
	border-radius: var(--radius);
	padding: 1.5rem;
	overflow: hidden;
	border: 1px solid var(--line);
}
#invoicePages {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.25rem;
}

/* ── Tableau de lignes ── */
.lines-table {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.lines-header {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 60px 100px 80px 90px 36px;
	gap: 0.6rem;
	padding: 0 0.25rem 0.5rem;
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}
.line-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 60px 100px 80px 90px 36px;
	gap: 0.6rem;
	align-items: center;
}
.line-row input,
.line-row select {
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	font-size: 0.88rem;
	font-family: var(--font-sans);
	background: #fff;
	width: 100%;
}
.line-row input:focus,
.line-row select:focus {
	outline: none;
	border-color: var(--pink);
	box-shadow: 0 0 0 2px rgba(194, 24, 91, 0.12);
}
.line-total {
	padding: 0.55rem 0.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--ink);
	text-align: right;
}
.line-remove {
	background: none;
	border: 0;
	color: var(--muted);
	cursor: pointer;
	padding: 0.4rem;
	border-radius: 6px;
	font-size: 1.1rem;
}
.line-remove:hover { background: #fde4e4; color: #d03030; }

/* ── Historique ── */
.history-list {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}
.history-item {
	display: grid;
	grid-template-columns: 130px 1fr 110px 130px auto;
	gap: 1rem;
	align-items: center;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1rem 1.25rem;
	box-shadow: var(--shadow-sm);
	cursor: pointer;
	transition: all 0.2s;
}
.history-item:hover {
	border-color: var(--pink);
	transform: translateY(-1px);
	box-shadow: var(--shadow);
}
.history-num {
	font-family: var(--font-display);
	font-weight: 600;
	color: var(--pink);
}
.history-client { font-weight: 500; }
.history-date { color: var(--muted); font-size: 0.88rem; }
.history-amount { font-weight: 700; text-align: right; font-family: var(--font-display); }
.history-actions { display: flex; gap: 0.35rem; justify-content: flex-end; }

/* ═══════════════════════════════════════════════════════════
   Facture A4 Preview — style suisse avec bande verticale + QR-bill
   Inspiré des factures suisses classiques (format A4 210×297mm)
   ═══════════════════════════════════════════════════════════ */

.invoice-page {
	position: relative;
	background: #fff;
	color: #000;
	width: 210mm;
	height: 297mm;
	min-height: 297mm;
	box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.2);
	margin: 0 auto;
	font-family: var(--font-sans);
	font-size: 9.5pt;
	line-height: 1.5;
	overflow: hidden;
	box-sizing: border-box;
}

/* ── Bande verticale "FACTURE" à gauche ── */
.inv-band {
	position: absolute;
	top: 0;
	left: 0;
	width: 20mm;
	height: 100%;
	background: var(--inv-accent, #c2185b);
	color: #fff;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: center;
	padding: 0;
	overflow: hidden;
	z-index: 0;
}
.inv-band span {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-family: 'Unbounded', 'Inter', sans-serif;
	font-weight: 900;
	font-size: 26pt;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	line-height: 1;
	white-space: nowrap;
}

/* ── Corps ── */
.inv-body {
	position: absolute;
	inset: 0;
	padding: 16mm 15mm 22mm 35mm;
	box-sizing: border-box;
	z-index: 1;
}
/* La dernière page réserve 99mm en bas pour la QR-facture (95mm + marge) */
.invoice-page-last .inv-body {
	padding-bottom: 99mm;
}

/* ── Haut : expéditeur + logo/meta ── */
.inv-top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 2rem;
	margin-bottom: 22mm;
}
.inv-issuer {
	font-size: 9pt;
	line-height: 1.55;
	color: #000;
}
.inv-issuer p { margin: 0; }
.inv-issuer .inv-issuer-name { font-weight: 600; }

.inv-header-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8mm;
	min-width: 60mm;
}
.inv-logo {
	min-height: 22mm;
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
}
.inv-logo img {
	max-height: 28mm;
	max-width: 55mm;
	object-fit: contain;
}
.inv-logo-placeholder {
	font-family: 'Fraunces', serif;
	font-size: 15pt;
	font-weight: 600;
	color: var(--inv-accent, #c2185b);
}

.inv-meta {
	display: grid;
	grid-template-columns: auto auto;
	gap: 1.5mm 8mm;
	font-size: 9.5pt;
	margin: 0;
	align-self: flex-end;
}
.inv-meta dt, .inv-meta dd {
	margin: 0;
	padding: 0;
	color: #000;
	font-weight: 400;
}
.inv-meta dt { justify-self: start; }
.inv-meta dd { justify-self: end; text-align: right; }

/* ── Header compact (pages de continuation) ── */
.inv-top-compact {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 0 0 3mm;
	margin-bottom: 6mm;
	border-bottom: 1px solid #c8c8cd;
	font-size: 9pt;
	color: #2a2a30;
}
.inv-top-compact .inv-cont-num {
	font-weight: 600;
}
.inv-top-compact .inv-cont-suite {
	font-style: italic;
	color: var(--inv-accent, #c2185b);
	font-size: 8.5pt;
}

/* ── Contenu principal (tableau + total + notes) ── */
.inv-main { }

.inv-object {
	font-size: 9.5pt;
	margin-bottom: 5mm;
	color: #000;
}
.inv-object strong { font-weight: 600; }

.inv-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 0;
	font-size: 9.5pt;
}
.inv-table thead th {
	background: #1a1a1f;
	color: #fff;
	padding: 3.5mm 3mm;
	font-weight: 500;
	font-size: 9pt;
	text-align: left;
	letter-spacing: 0.02em;
}
.inv-table thead th.num { text-align: center; }
.inv-table thead th.amount { text-align: right; }
.inv-table tbody td {
	padding: 4mm 3mm;
	border-bottom: 1px solid #c8c8cd;
	vertical-align: top;
	color: #000;
}
.inv-table tbody td.num { text-align: center; font-variant-numeric: tabular-nums; }
.inv-table tbody td.amount { text-align: right; font-variant-numeric: tabular-nums; }
.inv-table tbody tr:last-child td { border-bottom: 0; }

/* ── Total line (simple, aligned right) ── */
.inv-total-row {
	display: flex;
	justify-content: flex-end;
	align-items: baseline;
	gap: 12mm;
	padding: 4mm 3mm 0 0;
	font-size: 10pt;
	letter-spacing: 0.05em;
}
.inv-total-label { color: #000; }
.inv-total-value {
	font-variant-numeric: tabular-nums;
	min-width: 28mm;
	text-align: right;
	color: #000;
}

.inv-tva-breakdown {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 1mm;
	padding: 2mm 3mm 0 0;
	font-size: 9pt;
	color: #4a4a50;
}
.inv-tva-breakdown .row {
	display: flex;
	gap: 12mm;
}
.inv-tva-breakdown .val {
	font-variant-numeric: tabular-nums;
	min-width: 28mm;
	text-align: right;
}

.inv-notes {
	margin-top: 8mm;
	font-size: 8.5pt;
	color: #444;
	white-space: pre-line;
	max-width: 120mm;
}

/* Indicateur "Suite page suivante" sur les pages non-finales */
.inv-continued {
	margin-top: 5mm;
	text-align: right;
	font-size: 9pt;
	color: var(--inv-accent, #c2185b);
	font-style: italic;
	font-weight: 500;
}

/* Numéro de page (visible uniquement si multi-pages) */
.inv-page-num {
	position: absolute;
	left: 33mm;
	right: 15mm;
	bottom: 10mm;
	text-align: center;
	font-size: 7.5pt;
	color: #888;
	letter-spacing: 0.05em;
}
.invoice-page-last .inv-page-num {
	bottom: calc(95mm + 4mm);
}

/* ═══════════════════════════════════════════════════════════
   QR-facture suisse (format ISO 20022)
   Hauteur fixe 105mm en bas de page.
   Structure visuelle conforme au standard Swiss Payments Council.
   ═══════════════════════════════════════════════════════════ */

.inv-qrbill {
	position: absolute;
	bottom: 0;
	left: 20mm; /* offset pour laisser respirer la bande FACTURE à gauche */
	right: 0;
	height: 95mm; /* 190/210 × 105mm pour préserver le ratio */
	border-top: 0.5pt dashed #000;
	display: grid;
	grid-template-columns: 62mm 1fr;
	font-family: var(--font-sans);
	font-size: 7pt;
	color: #000;
	background: #fff;
	z-index: 2;
}

/* QR-bill généré par la lib swissqrbill : SVG natif, on laisse parler */
.inv-qrbill-svg {
	display: block;
	border-top: 0;
	padding: 0;
	overflow: hidden;
}
.inv-qrbill-svg svg {
	width: 190mm;
	height: auto; /* préserve le ratio 210:105 → 95mm de haut */
	display: block;
}

/* État vide / erreur */
.inv-qrbill-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	background: #fafafa;
	border-top: 0.5pt dashed #aaa;
}
.qr-empty-inner {
	text-align: center;
	max-width: 80mm;
	color: #888;
}
.qr-empty-inner svg { color: #c8c8cd; margin-bottom: 4mm; }
.qr-empty-title {
	font-size: 10pt;
	font-weight: 600;
	color: #555;
	margin-bottom: 1.5mm;
}
.qr-empty-msg {
	font-size: 8.5pt;
	line-height: 1.4;
	color: #888;
}

/* ── Récépissé (62mm × 105mm) ── */
.qr-receipt {
	padding: 5mm 5mm 5mm 5mm;
	border-right: 0.5pt dashed #000;
	display: flex;
	flex-direction: column;
}
.qr-receipt-title {
	font-family: var(--font-sans);
	font-size: 11pt;
	font-weight: 700;
	margin: 0 0 3mm;
	letter-spacing: 0;
}

/* ── Section paiement (148mm × 105mm) ── */
.qr-payment {
	padding: 5mm 5mm 5mm 5mm;
	display: grid;
	grid-template-columns: 51mm 1fr;
	gap: 0 5mm;
}
.qr-payment-title {
	grid-column: 1 / -1;
	font-family: var(--font-sans);
	font-size: 11pt;
	font-weight: 700;
	margin: 0 0 3mm;
}
.qr-payment-left {
	display: flex;
	flex-direction: column;
}
.qr-payment-right {
	display: flex;
	flex-direction: column;
}

/* ── QR code placeholder ── */
.qr-code {
	width: 46mm;
	height: 46mm;
	background: #fff;
	border: 0.5pt solid #000;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 0 5mm;
	position: relative;
}
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-code-label {
	position: absolute;
	bottom: 0.5mm;
	left: 50%;
	transform: translateX(-50%);
	font-size: 5pt;
	background: #fff;
	padding: 0 1mm;
	white-space: nowrap;
}

/* ── Blocs d'infos QR ── */
.qr-section { margin-bottom: 3mm; }
.qr-section:last-child { margin-bottom: 0; }
.qr-label {
	font-size: 6pt;
	font-weight: 700;
	line-height: 1.2;
	margin-bottom: 0.5mm;
}
.qr-receipt .qr-label { font-size: 6pt; }
.qr-payment .qr-label { font-size: 8pt; }
.qr-value {
	font-size: 8pt;
	line-height: 1.25;
	font-weight: 400;
}
.qr-receipt .qr-value { font-size: 8pt; }
.qr-payment .qr-value { font-size: 10pt; }

/* ── Case "Payable par" avec coins imprimés ── */
.qr-box {
	position: relative;
	height: 14mm;
	margin-bottom: 2mm;
}
.qr-receipt .qr-box { height: 14mm; }
.qr-payment .qr-box { height: 18mm; }
.qr-box::before,
.qr-box::after,
.qr-box > i::before,
.qr-box > i::after {
	content: '';
	position: absolute;
	width: 2.5mm;
	height: 2.5mm;
	border: 0.4pt solid #000;
}
.qr-box::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.qr-box::after { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.qr-box > i { display: block; position: absolute; inset: 0; }
.qr-box > i::before { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.qr-box > i::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ── Monnaie + Montant (row) ── */
.qr-money-row {
	display: flex;
	gap: 5mm;
	margin-top: auto;
}
.qr-money-row .qr-section { margin-bottom: 0; flex-shrink: 0; }
.qr-money-row .qr-amount { flex: 1; }
.qr-receipt .qr-point {
	margin-top: 3mm;
	text-align: right;
	font-size: 6pt;
	font-weight: 700;
}

.qr-receipt-bottom {
	margin-top: auto;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 3mm;
}

/* ═══════════════════════════════════════════════════════════
   Wizard profil entreprise — onboarding multi-steps
   Style KYC moderne : une question à la fois, animations fluides
   ═══════════════════════════════════════════════════════════ */

.wizard {
	max-width: 620px;
	margin: 0 auto;
	padding-top: 1rem;
}

.wizard-progress {
	margin-bottom: 3.5rem;
}
.wizard-progress-track {
	height: 5px;
	background: var(--line);
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 0.65rem;
}
.wizard-progress-bar {
	height: 100%;
	background: linear-gradient(90deg, var(--pink) 0%, var(--pink-light) 100%);
	border-radius: 999px;
	transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
	width: 0%;
}
.wizard-progress-label {
	font-size: 0.8rem;
	color: var(--muted);
	font-weight: 600;
	text-align: center;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.wizard-viewport {
	position: relative;
	min-height: 540px;
	margin-bottom: 2.5rem;
}

.wizard-step {
	position: absolute;
	inset: 0;
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
}
.wizard-step.active {
	opacity: 1;
	transform: none;
	pointer-events: auto;
	transition-delay: 0.05s;
}

.wizard-step-inner {
	text-align: center;
}
.wizard-icon {
	width: 68px;
	height: 68px;
	border-radius: 20px;
	background: var(--pink-soft);
	color: var(--pink);
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 1.75rem;
	opacity: 0;
	transform: scale(0.75) rotate(-6deg);
	transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}
.wizard-step.active .wizard-icon {
	opacity: 1;
	transform: none;
}
.wizard-icon svg { width: 30px; height: 30px; }

.wizard-step h2 {
	font-family: var(--font-display);
	font-size: clamp(1.7rem, 3vw, 2.25rem);
	font-weight: 600;
	letter-spacing: -0.015em;
	margin: 0 0 0.85rem;
	line-height: 1.15;
	text-transform: none;
	color: var(--ink);
}
.wizard-subtitle {
	color: var(--muted);
	font-size: 1rem;
	max-width: 46ch;
	margin: 0 auto 2.5rem;
	line-height: 1.6;
}

.wizard-fields {
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
	max-width: 420px;
	margin: 0 auto;
	text-align: left;
}
.wizard-fields .form-field > span {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--ink-3);
	margin-bottom: 0.1rem;
}
.wizard-fields .form-field input,
.wizard-fields .form-field select {
	padding: 0.95rem 1.1rem;
	font-size: 1.02rem;
	border-radius: 12px;
	border-width: 1.5px;
}
.wizard-fields .form-row {
	display: grid;
	grid-template-columns: 90px 1fr;
	gap: 0.75rem;
}
.wizard-fields .form-row-prefs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

/* ── Step logo upload ── */
.wizard-logo {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.25rem;
	max-width: 420px;
	margin: 0 auto;
}
.wizard-logo-drop {
	width: 100%;
	max-width: 260px;
	aspect-ratio: 1;
	background: var(--bg);
	border: 2px dashed var(--line);
	border-radius: var(--radius-lg);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	cursor: pointer;
	overflow: hidden;
}
.wizard-logo-drop:hover {
	border-color: var(--pink);
	background: var(--pink-soft);
}
.wizard-logo-drop img {
	max-width: 90%;
	max-height: 90%;
	object-fit: contain;
}
.wizard-logo-drop .wizard-logo-empty {
	color: var(--muted);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
	font-size: 0.88rem;
	pointer-events: none;
}
.wizard-logo-drop .wizard-logo-empty svg {
	width: 40px;
	height: 40px;
	color: var(--pink);
	opacity: 0.55;
}

/* ── Step prefs (couleur) ── */
.wizard-color-row {
	display: flex;
	align-items: center;
	gap: 1rem;
}
.wizard-color-row input[type="color"] {
	width: 56px;
	height: 56px;
	padding: 4px;
	border-radius: 14px;
	cursor: pointer;
	border: 1.5px solid var(--line);
	background: #fff;
}
.wizard-color-row .wizard-color-info {
	flex: 1;
	font-size: 0.88rem;
	color: var(--muted);
}

/* ── Welcome & Done ── */
.wizard-step-welcome .wizard-icon,
.wizard-step-done .wizard-icon {
	width: 84px;
	height: 84px;
	border-radius: 24px;
}
.wizard-step-welcome .wizard-icon svg,
.wizard-step-done .wizard-icon svg {
	width: 38px;
	height: 38px;
}
.wizard-step-done .wizard-icon {
	background: #e8f9e8;
	color: #2d9d2d;
}
.wizard-features-mini {
	display: flex;
	justify-content: center;
	gap: 2rem;
	margin: 2rem auto 0;
	flex-wrap: wrap;
}
.wizard-feature-mini {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.88rem;
	color: var(--ink-3);
}
.wizard-feature-mini svg {
	width: 18px;
	height: 18px;
	color: var(--pink);
}

.wizard-done-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	margin-top: 2rem;
	flex-wrap: wrap;
}

.wizard-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}
.wizard-nav .btn-primary { min-width: 150px; }
.wizard-nav .wizard-skip {
	font-size: 0.88rem;
	color: var(--muted);
	font-weight: 500;
}
.wizard-nav .wizard-skip:hover { color: var(--ink-3); }
.wizard-nav.hide-back #wizBack { visibility: hidden; }
.wizard-nav.hide-skip #wizSkip { visibility: hidden; }
.wizard-nav.hide-next #wizNext { visibility: hidden; }

/* ── Responsive wizard ── */
@media (max-width: 620px) {
	.wizard-fields { max-width: 100%; }
	.wizard-fields .form-row-prefs { grid-template-columns: 1fr; }
	.wizard-nav { flex-wrap: wrap; }
	.wizard-step h2 { font-size: 1.6rem; }
}

/* ── Footer app ── */
.app-footer {
	border-top: 1px solid var(--line);
	background: #fff;
	padding: 2rem 0 2.5rem;
	margin-top: 4rem;
}
.app-footer-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 clamp(1rem, 3vw, 2rem);
	text-align: center;
}
.app-footer p { margin: 0.25rem 0; color: var(--muted); font-size: 0.88rem; }
.app-footer strong { color: var(--ink); }
.app-footer-note { font-size: 0.82rem; opacity: 0.8; }

/* ── Responsive ── */
@media (max-width: 1100px) {
	.editor-layout {
		grid-template-columns: 1fr;
	}
	.editor-preview { position: static; }
}

@media (max-width: 860px) {
	.app-nav {
		position: fixed;
		top: var(--header-h);
		left: 0;
		right: 0;
		flex-direction: column;
		background: #fff;
		border-bottom: 1px solid var(--line);
		padding: 1rem;
		gap: 0.25rem;
		align-items: stretch;
		transform: translateY(-100%);
		opacity: 0;
		pointer-events: none;
		transition: all 0.25s;
	}
	.app-nav.open {
		transform: translateY(0);
		opacity: 1;
		pointer-events: auto;
	}
	.app-nav a { padding: 0.85rem 1rem; border-radius: 8px; }
	.app-menu-toggle { display: flex; }
	.form-grid { grid-template-columns: 1fr; }
	.logo-uploader { flex-direction: column; align-items: flex-start; }
	.lines-header { display: none; }
	.line-row {
		grid-template-columns: 1fr 1fr;
		gap: 0.5rem;
		padding: 0.75rem;
		border: 1px solid var(--line);
		border-radius: 10px;
	}
	.line-row > *:first-child { grid-column: 1 / -1; }
	.history-item {
		grid-template-columns: 1fr 1fr;
		gap: 0.5rem;
	}
	.history-num { grid-column: 1 / -1; }
}
