/* ==========================================================================
   ERC.Photos – Live-Bild-Service
   Eigenes Design-System (ohne Framework). Farben als Tokens, Hell/Dunkel.
   ========================================================================== */

:root {
	--bg: #f3f5f9;
	--surface: #ffffff;
	--surface-2: #f6f8fb;
	--surface-3: #eceff5;
	--border: #e2e7ef;
	--border-strong: #cfd6e2;
	--text: #0d1526;
	--text-2: #3b465c;
	--muted: #6a768c;
	--accent: #1f5eff;
	--accent-hover: #184ee0;
	--accent-soft: #e8efff;
	--accent-ink: #ffffff;
	--success: #12a150;
	--success-soft: #e3f6eb;
	--warning: #c27803;
	--warning-soft: #fdf3dc;
	--danger: #dc2b2b;
	--danger-soft: #fde8e8;
	--live: #ff3b3b;
	--shadow-sm: 0 1px 2px rgba(13, 21, 38, .06);
	--shadow: 0 1px 2px rgba(13, 21, 38, .05), 0 4px 16px rgba(13, 21, 38, .06);
	--shadow-lg: 0 12px 40px rgba(13, 21, 38, .18);
	--radius-sm: 8px;
	--radius: 12px;
	--radius-lg: 18px;
	--header-h: 64px;
	--sidebar-w: 260px;
	--font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #090d15;
		--surface: #111723;
		--surface-2: #151c2a;
		--surface-3: #1c2536;
		--border: #222c3f;
		--border-strong: #2e3a51;
		--text: #e8edf6;
		--text-2: #c2cada;
		--muted: #8b97ad;
		--accent: #5b8cff;
		--accent-hover: #7aa2ff;
		--accent-soft: rgba(91, 140, 255, .14);
		--accent-ink: #ffffff;
		--success: #34c27a;
		--success-soft: rgba(52, 194, 122, .14);
		--warning: #f0b440;
		--warning-soft: rgba(240, 180, 64, .14);
		--danger: #ff5f5f;
		--danger-soft: rgba(255, 95, 95, .14);
		--shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
		--shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #090d15;
	--surface: #111723;
	--surface-2: #151c2a;
	--surface-3: #1c2536;
	--border: #222c3f;
	--border-strong: #2e3a51;
	--text: #e8edf6;
	--text-2: #c2cada;
	--muted: #8b97ad;
	--accent: #5b8cff;
	--accent-hover: #7aa2ff;
	--accent-soft: rgba(91, 140, 255, .14);
	--accent-ink: #ffffff;
	--success: #34c27a;
	--success-soft: rgba(52, 194, 122, .14);
	--warning: #f0b440;
	--warning-soft: rgba(240, 180, 64, .14);
	--danger: #ff5f5f;
	--danger-soft: rgba(255, 95, 95, .14);
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
	--shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
	color-scheme: dark;
}

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

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

html { -webkit-text-size-adjust: 100%; }

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

img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
code, .mono { font-family: var(--mono); font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.stack > * + * { margin-top: 20px; }
.stack-sm > * + * { margin-top: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-sidebar { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .container { padding: 0 16px; } }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	height: 40px; padding: 0 16px;
	border: 1px solid transparent; border-radius: 10px;
	background: var(--surface-3); color: var(--text);
	font: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
	cursor: pointer; white-space: nowrap; text-decoration: none;
	transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--border); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(31, 94, 255, .25); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); color: #fff; filter: brightness(1.08); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); color: #fff; filter: brightness(1.08); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); }
