.cfdi-preview {
	position: relative;
	z-index: 1;
	color: var(--invoice-text, #27312b);
	font-family: var(--invoice-font, "Manrope", "Helvetica Neue", Arial, sans-serif);
}

.cfdi-preview__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
	padding-bottom: 1.65rem;
	border-bottom: 0.14rem solid var(--invoice-dark, var(--editor-brand-dark));
}

.cfdi-preview__issuer-heading {
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 0.9rem;
}

.cfdi-preview__issuer-heading > span:last-child {
	min-width: 0;
}

.cfdi-preview__issuer-visual {
	width: 3.6rem;
	height: 3.6rem;
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	overflow: hidden;
	border-radius: 1.05rem 0.25rem 1.05rem 0.25rem;
	background: var(--invoice-dark, var(--editor-brand-dark));
	transition: border-radius 160ms ease;
}

.cfdi-preview__issuer-mark {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	color: #fff;
	font-size: 1.1rem;
	font-weight: 800;
}

.cfdi-preview__issuer-logo {
	width: 100%;
	height: 100%;
	display: block;
	padding: 0.25rem;
	background: #fff;
	object-fit: contain;
}

.editor-page[data-has-logo="true"][data-logo-size="small"] .cfdi-preview__issuer-visual {
	width: 2.9rem;
	height: 2.9rem;
}

.editor-page[data-has-logo="true"][data-logo-size="large"] .cfdi-preview__issuer-visual {
	width: 4.35rem;
	height: 4.35rem;
}

.editor-page[data-logo-alignment="left"] .cfdi-preview__issuer-logo {
	object-position: left center;
}

.editor-page[data-logo-alignment="center"] .cfdi-preview__issuer-logo {
	object-position: center;
}

.editor-page[data-has-logo="true"][data-logo-alignment="center"] .cfdi-preview__issuer-heading {
	flex-direction: column;
	align-items: center;
	gap: 0.55rem;
	text-align: center;
}

.cfdi-preview__issuer-heading h3 {
	max-width: 24rem;
	margin: 0;
	overflow-wrap: anywhere;
	color: var(--invoice-dark, var(--editor-brand-dark));
	font-size: 0.95rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	line-height: 1.3;
}

.cfdi-preview__issuer-heading small {
	display: block;
	margin-top: 0.3rem;
	color: #7c877f;
	font-size: 0.58rem;
}

.cfdi-preview__identity {
	flex: 0 0 auto;
	text-align: right;
}

.cfdi-preview__identity > span {
	display: block;
	color: var(--invoice-accent, var(--editor-brand));
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.18em;
}

.cfdi-preview__identity strong {
	max-width: 15rem;
	display: block;
	margin: 0.12rem 0;
	overflow-wrap: anywhere;
	color: var(--invoice-dark, var(--editor-brand-dark));
	font-size: 1.7rem;
	letter-spacing: -0.045em;
}

.cfdi-preview__identity small {
	display: block;
	color: #859087;
	font-size: 0.52rem;
	font-weight: 700;
	letter-spacing: 0.08em;
}

.cfdi-preview__identity .cfdi-preview__effect-label {
	margin-top: 0.35rem;
	font-size: 0.45rem;
	letter-spacing: 0.04em;
	text-transform: none;
}

.cfdi-preview__effect {
	display: block;
	margin: 0.08rem 0 0.15rem;
	color: var(--invoice-dark, var(--editor-brand-dark));
	font-size: 0.78rem;
	line-height: 1.2;
}

.cfdi-preview__parties {
	display: grid;
	grid-template-columns: 1.15fr 1.15fr 0.85fr;
	gap: 1.6rem;
	padding: 1.55rem 0;
}

