/*
 * Design-System des Portals.
 *
 * Wird von allen Frontends eingebunden und über /assets/shared/portal.css
 * ausgeliefert. Farben, Abstände und Rundungen liegen als Custom Properties
 * vor; die Akzentfarbe setzt das Base-System zur Laufzeit aus der
 * Modulkonfiguration.
 */

/* ---------- Tokens ---------- */

:root {
	--accent: #2f6df6;
	--accent-hover: #2559d0;
	--accent-soft: rgba(47, 109, 246, 0.12);
	--accent-contrast: #ffffff;

	--bg: #f5f6f8;
	--surface: #ffffff;
	--surface-2: #fafbfc;
	--surface-hover: #f1f3f6;
	--border: #e2e5ea;
	--border-strong: #cdd2da;

	--text: #16181d;
	--text-muted: #5f6673;
	--text-subtle: #8b929e;

	--success: #17864a;
	--success-soft: rgba(23, 134, 74, 0.12);
	--warning: #a76800;
	--warning-soft: rgba(167, 104, 0, 0.12);
	--danger: #c62b3c;
	--danger-soft: rgba(198, 43, 60, 0.12);
	--info: #0d6f9c;
	--info-soft: rgba(13, 111, 156, 0.12);

	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 16px;

	--shadow-sm: 0 1px 2px rgba(16, 20, 30, 0.06);
	--shadow: 0 4px 16px rgba(16, 20, 30, 0.08);
	--shadow-lg: 0 16px 48px rgba(16, 20, 30, 0.16);

	--sidebar-width: 248px;
	--header-height: 60px;

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
		Arial, "Noto Sans", sans-serif;
	--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1115;
		--surface: #171a20;
		--surface-2: #1c2027;
		--surface-hover: #22262e;
		--border: #2a2f38;
		--border-strong: #3a4049;

		--text: #eef0f4;
		--text-muted: #a6adba;
		--text-subtle: #79808d;

		--accent-soft: rgba(88, 142, 255, 0.18);
		--accent: #588eff;
		--accent-hover: #7ba5ff;

		--success: #4ac07d;
		--success-soft: rgba(74, 192, 125, 0.16);
		--warning: #e0a34a;
		--warning-soft: rgba(224, 163, 74, 0.16);
		--danger: #ff6b7d;
		--danger-soft: rgba(255, 107, 125, 0.16);
		--info: #56b6e0;
		--info-soft: rgba(86, 182, 224, 0.16);

		--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
		--shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
		--shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
	}
}

/* Manuelle Umschaltung überschreibt die Systemeinstellung. */
:root[data-theme="light"] {
	--bg: #f5f6f8;
	--surface: #ffffff;
	--surface-2: #fafbfc;
	--surface-hover: #f1f3f6;
	--border: #e2e5ea;
	--border-strong: #cdd2da;
	--text: #16181d;
	--text-muted: #5f6673;
	--text-subtle: #8b929e;
	--accent: #2f6df6;
	--accent-hover: #2559d0;
	--accent-soft: rgba(47, 109, 246, 0.12);
	--success: #17864a;
	--warning: #a76800;
	--danger: #c62b3c;
	--info: #0d6f9c;
	--shadow-sm: 0 1px 2px rgba(16, 20, 30, 0.06);
	--shadow: 0 4px 16px rgba(16, 20, 30, 0.08);
	--shadow-lg: 0 16px 48px rgba(16, 20, 30, 0.16);
	color-scheme: light;
}

:root[data-theme="dark"] {
	--bg: #0f1115;
	--surface: #171a20;
	--surface-2: #1c2027;
	--surface-hover: #22262e;
	--border: #2a2f38;
	--border-strong: #3a4049;
	--text: #eef0f4;
	--text-muted: #a6adba;
	--text-subtle: #79808d;
	--accent: #588eff;
	--accent-hover: #7ba5ff;
	--accent-soft: rgba(88, 142, 255, 0.18);
	--success: #4ac07d;
	--warning: #e0a34a;
	--danger: #ff6b7d;
	--info: #56b6e0;
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
	--shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
	--shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
	color-scheme: dark;
}

/* ---------- Grundlagen ---------- */

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

