/* eInvoiceTool viewer – uses the theme's colour variables when present, with fallbacks. */

.eitv {
	--eitv-accent: var(--accent, #1f4e78);
	--eitv-accent-hover: var(--accent-hover, #163a5a);
	--eitv-text: var(--contrast, #1f2933);
	--eitv-muted: var(--contrast-2, #5f6b7a);
	--eitv-line: var(--base, #e8edf3);
	--eitv-soft: var(--base-2, #f4f7fa);
	--eitv-bg: var(--base-3, #ffffff);
	--eitv-ok: var(--success, #2e7d32);
	--eitv-error: #b42318;
	--eitv-radius: 10px;
	color: var(--eitv-text);
	font-size: 16px;
}

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

/* ---------- Drop zone ---------- */

.eitv-drop {
	border: 2px dashed #c3cad4;
	border-radius: var(--eitv-radius);
	background: var(--eitv-soft);
	padding: clamp(1.75rem, 6vw, 3.25rem) 1rem;
	text-align: center;
	transition: border-color .15s ease, background-color .15s ease;
}

.eitv-drop.is-over {
	border-color: var(--eitv-accent);
	background: #eaf1f8;
}

.eitv-drop__icon {
	width: 48px;
	height: 48px;
	color: var(--eitv-accent);
	margin-bottom: .5rem;
}

.eitv-drop__title {
	font-size: 1.2rem;
	font-weight: 700;
	margin: 0 0 .25rem;
}

.eitv-drop__hint,
.eitv-drop__formats {
	color: var(--eitv-muted);
	margin: 0;
}

.eitv-drop__formats {
	font-size: .85rem;
	margin-top: 1rem;
}

.eitv-file {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.eitv-file:focus-visible + .eitv-drop__formats,
.eitv-btn:focus-visible {
	outline: 3px solid rgba(31, 78, 120, .45);
	outline-offset: 2px;
}

.eitv-btn {
	display: inline-block;
	margin-top: 1rem;
	padding: .7em 1.35em;
	border: 2px solid var(--eitv-accent);
	border-radius: 6px;
	background: var(--eitv-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
}

.eitv-btn:hover,
.eitv-btn:focus {
	background: var(--eitv-accent-hover);
	border-color: var(--eitv-accent-hover);
	color: #fff;
}

.eitv-btn--ghost {
	background: transparent;
	color: var(--eitv-accent);
}

.eitv-btn--ghost:hover,
.eitv-btn--ghost:focus {
	background: var(--eitv-soft);
	color: var(--eitv-accent-hover);
}

.eitv-status:empty {
	display: none;
}

.eitv-status {
	margin-top: 1rem;
	padding: .8rem 1rem;
	border-radius: 6px;
	background: var(--eitv-soft);
	color: var(--eitv-muted);
}

.eitv-status.is-error,
.eitv-error {
	background: #fef3f2;
	color: var(--eitv-error);
	border-left: 4px solid var(--eitv-error);
}

.eitv-report {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
}

.eitv-report-row {
	margin: .75rem 0 0;
	font-size: .875rem;
	text-align: right;
	color: var(--eitv-muted);
}

/* ---------- Toolbar ---------- */

.eitv-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .75rem 1rem;
	margin-bottom: 1.25rem;
}

.eitv-toolbar__info {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4rem .75rem;
}

.eitv-toolbar__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
}

.eitv-toolbar__actions .eitv-btn {
	margin: 0;
	padding: .55em 1em;
	font-size: .92rem;
}

.eitv-badge {
	display: inline-block;
	padding: .25em .7em;
	border-radius: 999px;
	background: #eaf1f8;
	color: var(--eitv-accent);
	font-size: .85rem;
	font-weight: 700;
}

.eitv-privacy {
	color: var(--eitv-ok);
	font-size: .85rem;
}

/* ---------- Invoice ---------- */

.eitv-invoice {
	background: var(--eitv-bg);
	border: 1px solid var(--eitv-line);
	border-radius: var(--eitv-radius);
	padding: clamp(1rem, 3.5vw, 2.25rem);
	font-size: .95rem;
	line-height: 1.5;
}

.eitv-invoice p {
	margin: 0;
}

.eitv-inv-head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 1rem 2rem;
	padding-bottom: 1.25rem;
	border-bottom: 2px solid var(--eitv-text);
	margin-bottom: 1.5rem;
}

.eitv-inv-title {
	font-size: 1.6rem;
	margin: 0;
	line-height: 1.2;
}

.eitv-inv-title:focus {
	outline: none;
}

.eitv-inv-number {
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--eitv-muted);
	margin-top: .2rem !important;
	word-break: break-all;
}

.eitv-h {
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--eitv-muted);
	margin: 0 0 .5rem;
}

.eitv-muted {
	color: var(--eitv-muted);
}

.eitv-dl {
	margin: 0;
	display: grid;
	gap: .2rem;
}

.eitv-dl > div {
	display: grid;
	grid-template-columns: minmax(8rem, max-content) 1fr;
	gap: .75rem;
}

.eitv-dl dt {
	color: var(--eitv-muted);
	font-weight: 400;
}

.eitv-dl dd {
	margin: 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.eitv-dl--compact {
	margin-top: .5rem;
	font-size: .88rem;
}

.eitv-dl--compact > div {
	grid-template-columns: minmax(6rem, max-content) 1fr;
}

.eitv-dl--compact dd {
	font-weight: 500;
}

.eitv-dl--meta > div {
	grid-template-columns: max-content max-content;
	justify-content: end;
}

.eitv-dl--refs {
	background: var(--eitv-soft);
	border-radius: 6px;
	padding: .75rem 1rem;
	margin-bottom: 1.25rem;
}

.eitv-parties {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1.25rem 2rem;
	margin-bottom: 1.5rem;
}

.eitv-party__name {
	font-weight: 700;
	font-size: 1.02rem;
}

.eitv-party__addr {
	margin-top: .15rem !important;
}

.eitv-flags {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
}

.eitv-flags li {
	margin: 0;
	padding: .2em .65em;
	border: 1px solid var(--eitv-accent);
	border-radius: 999px;
	color: var(--eitv-accent);
	font-size: .82rem;
	font-weight: 600;
}

/* Line items */

.eitv-table-wrap {
	overflow-x: auto;
	margin-bottom: 1.5rem;
}

.eitv-lines,
.eitv-vat-table {
	width: 100%;
	border: 0;
	border-collapse: collapse;
	margin: 0;
	font-size: .9rem;
}

/* Themes often draw full cell borders; the invoice uses horizontal rules only. */
.eitv .eitv-lines th,
.eitv .eitv-lines td,
.eitv .eitv-vat-table th,
.eitv .eitv-vat-table td {
	border-left: 0;
	border-right: 0;
	border-top: 0;
}

.eitv-lines th,
.eitv-vat-table th {
	text-align: left;
	font-size: .78rem;
	font-weight: 700;
	color: var(--eitv-muted);
	border-bottom: 2px solid var(--eitv-line);
	padding: .5rem .5rem;
	white-space: nowrap;
}

.eitv-lines td,
.eitv-vat-table td {
	border: 0;
	border-bottom: 1px solid var(--eitv-line);
	padding: .6rem .5rem;
	vertical-align: top;
}

.eitv-num {
	text-align: right !important;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.eitv-c-pos {
	width: 2.5rem;
	color: var(--eitv-muted);
}

.eitv-line-name {
	font-weight: 600;
}

.eitv-line-sub {
	display: block;
	color: var(--eitv-muted);
	font-size: .84rem;
}

.eitv-tag {
	font-size: .75rem;
	padding: .05em .45em;
	border-radius: 4px;
	background: #fff4e5;
	color: #8a4b00;
}

tr.is-before td {
	color: var(--eitv-muted);
}

/* VAT summary and totals */

.eitv-sums {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr);
	gap: 1.5rem 2.5rem;
	align-items: start;
	margin-bottom: 1.5rem;
}

.eitv-totals {
	grid-column: 2;
}

.eitv-vat + .eitv-totals {
	grid-column: auto;
}

.eitv-dl--totals > div {
	grid-template-columns: 1fr max-content;
	padding: .2rem 0;
}

.eitv-dl--totals dd {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.eitv-due {
	margin-top: .4rem;
	padding: .65rem .85rem !important;
	background: var(--eitv-text);
	color: #fff;
	border-radius: 6px;
	font-size: 1.08rem;
}

.eitv-due dt {
	color: #fff !important;
	font-weight: 600 !important;
}

.eitv-block {
	margin-bottom: 1.25rem;
}

.eitv-payment .eitv-dl {
	background: var(--eitv-soft);
	border-radius: 6px;
	padding: .75rem 1rem;
}

.eitv-note {
	white-space: pre-line;
	margin-bottom: .4rem !important;
}

.eitv-inv-foot {
	margin-top: 1.5rem;
	padding-top: .75rem;
	border-top: 1px solid var(--eitv-line);
	color: var(--eitv-muted);
	font-size: .78rem;
}

/* XML source */

.eitv-source {
	margin-top: 1rem;
}

.eitv-source summary {
	cursor: pointer;
	color: var(--eitv-accent);
	font-weight: 600;
	font-size: .92rem;
}

.eitv-source pre {
	max-height: 420px;
	overflow: auto;
	margin-top: .75rem;
	padding: 1rem;
	background: #1f2933;
	color: #e8edf3;
	border-radius: 6px;
	font-size: .78rem;
	line-height: 1.5;
	white-space: pre;
}

/* ---------- Small screens: line items as cards ---------- */

@media (max-width: 640px) {
	.eitv-dl--meta > div {
		justify-content: start;
	}

	.eitv-sums {
		grid-template-columns: 1fr;
	}

	.eitv-totals {
		grid-column: auto;
	}

	.eitv-lines thead {
		display: none;
	}

	.eitv-lines,
	.eitv-lines tbody,
	.eitv-lines tr,
	.eitv-lines td {
		display: block;
		width: 100%;
	}

	.eitv-lines tr {
		border-bottom: 1px solid var(--eitv-line);
		padding: .6rem 0;
	}

	.eitv-lines td {
		border: 0;
		padding: .1rem 0;
		display: flex;
		justify-content: space-between;
		gap: 1rem;
		text-align: right;
	}

	.eitv-lines td::before {
		content: attr(data-label);
		color: var(--eitv-muted);
		font-size: .84rem;
		text-align: left;
	}

	.eitv-lines td.eitv-c-desc {
		display: block;
		text-align: left;
		padding-bottom: .3rem;
	}

	.eitv-lines td.eitv-c-desc::before,
	.eitv-lines td.eitv-c-pos {
		display: none;
	}

	.eitv-lines td:empty {
		display: none;
	}
}

/* ---------- Print: only the invoice ---------- */

@media print {
	body.eitv-printing * {
		visibility: hidden !important;
	}

	body.eitv-printing .eitv-print-target .eitv-invoice,
	body.eitv-printing .eitv-print-target .eitv-invoice * {
		visibility: visible !important;
	}

	body.eitv-printing .eitv-print-target .eitv-invoice {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		border: 0;
		padding: 0;
		font-size: 10pt;
	}

	body.eitv-printing .eitv-due {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.eitv-lines tr {
		break-inside: avoid;
	}
}