.cfdi-preview h4 {
	margin: 0 0 0.45rem;
	color: var(--invoice-accent, var(--editor-brand));
	font-size: 0.48rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.cfdi-preview__parties strong {
	display: block;
	margin-bottom: 0.4rem;
	overflow-wrap: anywhere;
	color: var(--invoice-dark, var(--editor-brand-dark));
	font-size: 0.63rem;
	line-height: 1.35;
}

.cfdi-preview dl,
.cfdi-preview dd {
	margin: 0;
}

.cfdi-preview dl > div {
	margin-top: 0.32rem;
}

.cfdi-preview dt {
	color: #929b95;
	font-size: 0.43rem;
	font-weight: 600;
}

.cfdi-preview dd {
	overflow-wrap: anywhere;
	color: #606c64;
	font-size: 0.53rem;
	line-height: 1.4;
}

.cfdi-preview__document-data {
	padding-left: 1rem;
	border-left: 1px solid var(--invoice-border, #e1e7e3);
}

.cfdi-preview__table-wrap {
	overflow: hidden;
	border-radius: 0.35rem;
}

.cfdi-preview__concepts table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
}

.cfdi-preview__concepts thead {
	background: var(--invoice-dark, var(--editor-brand-dark));
	color: #fff;
}

.cfdi-preview__concepts th {
	padding: 0.62rem 0.55rem;
	font-size: 0.43rem;
	letter-spacing: 0.08em;
	text-align: right;
	text-transform: uppercase;
}

.cfdi-preview__concepts th:first-child {
	width: 45%;
	text-align: left;
}

.cfdi-preview__concepts th:nth-child(2) {
	width: 10%;
}

.cfdi-preview__concepts th:nth-child(3),
.cfdi-preview__concepts th:nth-child(4),
.cfdi-preview__concepts th:nth-child(5) {
	width: 15%;
}

.cfdi-preview__concepts td {
	padding: 0.78rem 0.55rem;
	border-bottom: 1px solid var(--invoice-border, #e6eae7);
	overflow-wrap: anywhere;
	color: #3d4741;
	font-size: 0.5rem;
	text-align: right;
	vertical-align: top;
}

.cfdi-preview__concepts td:first-child {
	text-align: left;
}

.cfdi-preview__concepts td:nth-child(n + 2) {
	overflow-wrap: normal;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.cfdi-preview__concepts td strong,
.cfdi-preview__concepts td span,
.cfdi-preview__concepts td small {
	display: block;
}

.cfdi-preview__concepts td strong {
	color: #2c3730;
	font-size: 0.57rem;
	line-height: 1.45;
}

.cfdi-preview__concepts td span {
	margin-top: 0.25rem;
	color: #737e76;
	font-size: 0.44rem;
}

.cfdi-preview__concepts td small {
	margin-top: 0.35rem;
	color: #8d9690;
	font-size: 0.4rem;
	line-height: 1.45;
}

.cfdi-preview__summary {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 16.5rem;
	gap: 2.8rem;
	padding: 1.45rem 0 1.7rem;
}

.cfdi-preview__payment {
	align-self: end;
	padding: 0.85rem 1rem;
	border-left: 0.2rem solid var(--invoice-accent, var(--editor-brand));
	background: color-mix(in srgb, var(--invoice-accent, var(--editor-brand)) 6%, #fff);
}

.cfdi-preview__payment dl {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.35rem 1rem;
}

.cfdi-preview__payment p {
	margin: 0;
	color: #6f7972;
	font-size: 0.5rem;
}

.cfdi-preview__totals > div:not(.cfdi-preview__tax-rows),
.cfdi-preview__tax-rows > div {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.32rem 0;
	color: #647068;
	font-size: 0.52rem;
}

.cfdi-preview__totals > div:not(.cfdi-preview__tax-rows) strong,
.cfdi-preview__tax-rows strong {
	color: #313b35;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.cfdi-preview__tax-rows span {
	min-width: 0;
	overflow-wrap: anywhere;
}

.cfdi-preview__totals .cfdi-preview__grand-total {
	align-items: center;
	margin-top: 0.35rem;
	padding-top: 0.65rem;
	border-top: 0.14rem solid var(--invoice-dark, var(--editor-brand-dark));
	color: var(--invoice-dark, var(--editor-brand-dark));
	font-size: 0.76rem;
	font-weight: 800;
}

.cfdi-preview__grand-total strong {
	font-size: 1rem;
}

.cfdi-preview__fiscal {
	position: relative;
	z-index: 2;
	isolation: isolate;
	display: grid;
	grid-template-columns: 6.5rem minmax(0, 1fr);
	gap: 1rem 1.2rem;
	padding: 1rem 1.15rem;
	border: 1px dashed #bfcac3;
	border-radius: 0.55rem;
	background: #fafcfb;
	color: #27312b;
	font-family: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
}

.cfdi-preview__qr {
	min-height: 6.5rem;
	display: grid;
	place-items: center;
	border: 1px solid #dbe1dd;
	background: #fff;
	padding: 0.3rem;
}

.cfdi-preview__qr img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 6.5rem;
	background: #fff;
	image-rendering: pixelated;
}

.cfdi-preview__fiscal-data dl {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.35rem 1rem;
}

.cfdi-preview__fiscal-data p {
	margin: 0.55rem 0 0;
	overflow-wrap: anywhere;
	color: #7d8881;
	font: 0.42rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.cfdi-preview__fiscal-data p strong,
.cfdi-preview__fiscal-data p span {
	display: block;
}

.cfdi-preview__fiscal-data p span {
	word-break: break-all;
}

.cfdi-preview__fiscal-data p strong {
	margin-bottom: 0.12rem;
	color: #59655e;
	font-family: system-ui, sans-serif;
}

.cfdi-preview__footer {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: 1rem;
	margin-top: 0;
	padding-top: 0.75rem;
	border-top: 1px solid var(--invoice-border, #e1e6e3);
	color: #88928b;
	font-size: 0.42rem;
}

.cfdi-preview__representation-notice {
	margin: 1rem 0 0.4rem;
	color: #7d8881;
	font-size: 0.45rem;
}

.cfdi-preview__website {
	text-align: center;
}

.cfdi-preview__page-number {
	justify-self: end;
	white-space: nowrap;
}

.cfdi-preview__custom-footer {
	margin: 1rem 0 0;
	padding: 0.7rem 0.9rem;
	border-left: 0.18rem solid var(--invoice-accent);
	background: var(--invoice-soft);
	color: var(--invoice-text);
	font-size: 0.52rem;
	line-height: 1.55;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}

.editor-page[data-layout="compact"] .cfdi-preview__header {
	padding-bottom: 1.05rem;
}

.editor-page[data-layout="compact"] .cfdi-preview__parties {
	gap: 1.2rem;
	padding: 1rem 0;
}

.editor-page[data-layout="compact"] .cfdi-preview__concepts th {
	padding-block: 0.48rem;
}

.editor-page[data-layout="compact"] .cfdi-preview__concepts td {
	padding-block: 0.52rem;
}

.editor-page[data-layout="compact"] .cfdi-preview__summary {
	gap: 2rem;
	padding: 0.95rem 0 1.2rem;
}

.editor-page[data-layout="compact"] .cfdi-preview__payment {
	padding-block: 0.65rem;
}

.cfdi-preview__footer span:last-child {
	overflow-wrap: anywhere;
	text-align: right;
}

.editor-page[data-template="executive"] .cfdi-preview__issuer-visual {
	border: 1px solid #dce4ee;
	border-radius: 0.35rem;
}

.editor-page[data-template="executive"] .cfdi-preview__header {
	border-bottom-width: 0.2rem;
}

.editor-page[data-template="editorial"] .cfdi-preview__header {
	align-items: flex-start;
	border-top: 0.08rem solid var(--invoice-dark);
	border-bottom-width: 0.08rem;
	padding-top: 0.8rem;
}

.editor-page[data-template="editorial"] .cfdi-preview__issuer-visual {
	border-radius: 50%;
}

.editor-page[data-template="editorial"] .cfdi-preview__issuer-heading h3,
.editor-page[data-template="editorial"] .cfdi-preview__identity strong {
	font-family: var(--invoice-font);
	letter-spacing: 0;
}

.editor-page[data-template="editorial"] .cfdi-preview__concepts thead {
	border-top: 0.14rem solid var(--invoice-dark);
	border-bottom: 0.06rem solid var(--invoice-dark);
	background: transparent;
	color: var(--invoice-dark);
}

.editor-page[data-footer="formal"] .cfdi-preview__footer {
	border-top-color: var(--invoice-dark);
	color: #657184;
}

.editor-page[data-footer="editorial"] .cfdi-preview__footer {
	border-top-color: var(--invoice-accent);
	text-align: center;
}

.editor-page[data-footer="editorial"] .cfdi-preview__footer span:last-child {
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.cfdi-preview__issuer-visual {
		transition: none;
	}
}