html,
body {
	margin: 0;
	padding: 0;
	height: 100%;
}

body {
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
	margin: 0 0 0.5rem;
	line-height: 1.25;
	font-weight: 650;
	letter-spacing: -0.01em;
}

h1 {
	font-size: 1.5rem;
}
h2 {
	font-size: 1.2rem;
}
h3 {
	font-size: 1rem;
}

p {
	margin: 0 0 0.75rem;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

code,
kbd {
	font-family: var(--font-mono);
	font-size: 0.86em;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.1em 0.35em;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- App-Rahmen ---------- */

.app {
	display: grid;
	grid-template-columns: var(--sidebar-width) 1fr;
	min-height: 100vh;
}

.sidebar {
	background: var(--surface);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
}

.sidebar__brand {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 1.1rem 1.15rem;
	border-bottom: 1px solid var(--border);
	min-height: var(--header-height);
}

.sidebar__logo {
	width: 32px;
	height: 32px;
	border-radius: 9px;
	background: var(--accent);
	color: var(--accent-contrast);
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 0.9rem;
	flex-shrink: 0;
}

.sidebar__title {
	font-weight: 650;
	font-size: 0.95rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sidebar__subtitle {
	font-size: 0.75rem;
	color: var(--text-subtle);
}

.nav {
	padding: 0.75rem 0.6rem;
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

.nav__section {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--text-subtle);
	padding: 0.9rem 0.6rem 0.3rem;
	font-weight: 600;
}

.nav__item {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.5rem 0.65rem;
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	font-size: 0.9rem;
	font-weight: 500;
	transition: background 0.12s ease, color 0.12s ease;
}

.nav__item:hover {
	background: var(--surface-hover);
	color: var(--text);
	text-decoration: none;
}

.nav__item.is-active {
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}

.nav__item svg {
	width: 17px;
	height: 17px;
	flex-shrink: 0;
}

.sidebar__footer {
	padding: 0.75rem 1.15rem 1rem;
	border-top: 1px solid var(--border);
	font-size: 0.75rem;
	color: var(--text-subtle);
}

.main {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.topbar {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0 1.5rem;
	min-height: var(--header-height);
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 20;
}

.topbar__title {
	font-weight: 650;
	font-size: 1rem;
	margin-right: auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.topbar__status {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.78rem;
	color: var(--text-subtle);
}

.status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--text-subtle);
	flex-shrink: 0;
}

.status-dot.is-online {
	background: var(--success);
	box-shadow: 0 0 0 3px var(--success-soft);
}

.status-dot.is-offline {
	background: var(--danger);
	box-shadow: 0 0 0 3px var(--danger-soft);
}

.content {
	padding: 1.5rem;
	max-width: 1440px;
	width: 100%;
	flex: 1;
}

.page-header {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.page-header__text {
	flex: 1;
	min-width: 220px;
}

.page-header__actions {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.page-lead {
	color: var(--text-muted);
	margin: 0;
	font-size: 0.92rem;
}

/* ---------- Karten & Raster ---------- */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}

.card__header {
	padding: 1rem 1.15rem;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.card__title {
	font-weight: 650;
	margin: 0;
	font-size: 0.98rem;
	flex: 1;
}

.card__body {
	padding: 1.15rem;
}

.card__footer {
	padding: 0.85rem 1.15rem;
	border-top: 1px solid var(--border);
	background: var(--surface-2);
	border-radius: 0 0 var(--radius) var(--radius);
	display: flex;
	gap: 0.5rem;
	justify-content: flex-end;
	flex-wrap: wrap;
}

.grid {
	display: grid;
	gap: 1rem;
}

.grid--stats {
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.grid--2 {
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stat {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.1rem 1.15rem;
	box-shadow: var(--shadow-sm);
}

.stat__label {
	font-size: 0.78rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 600;
}

.stat__value {
	font-size: 1.9rem;
	font-weight: 680;
	letter-spacing: -0.02em;
	margin-top: 0.2rem;
	line-height: 1.1;
}

.stat__hint {
	font-size: 0.8rem;
	color: var(--text-subtle);
}

/* ---------- Formulare ---------- */

.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1rem;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
}

.field--wide {
	grid-column: 1 / -1;
}

.field__label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.field__required {
	color: var(--danger);
}

.field__hint {
	font-size: 0.78rem;
	color: var(--text-subtle);
}

.field__error {
	font-size: 0.78rem;
	color: var(--danger);
	font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
	width: 100%;
	font: inherit;
	font-size: 0.92rem;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	padding: 0.5rem 0.65rem;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

textarea {
	min-height: 92px;
	resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

input:disabled,
select:disabled,
textarea:disabled {
	background: var(--surface-2);
	color: var(--text-subtle);
	cursor: not-allowed;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
	border-color: var(--danger);
}

.checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	cursor: pointer;
}

.checkbox input {
	width: 16px;
	height: 16px;
	accent-color: var(--accent);
	cursor: pointer;
}

.checkbox-list {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 0.6rem 0.7rem;
	max-height: 190px;
	overflow-y: auto;
	background: var(--surface-2);
}

fieldset {
	border: none;
	margin: 0 0 1.5rem;
	padding: 0;
}

fieldset legend {
	font-weight: 650;
	font-size: 0.95rem;
	padding: 0 0 0.65rem;
	color: var(--text);
}

/* ---------- Schaltflächen ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	font: inherit;
	font-size: 0.89rem;
	font-weight: 600;
	padding: 0.5rem 0.9rem;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	background: var(--surface);
	color: var(--text);
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.btn:hover:not(:disabled) {
	background: var(--surface-hover);
	text-decoration: none;
}

.btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.btn svg {
	width: 16px;
	height: 16px;
}

.btn--primary {
	background: var(--accent);
	color: var(--accent-contrast);
	border-color: var(--accent);
}

.btn--primary:hover:not(:disabled) {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
}

.btn--ghost {
	background: transparent;
	border-color: var(--border-strong);
	color: var(--text-muted);
}

.btn--ghost:hover:not(:disabled) {
	color: var(--text);
	background: var(--surface-hover);
}

.btn--danger {
	background: transparent;
	color: var(--danger);
	border-color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
	background: var(--danger-soft);
}

.btn--sm {
	padding: 0.3rem 0.6rem;
	font-size: 0.82rem;
}

.btn--icon {
	padding: 0.4rem;
	border-color: var(--border);
}

.btn-row {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	align-items: center;
}

/* ---------- Tabellen ---------- */

.table-wrap {
	overflow-x: auto;
	border-radius: var(--radius);
}

table.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.table th {
	text-align: left;
	font-weight: 600;
	font-size: 0.76rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-muted);
	padding: 0.65rem 0.9rem;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
	position: sticky;
	top: 0;
}

.table td {
	padding: 0.7rem 0.9rem;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}

.table tbody tr:last-child td {
	border-bottom: none;
}

.table tbody tr:hover {
	background: var(--surface-hover);
}

.table tbody tr.is-clickable {
	cursor: pointer;
}

.table__actions {
	text-align: right;
	white-space: nowrap;
}

.table__empty {
	padding: 2.5rem 1rem;
	text-align: center;
	color: var(--text-subtle);
}

/* ---------- Badges & Chips ---------- */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.15rem 0.5rem;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--text-muted);
	border: 1px solid var(--border);
	white-space: nowrap;
}

.badge--success {
	background: var(--success-soft);
	color: var(--success);
	border-color: transparent;
}

.badge--warning {
	background: var(--warning-soft);
	color: var(--warning);
	border-color: transparent;
}

.badge--danger {
	background: var(--danger-soft);
	color: var(--danger);
	border-color: transparent;
}

.badge--info {
	background: var(--info-soft);
	color: var(--info);
	border-color: transparent;
}

.badge--accent {
	background: var(--accent-soft);
	color: var(--accent);
	border-color: transparent;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

/* ---------- Hinweise ---------- */

.alert {
	display: flex;
	gap: 0.6rem;
	padding: 0.75rem 0.9rem;
	border-radius: var(--radius-sm);
	font-size: 0.88rem;
	border: 1px solid transparent;
	margin-bottom: 1rem;
}

.alert--info {
	background: var(--info-soft);
	color: var(--info);
}

.alert--warning {
	background: var(--warning-soft);
	color: var(--warning);
}

.alert--danger {
	background: var(--danger-soft);
	color: var(--danger);
}

.alert--success {
	background: var(--success-soft);
	color: var(--success);
}

.empty-state {
	text-align: center;
	padding: 3rem 1.5rem;
	color: var(--text-muted);
}

.empty-state__title {
	font-weight: 650;
	color: var(--text);
	margin-bottom: 0.25rem;
}

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

.toolbar {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
	align-items: center;
	margin-bottom: 1rem;
}

.toolbar__search {
	flex: 1;
	min-width: 200px;
	max-width: 380px;
}

.toolbar select {
	width: auto;
	min-width: 150px;
}

/* ---------- Paginierung ---------- */

.pagination {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	justify-content: flex-end;
	padding: 0.85rem 1.15rem;
	border-top: 1px solid var(--border);
	font-size: 0.85rem;
	color: var(--text-muted);
	flex-wrap: wrap;
}

/* ---------- Tabs ---------- */

.tabs {
	display: flex;
	gap: 0.25rem;
	border-bottom: 1px solid var(--border);
	margin-bottom: 1.25rem;
	overflow-x: auto;
}

.tab {
	padding: 0.55rem 0.85rem;
	font-size: 0.9rem;
	font-weight: 550;
	color: var(--text-muted);
	border-bottom: 2px solid transparent;
	cursor: pointer;
	background: none;
	border-top: none;
	border-left: none;
	border-right: none;
	font-family: inherit;
	white-space: nowrap;
}

.tab:hover {
	color: var(--text);
}

.tab.is-active {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

/* ---------- Modal ---------- */

.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(10, 12, 18, 0.55);
	backdrop-filter: blur(2px);
	display: grid;
	place-items: center;
	padding: 1rem;
	z-index: 100;
	animation: fade-in 0.12s ease;
}

.modal {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	width: min(720px, 100%);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	animation: pop-in 0.14s ease;
}

.modal--wide {
	width: min(1000px, 100%);
}

.modal--narrow {
	width: min(460px, 100%);
}

.modal__header {
	padding: 1.1rem 1.3rem;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.modal__title {
	font-weight: 650;
	font-size: 1.05rem;
	flex: 1;
	margin: 0;
}

.modal__body {
	padding: 1.3rem;
	overflow-y: auto;
	flex: 1;
}

.modal__footer {
	padding: 0.9rem 1.3rem;
	border-top: 1px solid var(--border);
	display: flex;
	gap: 0.5rem;
	justify-content: flex-end;
	background: var(--surface-2);
	border-radius: 0 0 var(--radius-lg) var(--radius-lg);
	flex-wrap: wrap;
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
}

@keyframes pop-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.99);
	}
}

/* ---------- Toasts ---------- */

.toasts {
	position: fixed;
	bottom: 1.25rem;
	right: 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	z-index: 200;
	max-width: min(400px, calc(100vw - 2.5rem));
}

.toast {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
	padding: 0.7rem 0.9rem;
	font-size: 0.88rem;
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	animation: slide-in 0.16s ease;
}

.toast--success {
	border-left-color: var(--success);
}
.toast--error {
	border-left-color: var(--danger);
}
.toast--warning {
	border-left-color: var(--warning);
}

.toast__text {
	flex: 1;
}

.toast__close {
	background: none;
	border: none;
	color: var(--text-subtle);
	cursor: pointer;
	font-size: 1.1rem;
	line-height: 1;
	padding: 0;
}

@keyframes slide-in {
	from {
		opacity: 0;
		transform: translateX(16px);
	}
}

/* ---------- Ladezustände ---------- */

.skeleton {
	background: linear-gradient(
		90deg,
		var(--surface-2) 25%,
		var(--surface-hover) 37%,
		var(--surface-2) 63%
	);
	background-size: 400% 100%;
	animation: shimmer 1.3s ease infinite;
	border-radius: var(--radius-sm);
	height: 1rem;
}

@keyframes shimmer {
	0% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0 50%;
	}
}

.spinner {
	width: 18px;
	height: 18px;
	border: 2px solid var(--border-strong);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
	display: inline-block;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.loading-row {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 2rem;
	justify-content: center;
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* ---------- Anmeldeseite ---------- */

.login {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 1.5rem;
	background:
		radial-gradient(1000px 500px at 15% -10%, var(--accent-soft), transparent 60%),
		var(--bg);
}

.login__card {
	width: min(420px, 100%);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	padding: 2rem;
}

.login__brand {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	margin-bottom: 1.5rem;
}

.login__title {
	font-size: 1.25rem;
	font-weight: 680;
	margin: 0;
}

.login__form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.login__hint {
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--border);
	font-size: 0.83rem;
	color: var(--text-muted);
	white-space: pre-wrap;
}

/* ---------- Benutzermenü ---------- */

.usermenu {
	position: relative;
}

.usermenu__button {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: none;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	padding: 0.3rem 0.5rem;
	cursor: pointer;
	font: inherit;
	color: var(--text);
}

.usermenu__button:hover {
	background: var(--surface-hover);
	border-color: var(--border);
}

.avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--accent-soft);
	color: var(--accent);
	display: grid;
	place-items: center;
	font-weight: 650;
	font-size: 0.78rem;
	flex-shrink: 0;
}

.usermenu__panel {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	min-width: 220px;
	padding: 0.35rem;
	z-index: 60;
}

.usermenu__info {
	padding: 0.6rem 0.7rem;
	border-bottom: 1px solid var(--border);
	margin-bottom: 0.35rem;
}

.usermenu__name {
	font-weight: 600;
	font-size: 0.9rem;
}

.usermenu__mail {
	font-size: 0.78rem;
	color: var(--text-subtle);
	word-break: break-all;
}

.usermenu__item {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
	padding: 0.5rem 0.7rem;
	border: none;
	background: none;
	font: inherit;
	font-size: 0.88rem;
	color: var(--text);
	text-align: left;
	border-radius: var(--radius-sm);
	cursor: pointer;
}

.usermenu__item:hover {
	background: var(--surface-hover);
	text-decoration: none;
}

/* ---------- Hilfsklassen ---------- */

.stack {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.stack--sm {
	gap: 0.5rem;
}

.row {
	display: flex;
	gap: 0.6rem;
	align-items: center;
	flex-wrap: wrap;
}

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

.subtle {
	color: var(--text-subtle);
	font-size: 0.85rem;
}

.text-right {
	text-align: right;
}

.mono {
	font-family: var(--font-mono);
	font-size: 0.86em;
}

.nowrap {
	white-space: nowrap;
}

.mt-0 {
	margin-top: 0;
}
.mt-1 {
	margin-top: 0.5rem;
}
.mt-2 {
	margin-top: 1rem;
}
.mb-0 {
	margin-bottom: 0;
}
.mb-2 {
	margin-bottom: 1rem;
}

/* ---------- Mobil ---------- */

.sidebar__toggle {
	display: none;
}

@media (max-width: 900px) {
	.app {
		grid-template-columns: 1fr;
	}

	.sidebar {
		position: fixed;
		inset: 0 auto 0 0;
		width: var(--sidebar-width);
		transform: translateX(-100%);
		transition: transform 0.18s ease;
		z-index: 90;
		box-shadow: var(--shadow-lg);
	}

	.app.is-nav-open .sidebar {
		transform: translateX(0);
	}

	.app.is-nav-open::after {
		content: "";
		position: fixed;
		inset: 0;
		background: rgba(10, 12, 18, 0.5);
		z-index: 80;
	}

	.sidebar__toggle {
		display: inline-flex;
	}

	.content {
		padding: 1rem;
	}

	.topbar {
		padding: 0 1rem;
	}
}

@media print {
	.sidebar,
	.topbar,
	.page-header__actions,
	.toolbar {
		display: none !important;
	}

	.app {
		grid-template-columns: 1fr;
	}
}

/* Eine Zeile der Sorgeberechtigung: Person, Verhältnis, Hinweise, Aktionen. */
.guardian-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface-2);
}

.guardian-row__name {
	flex: 1;
	min-width: 8rem;
	font-weight: 600;
	color: inherit;
	text-decoration: none;
}

.guardian-row__name:hover {
	color: var(--accent);
}
