/* Oberflaeche: schlicht, auch auf Tablets bedienbar (grosse Eingabefelder). */

:root {
	--ink: #16202c;
	--muted: #5d6b7a;
	--line: #d6dde5;
	--bg: #f4f6f8;
	--accent: #1f5f8b;
	--ok-bg: #e8f5ec;
	--ok-line: #2e7d4f;
	--bad-bg: #fdeced;
	--bad-line: #b3261e;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
	background: #fff;
	border-bottom: 1px solid var(--line);
	padding: 1rem 1.25rem;
}

.topbar h1 {
	margin: 0;
	font-size: 1.3rem;
}

.subtitle {
	margin: 0.25rem 0 0;
	color: var(--muted);
	font-size: 0.95rem;
}

main {
	max-width: 1100px;
	margin: 0 auto;
	padding: 1.25rem;
}

footer {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 1.25rem 2rem;
	color: var(--muted);
	font-size: 0.85rem;
}

fieldset,
.card {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 1rem 1.25rem 1.25rem;
	margin: 0 0 1.25rem;
}

legend,
.card h2 {
	font-size: 1.05rem;
	font-weight: 600;
	padding: 0 0.4rem;
	margin: 0;
}

.card h2 {
	padding: 0;
	margin-bottom: 0.75rem;
}

.grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.85rem;
}

.grid .span2 {
	grid-column: span 2;
}

.grid .span4 {
	grid-column: span 4;
}

label {
	display: block;
	font-size: 0.9rem;
	color: var(--muted);
}

label small {
	display: block;
	font-size: 0.78rem;
	color: var(--muted);
	margin-top: 0.15rem;
}

input,
select,
textarea {
	width: 100%;
	margin-top: 0.25rem;
	padding: 0.6rem 0.65rem;
	font: inherit;
	font-size: 0.95rem;
	color: var(--ink);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 6px;
	min-height: 2.6rem;
}

input.short {
	max-width: 11rem;
}

input:focus,
select:focus,
textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
	border-color: var(--accent);
}

table {
	width: 100%;
	border-collapse: collapse;
}

table.items th,
table.items td,
table.amounts th,
table.amounts td,
table.checks th,
table.checks td {
	text-align: left;
	padding: 0.5rem 0.5rem 0.5rem 0;
	border-bottom: 1px solid var(--line);
	vertical-align: top;
}

table.items thead th,
table.amounts thead th,
table.checks thead th {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--muted);
}

.num {
	text-align: right;
}

table.items .pos {
	width: 3rem;
	padding-top: 1.1rem;
	color: var(--muted);
}

table.items input + input {
	margin-top: 0.35rem;
}

table.amounts td small,
table.checks td small {
	display: block;
	color: var(--muted);
	font-size: 0.8rem;
}

table.amounts tfoot th {
	text-align: right;
	font-weight: 500;
}

table.amounts tfoot tr.total th,
table.amounts tfoot tr.total td {
	font-weight: 700;
	font-size: 1.05rem;
}

table.checks tr.bad td {
	background: var(--bad-bg);
}

button,
.actions a {
	font: inherit;
	border-radius: 6px;
	cursor: pointer;
	padding: 0.7rem 1.1rem;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink);
	text-decoration: none;
	display: inline-block;
	min-height: 2.75rem;
}

button.primary,
.actions a.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	font-weight: 600;
}

button.link {
	border: none;
	background: none;
	color: var(--accent);
	padding: 0.4rem 0;
	text-decoration: underline;
	min-height: 0;
}

.actions {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.hint {
	color: var(--muted);
	font-size: 0.85rem;
}

.notice {
	background: var(--bad-bg);
	border: 1px solid var(--bad-line);
	border-radius: 8px;
	padding: 0.85rem 1rem;
	margin-bottom: 1.25rem;
}

.notice ul {
	margin: 0.5rem 0 0;
	padding-left: 1.2rem;
}

.status {
	border-radius: 8px;
	padding: 0.85rem 1rem;
	margin-bottom: 1.25rem;
	border: 1px solid var(--line);
	background: #fff;
}

.status.ok {
	background: var(--ok-bg);
	border-color: var(--ok-line);
}

.status.bad {
	background: var(--bad-bg);
	border-color: var(--bad-line);
}

.status p {
	margin: 0 0 0.5rem;
}

.statuslist {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin: 0;
	padding: 0;
	font-size: 0.9rem;
	color: var(--muted);
}

.tabs {
	display: flex;
	gap: 0.4rem;
	margin-bottom: -1px;
	flex-wrap: wrap;
}

.tab {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	background: #eef1f4;
}

.tab.active {
	background: #fff;
	border-bottom-color: #fff;
	font-weight: 600;
}

.panel.hidden {
	display: none;
}

.pdfview {
	width: 100%;
	height: 75vh;
	min-height: 480px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
}

pre.code {
	background: #111c26;
	color: #e6edf3;
	padding: 0.9rem;
	border-radius: 6px;
	overflow: auto;
	max-height: 70vh;
	font-size: 0.82rem;
	line-height: 1.45;
	white-space: pre;
}

details summary {
	cursor: pointer;
	margin-top: 0.75rem;
	color: var(--accent);
}

@media (max-width: 820px) {
	.grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.grid .span4 {
		grid-column: span 2;
	}

	table.items,
	table.items thead,
	table.items tbody,
	table.items tr,
	table.items td,
	table.items th {
		display: block;
	}

	table.items thead {
		display: none;
	}

	table.items tr {
		border-bottom: 2px solid var(--line);
		padding: 0.6rem 0;
	}

	table.items td {
		border: none;
		padding: 0.2rem 0;
		text-align: left;
	}

	input.short {
		max-width: none;
	}
}

/* Prüfübersicht auf der Ergebnisseite */
.checklist {
	list-style: none;
	margin: 0.75rem 0 0;
	padding: 0;
	display: grid;
	gap: 0.4rem;
}

.checklist li {
	display: flex;
	gap: 0.6rem;
	align-items: baseline;
	font-size: 0.92rem;
}

.checklist .mark {
	font-weight: 700;
	width: 1.1rem;
	flex: none;
	text-align: center;
}

.checklist li.pass .mark {
	color: var(--ok-line);
}

.checklist li.fail .mark {
	color: var(--bad-line);
}

.counts {
	margin: 0.85rem 0 0;
	font-size: 0.88rem;
	color: var(--muted);
}

table.checks td strong {
	display: block;
}

/* Steuerzelle in der Positionstabelle */
table.items .taxcell {
	min-width: 16rem;
}

table.items .taxcell select + select,
table.items .taxcell select + input,
table.items .taxcell .tax-reason-text {
	margin-top: 0.35rem;
}

table.items .taxcell .tax-reason.hidden,
table.items .taxcell .tax-reason-text.hidden {
	display: none;
}

/* Rabattzelle und Ankreuzfeld */
table.items .discountcell {
	min-width: 9rem;
}

table.items .discountcell select,
table.items .discountcell input + input {
	margin-top: 0.35rem;
}

.check {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.5rem;
	color: var(--ink);
	font-size: 0.9rem;
}

.check input[type="checkbox"] {
	width: auto;
	min-height: 0;
	margin: 0;
}

label.hidden {
	display: none;
}