.btn-soft-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: .85rem; border-radius: 8px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

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

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, .select, textarea.input {
	width: 100%; height: 44px; padding: 0 14px;
	background: var(--surface); color: var(--text);
	border: 1px solid var(--border-strong); border-radius: 10px;
	font: inherit; font-size: .95rem;
	transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a768c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-sm, .select.input-sm { height: 36px; font-size: .88rem; border-radius: 8px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 40px; }
.input-icon > .input-sm { padding-left: 36px; }
.input-icon.input-sm-wrap > .icon { left: 11px; width: 16px; height: 16px; }
.passwort-feld { position: relative; }
.passwort-feld .input { padding-right: 46px; }
.passwort-feld button { position: absolute; right: 4px; top: 4px; height: 36px; width: 38px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.passwort-feld button:hover { color: var(--text); background: var(--surface-3); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Karten, Kennzahlen, Badges, Meldungen
   -------------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 1rem; }
.card-header .sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.card-body { padding: 22px; }
.card-body.flush { padding: 0; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.card-danger .card-header h2 { color: var(--danger); }

.stat { position: relative; display: flex; gap: 16px; align-items: center; padding: 20px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--text); overflow: hidden; }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow); color: var(--text); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.is-success { background: var(--success-soft); color: var(--success); }
.stat-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.stat-value { font-size: 1.65rem; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 500; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: .74rem; font-weight: 650; letter-spacing: .01em; background: var(--surface-3); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge .icon { width: 13px; height: 13px; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; }

.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--danger-soft); color: var(--live); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.live-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255, 59, 59, .6); animation: puls 1.6s infinite; }
.live-pill.is-offline { background: var(--surface-3); color: var(--muted); }
.live-pill.is-offline::before { background: var(--muted); animation: none; }
@keyframes puls { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 59, .55); } 70% { box-shadow: 0 0 0 8px rgba(255, 59, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0); } }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid transparent; font-size: .92rem; margin-bottom: 16px; background: var(--accent-soft); color: var(--text); }
.alert > .icon { margin-top: 2px; color: var(--accent); }
.alert-success { background: var(--success-soft); }
.alert-success > .icon { color: var(--success); }
.alert-warning { background: var(--warning-soft); }
.alert-warning > .icon { color: var(--warning); }
.alert-danger { background: var(--danger-soft); }
.alert-danger > .icon { color: var(--danger); }
.alert .alert-text { flex: 1; }
.alert .alert-close { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.alert .alert-close:hover { color: var(--text); }

.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; font-weight: 700; font-size: .8rem; letter-spacing: .02em; color: #fff; background: linear-gradient(135deg, var(--avatar-a, #3b6cff), var(--avatar-b, #7b5cff)); text-transform: uppercase; user-select: none; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty .empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty .empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* Listen mit Einträgen (z.B. Freischaltungen, letzte Downloads) */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .list-main { flex: 1; min-width: 0; }
.list .list-title { font-weight: 600; }
.list .list-sub { color: var(--muted); font-size: .84rem; }

/* Kennwert-Liste (Systeminfo) */
.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 10px 20px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

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

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table .cell-user { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.table .cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
@media (max-width: 760px) { .hide-mobile { display: none !important; } }

.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; font-size: .88rem; font-weight: 600; color: var(--text-2); }
.pagination a:hover { background: var(--surface-3); color: var(--text); }
.pagination .is-active { background: var(--accent); color: var(--accent-ink); }

/* Segment-Tabs (Filter) */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: .88rem; font-weight: 600; color: var(--text-2); }
.tabs a:hover { color: var(--text); }
.tabs a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs a .tab-count { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Kopfzeile, Navigation, Dropdown
   -------------------------------------------------------------------------- */

.topbar { position: sticky; top: 0; z-index: 40; height: var(--header-h); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--border); }
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #1f5eff, #0b2d8f); color: #fff; box-shadow: 0 4px 12px rgba(31, 94, 255, .35); }
.brand-mark .icon { width: 18px; height: 18px; }
.brand-name span { color: var(--accent); }
.brand-tag { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 6px; }

.mainnav { display: flex; gap: 4px; }
.mainnav a { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .92rem; }
.mainnav a:hover { background: var(--surface-3); color: var(--text); }
.mainnav a.is-active { background: var(--accent-soft); color: var(--accent); }

