*,
*::before,
*::after {
	box-sizing: border-box;
}
html {
	-webkit-text-size-adjust: 100%;
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	/* a form is never meant to be double-tap zoomed; pinch zoom stays available */
	touch-action: manipulation;
	font-size: 17px;
	line-height: 1.35;
	-webkit-font-smoothing: antialiased;
}
a {
	color: var(--accent);
}
a:hover {
	color: var(--accent-dark);
}
[hidden] {
	display: none !important;
}
/* focus rings only for keyboard users; a tap never leaves a ring behind */
:focus:not(:focus-visible) {
	outline: none;
}

.app {
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	max-width: var(--app-width);
	margin: 0 auto;
	background: var(--bg);
}

/* wider than a phone: the form sits as a column on a darker desk */
@media (min-width: 600px) and (pointer: fine) {
	body {
		background: var(--desk);
	}
	.app {
		box-shadow:
			0 0 0 1px var(--line),
			0 12px 40px rgba(31, 28, 24, 0.12);
	}
}

.header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px var(--page-pad);
	background: var(--brand);
	color: var(--brand-text);
}
.header__logo {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	object-fit: contain;
	border: 1.5px dashed #8a8378;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--brand-sub);
}
.header__title {
	font-family: var(--font-heading);
	font-size: 21px;
	font-weight: 700;
	line-height: 1;
}
.header__sub {
	font-size: 13px;
	color: var(--brand-sub);
	margin-top: 3px;
}
.header__actions {
	margin-left: auto;
	display: flex;
	gap: 8px;
	flex: 0 0 auto;
}
.header__button {
	width: 44px;
	height: 44px;
	border-radius: 8px;
	border: 1.5px solid var(--brand-sub);
	background: transparent;
	color: var(--brand-text);
	display: flex;
	align-items: center;
	justify-content: center;
}
.header__button.is-busy .icon {
	animation: spin 0.8s linear infinite;
}

.dialog {
	border: 0;
	border-radius: var(--radius-lg);
	padding: 24px 20px 20px;
	width: min(360px, calc(100% - 40px));
	background: var(--surface);
	color: var(--ink);
	font-size: 16px;
	line-height: 1.4;
}
.dialog::backdrop {
	background: rgba(31, 28, 24, 0.55);
}
.dialog__title {
	font-family: var(--font-heading);
	font-size: 20px;
	font-weight: 700;
	margin-bottom: 8px;
}
.dialog p {
	margin: 0 0 12px;
	color: var(--muted);
}
.dialog ol {
	margin: 0 0 20px;
	padding-left: 22px;
}
.dialog li {
	margin: 8px 0;
}
.dialog form .button {
	width: 100%;
}
.icon--inline {
	width: 18px;
	height: 18px;
	vertical-align: -3px;
}

.progress {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px var(--page-pad) 0;
}
.progress__bar {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 6px;
}
.progress__seg {
	height: 6px;
	border-radius: 3px;
	background: var(--line);
}
.progress__seg.is-on {
	background: var(--accent);
}
.progress__text {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	color: var(--muted);
}
.progress__text strong {
	color: var(--ink);
}

.step {
	display: flex;
	flex-direction: column;
	gap: var(--gap);
	padding: 24px var(--page-pad) 8px;
}
.step h2 {
	font-family: var(--font-heading);
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	margin: 0;
}
.hint {
	font-size: 13px;
	color: var(--muted);
}
.hint--center {
	text-align: center;
}

.footer {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 20px var(--page-pad) 32px;
	margin-top: auto;
}
/* inside a step (Büro page) the section already has the page padding and there is no page bottom;
   two classes so the notch padding for .footer further down does not win */
.footer.footer--inline {
	padding-left: 0;
	padding-right: 0;
	margin-top: 0;
}
.footer__row {
	display: flex;
	gap: 10px;
}

/* a compact header, so the summary and "Neue Meldung" fit on the first screen */
.done {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 14px;
	row-gap: 2px;
	align-items: center;
	padding: 20px var(--page-pad) 16px;
}
.done__check {
	grid-row: span 2;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--success);
	display: flex;
	align-items: center;
	justify-content: center;
}
.done__title {
	align-self: end;
	font-family: var(--font-heading);
	font-size: 22px;
	font-weight: 700;
	line-height: 1.1;
}
.done__text {
	align-self: start;
	font-size: 15px;
	color: var(--muted);
}

.summary {
	margin: 0 var(--page-pad);
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius-lg);
	overflow: hidden;
}
.summary--inline {
	/* inside a step the section already has the page padding */
	margin: 0;
}
.summary__head {
	padding: 16px 18px;
	background: var(--brand);
	color: var(--brand-text);
}
.summary__head strong {
	display: block;
	font-family: var(--font-heading);
	font-size: 19px;
	line-height: 1.1;
}
.summary__head span {
	font-size: 14px;
	color: var(--brand-sub);
}
.summary__row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 18px;
	border-bottom: 1px solid #ece7df;
}
.summary__row:last-child {
	border-bottom: 0;
}
.summary__row span:first-child {
	font-size: 14px;
	color: var(--muted);
}
.summary__row span:last-child {
	font-weight: 600;
	text-align: right;
}
.summary__row .big {
	font-family: var(--font-heading);
	font-size: 20px;
	font-weight: 700;
	color: var(--accent);
}
.summary__row--stack {
	flex-direction: column;
	gap: 4px;
}
.summary__row--stack span:last-child {
	text-align: left;
	font-weight: 500;
}

.banner {
	margin: 0 var(--page-pad);
	padding: 12px 16px;
	border-radius: var(--radius);
	background: #fbe9e7;
	color: var(--danger);
	font-size: 15px;
}

.outbox {
	margin: 16px var(--page-pad) 0;
	padding: 12px 16px;
	border-radius: var(--radius);
	background: var(--accent-soft);
	border: 1.5px solid var(--accent);
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.outbox__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-weight: 600;
	color: var(--accent-dark);
}
.outbox__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 14px;
	color: var(--ink);
}
.outbox__item small {
	display: block;
	color: var(--danger);
}
.outbox .link-button {
	min-height: 36px;
}
.outbox__hint {
	font-size: 13px;
	font-weight: 400;
	color: var(--muted);
}

/* short success note after a waiting entry went out on its own */
.toast {
	position: fixed;
	left: 50%;
	/* under the header, clear of the footer buttons */
	top: calc(76px + env(safe-area-inset-top, 0px));
	transform: translateX(-50%);
	white-space: nowrap;
	z-index: 20;
	max-width: calc(100% - 2 * var(--page-pad));
	padding: 12px 18px;
	border-radius: 999px;
	background: var(--success);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.done--queued .done__check {
	background: var(--accent);
}

/* Notched phones in landscape: keep content out of the camera area and above the home indicator. */
.header,
.progress,
.banner,
.outbox,
.step,
.footer {
	padding-left: max(var(--page-pad), env(safe-area-inset-left));
	padding-right: max(var(--page-pad), env(safe-area-inset-right));
}
/* the confirmation's children bring their own page padding; this only keeps them off a notch */
#step-done {
	padding-left: env(safe-area-inset-left);
	padding-right: env(safe-area-inset-right);
}
.footer {
	padding-bottom: max(32px, env(safe-area-inset-bottom));
}
