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

/* Light theme — default */
:root {
    --bg: #f4f6fb;
    --bg-surface: #ffffff;
    --bg-menu: #ffffff;
    --border: #e4e8f2;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --header-bg: rgba(244, 246, 251, 0.85);
    --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
    --menu-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.08);
    --accent: #f59e0b;
    --accent-end: #ea580c;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --icon-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
    --spinner-track: #e4e8f2;
}

/* Auto dark — system preference, only when no explicit override */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #090b12;
        --bg-surface: #0d1019;
        --bg-menu: #111521;
        --border: #161d2e;
        --text-primary: #e2e8f0;
        --text-secondary: #c8d0e8;
        --text-muted: #334166;
        --header-bg: rgba(9, 11, 18, 0.80);
        --card-shadow: none;
        --menu-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
        --accent: #f59e0b;
        --accent-end: #ea580c;
        --accent-glow: rgba(245, 158, 11, 0.12);
        --icon-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
        --spinner-track: #161d2e;
    }
}

/* Explicit dark */
[data-theme="dark"] {
    --bg: #090b12;
    --bg-surface: #0d1019;
    --bg-menu: #111521;
    --border: #161d2e;
    --text-primary: #e2e8f0;
    --text-secondary: #c8d0e8;
    --text-muted: #334166;
    --header-bg: rgba(9, 11, 18, 0.80);
    --card-shadow: none;
    --menu-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    --accent: #f59e0b;
    --accent-end: #ea580c;
    --accent-glow: rgba(245, 158, 11, 0.12);
    --icon-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
    --spinner-track: #161d2e;
}

/* Explicit light */
[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-surface: #ffffff;
    --bg-menu: #ffffff;
    --border: #e4e8f2;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --header-bg: rgba(244, 246, 251, 0.85);
    --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
    --menu-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.08);
    --accent: #f59e0b;
    --accent-end: #ea580c;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --icon-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
    --spinner-track: #e4e8f2;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.blazor-error-boundary {
    background: #2d0a0a;
    padding: 1rem;
    color: #fca5a5;
    border-radius: 10px;
    border: 1px solid #7f1d1d;
    margin: 1rem;
}

.blazor-error-boundary::after {
    content: "Ein Fehler ist aufgetreten."
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #22c55e;
}

.invalid {
    outline: 1px solid #ef4444;
}

.validation-message {
    color: #f87171;
}