.user-chip { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 10px 0 4px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.user-chip:hover, .dropdown.is-open .user-chip { background: var(--surface-3); }
.user-chip .icon { color: var(--muted); }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s; z-index: 60; }
.dropdown.is-open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head strong { display: block; }
.dropdown-head span { color: var(--muted); font-size: .84rem; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: .9rem; font-weight: 500; text-align: left; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); color: var(--text); }
.dropdown-menu .is-danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* Mobile: Hauptnavigation als Leiste am unteren Rand */
@media (max-width: 760px) {
	.topbar-inner { gap: 12px; }
	/* backdrop-filter würde die fixierte Navigationsleiste an die Kopfzeile binden */
	.app-frontend .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
	.user-chip .user-name, .user-chip > .icon { display: none; }
	.user-chip { padding: 0 2px; }
	.mainnav { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
	.mainnav a { flex-direction: column; gap: 2px; height: auto; padding: 6px 12px; font-size: .7rem; flex: 1; }
	.mainnav a .icon { width: 22px; height: 22px; }
	.app-frontend .main { padding-bottom: 96px; }
	.app-frontend .footer { padding-bottom: 90px; }
	.hide-sm { display: none !important; }
}

/* --------------------------------------------------------------------------
   Seitenaufbau
   -------------------------------------------------------------------------- */

.main { padding-top: 32px; padding-bottom: 48px; min-height: calc(100vh - var(--header-h) - 70px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .page-sub { color: var(--muted); margin-top: 6px; }
.page-head .page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 36px 0 16px; }
.section-title h2 { font-size: 1.1rem; }

.footer { padding: 24px 0 32px; color: var(--muted); font-size: .84rem; }
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }
.footer nav { display: flex; gap: 18px; }

/* Hero der Startseite */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 44px 44px 40px; color: #fff; background: #0b1220; isolation: isolate; box-shadow: var(--shadow); }
.hero-bild { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center 30%; filter: grayscale(1) contrast(1.05); opacity: .55; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, rgba(8, 14, 30, .96) 0%, rgba(10, 25, 70, .82) 45%, rgba(31, 94, 255, .35) 100%); }
.hero h1 { color: #fff; font-size: clamp(1.7rem, 3.2vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; max-width: 640px; }
.hero p { color: rgba(255, 255, 255, .78); max-width: 560px; font-size: 1.02rem; margin-top: 12px; }
.hero .live-pill { background: rgba(255, 59, 59, .18); margin-bottom: 18px; }
.hero .live-pill.is-offline { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .75); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.hero .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .35); }
.hero .btn-outline:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.hero-stats { display: flex; gap: 36px; flex-wrap: wrap; margin-top: 34px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .14); }
.hero-stats strong { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-stats span { color: rgba(255, 255, 255, .65); font-size: .84rem; }
@media (max-width: 640px) { .hero { padding: 30px 22px 26px; border-radius: 18px; } .hero-stats { gap: 22px; } }

/* Vorschau-Streifen der neuesten Bilder */
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.strip a { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--surface-3); }
.strip img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.strip a:hover img { transform: scale(1.05); }
@media (max-width: 1100px) { .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --------------------------------------------------------------------------
   Backend: Seitenleiste
   -------------------------------------------------------------------------- */

.app-backend { display: block; }
.sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar-head { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.sidebar-group { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 8px; }
.sidebar-group:first-child { padding-top: 4px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .92rem; }
.sidebar-nav a:hover { background: var(--surface-3); color: var(--text); }
.sidebar-nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.sidebar-nav a .count { margin-left: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-foot a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .9rem; }
.sidebar-foot a:hover { background: var(--surface-3); color: var(--text); }
.backend-main { margin-left: var(--sidebar-w); min-width: 0; }
.backend-main .topbar-inner { padding: 0 32px; }
.backend-main .main { padding: 32px; max-width: 1400px; }
.backend-main .footer { padding: 16px 32px 28px; }
.backend-main .footer .container { padding: 0; max-width: none; }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 1000px) {
	.sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
	body.sidebar-offen .sidebar { transform: none; }
	body.sidebar-offen .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(5, 10, 20, .5); }
	.backend-main { margin-left: 0; }
	.sidebar-toggle { display: inline-flex; }
	.backend-main .topbar-inner { padding: 0 16px; }
	.backend-main .main { padding: 24px 16px; }
	.backend-main .footer { padding: 16px; }
}

/* --------------------------------------------------------------------------
   Anmeldeseiten
   -------------------------------------------------------------------------- */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; color: #fff; background: #0b1220 center / cover no-repeat; isolation: isolate; }
.auth-visual::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, rgba(8, 14, 30, .55) 0%, rgba(8, 18, 50, .78) 55%, rgba(10, 30, 90, .92) 100%); }
.auth-visual .brand { color: #fff; }
.auth-visual .brand-name span { color: #8fb0ff; }
.auth-visual blockquote { margin: 0; max-width: 480px; }
.auth-visual blockquote p { font-size: 1.6rem; font-weight: 750; line-height: 1.25; letter-spacing: -.02em; }
.auth-visual blockquote footer { color: rgba(255, 255, 255, .7); font-size: .9rem; margin-top: 12px; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--muted); margin-bottom: 28px; }
.auth-card .brand { display: none; margin-bottom: 32px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; font-size: .9rem; }
.auth-foot { margin-top: 40px; color: var(--muted); font-size: .8rem; display: flex; gap: 16px; }
.auth-foot a { color: var(--muted); }
.trenner { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 22px 0; }
.trenner::before, .trenner::after { content: ""; flex: 1; height: 1px; background: var(--border); }
@media (max-width: 900px) {
	.auth { grid-template-columns: 1fr; }
	.auth-visual { display: none; }
	.auth-card .brand { display: inline-flex; }
	.auth-panel { justify-content: flex-start; padding-top: 56px; }
}

/* --------------------------------------------------------------------------
   Dialoge und Toasts
   -------------------------------------------------------------------------- */

dialog.dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.dialog-wide { width: min(640px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: rgba(5, 10, 20, .55); backdrop-filter: blur(3px); }
dialog.dialog[open] { animation: dialog-ein .18s ease-out; }
@keyframes dialog-ein { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 22px 0; }
.dialog-head h2 { font-size: 1.08rem; }
.dialog-head .dialog-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.dialog-head .dialog-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.dialog-body { padding: 14px 22px 22px; color: var(--text-2); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 16px; border-radius: 12px; background: #0f1729; color: #fff; box-shadow: var(--shadow-lg); font-size: .9rem; pointer-events: auto; animation: toast-ein .2s ease-out; }
.toast .icon { color: #7aa2ff; }
.toast.is-success .icon { color: #4ade80; }
.toast.is-danger .icon { color: #ff7a7a; }
@keyframes toast-ein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .toasts { left: 16px; right: 16px; bottom: 84px; } .toast { max-width: none; } }

/* --------------------------------------------------------------------------
   Galerie (Masonry) und Lightbox
   -------------------------------------------------------------------------- */

.galerie-leiste { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.galerie-leiste .row { gap: 10px; }
.masonry { display: flex; align-items: flex-start; gap: 16px; }
.masonry-spalte { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 575px) { .masonry, .masonry-spalte { gap: 10px; } }

.kachel { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface-3); box-shadow: var(--shadow-sm); }
.kachel img { display: block; width: 100%; height: auto; cursor: zoom-in; transition: transform .4s ease, opacity .3s; }
.kachel:hover img { transform: scale(1.025); }
.kachel-overlay { position: absolute; inset: auto 0 0 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 40px 14px 12px; background: linear-gradient(to top, rgba(5, 10, 20, .82), rgba(5, 10, 20, 0)); color: #fff; opacity: 0; transition: opacity .2s; pointer-events: none; }
.kachel:hover .kachel-overlay, .kachel:focus-within .kachel-overlay, .kachel.is-ausgewaehlt .kachel-overlay { opacity: 1; }
.kachel-info { min-width: 0; }
.kachel-info strong { display: block; font-size: .86rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kachel-info span { display: flex; align-items: center; gap: 5px; font-size: .78rem; color: rgba(255, 255, 255, .75); }
.kachel-aktionen { display: flex; gap: 6px; pointer-events: auto; }
.kachel-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; border: 0; background: rgba(255, 255, 255, .16); color: #fff; backdrop-filter: blur(8px); cursor: pointer; }
.kachel-btn:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.kachel-btn.is-danger:hover { background: var(--danger); }
.kachel-btn .icon { width: 17px; height: 17px; }
.kachel-neu { position: absolute; top: 10px; left: 10px; z-index: 2; }
.kachel-auswahl { position: absolute; top: 10px; right: 10px; z-index: 2; width: 28px; height: 28px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .9); background: rgba(5, 10, 20, .3); display: grid; place-items: center; cursor: pointer; color: transparent; opacity: 0; transition: opacity .15s; }
.kachel:hover .kachel-auswahl, .masonry.hat-auswahl .kachel-auswahl { opacity: 1; }
.kachel.is-ausgewaehlt .kachel-auswahl { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }
.kachel.is-ausgewaehlt { outline: 3px solid var(--accent); outline-offset: -3px; }
.kachel.is-ausgewaehlt img { opacity: .85; }
@media (hover: none) { .kachel-overlay { opacity: 1; padding-top: 28px; } .kachel-auswahl { opacity: 1; } }
.kachel.ist-neu { animation: kachel-neu 1.2s ease-out; }
@keyframes kachel-neu { 0% { opacity: 0; transform: scale(.96); box-shadow: 0 0 0 0 var(--accent); } 40% { opacity: 1; transform: none; box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.kachel.ist-weg { animation: kachel-weg .25s ease-in forwards; }
@keyframes kachel-weg { to { opacity: 0; transform: scale(.94); } }

.neu-hinweis { position: fixed; z-index: 44; top: calc(var(--header-h) + 14px); left: 50%; transform: translateX(-50%); display: none; }
.neu-hinweis.is-sichtbar { display: inline-flex; animation: toast-ein .2s ease-out; }
.neu-hinweis .btn { box-shadow: var(--shadow-lg); border-radius: 999px; }

.auswahl-leiste { position: fixed; z-index: 46; left: 50%; bottom: 24px; transform: translateX(-50%); display: none; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 14px; background: #0f1729; color: #fff; box-shadow: var(--shadow-lg); }
.auswahl-leiste.is-sichtbar { display: flex; animation: toast-ein .2s ease-out; }
.auswahl-leiste .btn-ghost { color: rgba(255, 255, 255, .8); }
.auswahl-leiste .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.lightbox { position: fixed; inset: 0; z-index: 300; display: none; flex-direction: column; background: rgba(4, 7, 14, .97); color: #fff; user-select: none; }
.lightbox.is-offen { display: flex; animation: dialog-ein .15s ease-out; }
.lightbox-kopf { display: flex; align-items: center; gap: 16px; padding: 14px 18px; }
.lightbox-titel { flex: 1; min-width: 0; }
.lightbox-titel strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-titel span { color: rgba(255, 255, 255, .6); font-size: .85rem; }
.lightbox-zaehler { color: rgba(255, 255, 255, .6); font-size: .85rem; font-variant-numeric: tabular-nums; }
.lightbox-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; border: 0; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; }
.lightbox-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.lightbox-buehne { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 72px 24px; touch-action: pan-y; }
.lightbox-buehne img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.lightbox-nav.zurueck { left: 14px; }
.lightbox-nav.vor { right: 14px; }
.lightbox-nav .icon { width: 24px; height: 24px; }
@media (max-width: 760px) { .lightbox-buehne { padding: 0 8px 16px; } .lightbox-nav { display: none; } }

/* Kleine Bild-Liste (Warteschlange, fehlerhafte Bilder) */
.datei-liste { list-style: none; margin: 0; padding: 0; }
.datei-liste li { display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.datei-liste li:last-child { border-bottom: 0; }

/* Protokoll-Ausgabe */
.log { margin: 0; padding: 16px 22px; max-height: 420px; overflow: auto; background: #0b1020; color: #c8d3ea; font-family: var(--mono); font-size: .8rem; line-height: 1.6; border-radius: 0 0 var(--radius-lg) var(--radius-lg); white-space: pre-wrap; word-break: break-all; }

.fortschritt { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.fortschritt > div { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s; }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: skeleton 1.4s infinite; }
@keyframes skeleton { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Navigationspunkt nur in der mobilen Leiste */
.mainnav [data-nur-mobil] { display: none; }
@media (max-width: 760px) { .mainnav [data-nur-mobil] { display: inline-flex; } }

/* Balkendiagramm (eine Reihe, Tooltip beim Überfahren) */
.balken { display: flex; align-items: flex-end; gap: 2px; height: 170px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.balken-spalte { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.balken-spalte > i { display: block; width: 70%; max-width: 28px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); opacity: .85; transition: opacity .15s; }
.balken-spalte:hover > i, .balken-spalte:focus > i { opacity: 1; }
.balken-spalte.ist-leer > i { background: var(--border-strong); }
.balken-spalte .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 6px 10px; border-radius: 8px; background: #0f1729; color: #fff; font-size: .78rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 5; box-shadow: var(--shadow); }
.balken-spalte:hover .tip, .balken-spalte:focus .tip { opacity: 1; }
.balken-achse { display: flex; gap: 2px; margin-top: 8px; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.balken-achse span { flex: 1 1 0; text-align: center; }
.balken-achse span:nth-child(odd) { visibility: hidden; }
@media (max-width: 1280px) { .hide-lg { display: none !important; } }

/* Download-Dialog: Drehen und Ausrichten */
.dreh-dialog .dialog-body { padding-top: 18px; }
.dreh-rahmen { display: flex; justify-content: center; width: 100%; }
.dreh-buehne { position: relative; overflow: hidden; border-radius: 10px; background: #0b1020; touch-action: none; cursor: ew-resize; user-select: none; -webkit-user-select: none; transition: width .25s ease, height .25s ease; }
.dreh-buehne img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; transition: transform .25s ease, width .25s ease, height .25s ease; pointer-events: none; }
.dreh-buehne.ohne-uebergang, .dreh-buehne.ohne-uebergang img { transition: none; }
.dreh-raster { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; background-image: linear-gradient(to right, rgba(255, 255, 255, .55) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, .55) 1px, transparent 1px); background-size: 33.333% 33.333%; background-position: -1px -1px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4); }
.dreh-buehne.is-aktiv .dreh-raster, .dreh-buehne:hover .dreh-raster { opacity: 1; }
.dreh-leiste { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.dreh-regler { flex: 1 1 200px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.dreh-regler input { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
.dreh-regler output { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Download-Dialog: Formatauswahl und Zuschnitt */
.format-leiste { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.format-chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: .85rem; font-weight: 600; white-space: nowrap; cursor: pointer; flex: none; }
.format-chip:hover { border-color: var(--accent); color: var(--text); }
.format-chip.is-aktiv { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.format-chip small { font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }
.format-chip small:empty { display: none; }
.format-symbol { display: inline-block; height: 13px; max-width: 22px; border: 1.5px solid currentColor; border-radius: 2px; }
.format-symbol.is-original { width: 14px; border-style: dashed; }
.format-leiste .btn { flex: none; }
.dreh-buehne { cursor: grab; }
.dreh-buehne.is-aktiv { cursor: grabbing; }
.dreh-regler-gruppe { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dreh-regler-gruppe .dreh-regler > span { min-width: 72px; }
.dreh-fuss .btn-ghost { margin-right: auto; }
@media (max-width: 520px) { .dreh-fuss { flex-wrap: wrap; } .dreh-fuss .btn-primary { flex: 1 1 100%; order: -1; } }
dialog.dreh-dialog { width: min(820px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.dreh-regler-gruppe .dreh-regler { flex: none; }
.format-leiste { flex-wrap: wrap; overflow: visible; }
@media (max-width: 520px) { .format-leiste { flex-wrap: nowrap; overflow-x: auto; } .dreh-dialog .dialog-body { padding: 14px 14px 16px; } }

/* Hinweis: Bilder in Verarbeitung */
.verarbeitung-pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: .78rem; font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.verarbeitung-pill[hidden] { display: none; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: drehen .8s linear infinite; flex: none; }
@keyframes drehen { to { transform: rotate(360deg); } }
