:root {
    color-scheme: light;
    --page-background: radial-gradient(ellipse at 12% 0%, rgba(196, 224, 214, 0.42), transparent 34rem), #f6f7f4;
    --surface: #ffffff;
    --surface-muted: #edf2ee;
    --text-primary: #24312e;
    --text-heading: #20352d;
    --text-muted: #687571;
    --border: #dfe9e2;
    --link: #24674f;
    --radius-container: 15px;
    --radius-button: 5px;
}

:root[data-theme="light"] {
    color-scheme: light;
    --page-background: radial-gradient(ellipse at 12% 0%, rgba(196, 224, 214, 0.42), transparent 34rem), #f6f7f4;
    --surface: #ffffff;
    --surface-muted: #edf2ee;
    --text-primary: #24312e;
    --text-heading: #20352d;
    --text-muted: #687571;
    --border: #dfe9e2;
    --link: #24674f;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-background: #111a16;
    --surface: #1b2721;
    --surface-muted: #202f28;
    --text-primary: #dbe5df;
    --text-heading: #eff5f1;
    --text-muted: #a4b2aa;
    --border: #35453c;
    --link: #91c9ac;
    --eyebrow-color: #91c9ac;
}

body {
    color: var(--text-primary);
    background: var(--page-background);
}

h1,
h2,
h3,
h4,
h5,
h6,
strong {
    color: var(--text-heading);
}

p,
label {
    color: var(--text-muted);
}

a {
    color: var(--link);
}

.home-intro,
.recent-users-panel,
.kicker,
.page-panel,
.alert-error,
.alert-success,
.auth-box,
.form-box,
.emergency-board-panel,
.emergency-board-section,
.emergency-board-privacy,
.emergency-board-form fieldset,
.home-hero,
.hero-art-card,
.hero-art-mark,
.news-card,
.news-edit-panel,
.content-panel,
.contact-inbox-item,
.contact-page-panel,
.contact-form-card,
.privacy-toc,
.privacy-section,
.imprint-card,
.about-hero,
.about-cta-panel,
.profile-card,
.value-card,
.dashboard-heading,
.analytics-kpi,
.analytics-panel,
.stat-card,
.activity-item,
.user-info,
.debug-info,
.alert,
.site-nav,
#body {
    border-radius: var(--radius-container);
}

.brand-mark,
.content-count,
.news-empty {
    border-radius: var(--radius-container);
}

button,
.btn,
.site-nav a,
.header-cta,
.dashboard-shortcut,
.menu-toggle,
.header-contact-icon,
input,
textarea,
select,
.create-form input,
.create-form select,
.edit-form input,
.edit-form select,
.emergency-board-form input,
.emergency-board-form textarea {
    border-radius: var(--radius-button);
}

body,
.site-header,
.home-hero,
.home-intro,
.page-panel,
.auth-box,
.form-box,
.emergency-board-panel,
.emergency-board-section,
.news-card,
.content-panel,
.contact-inbox-item,
.dashboard-heading,
input,
textarea,
select {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

:focus-visible {
    outline: 3px solid #68a98c;
    outline-offset: 3px;
}

.news-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.news-card:hover {
    border-color: #b7d1c1;
    box-shadow: 0 16px 38px rgba(30, 55, 45, 0.09);
    transform: translateY(-2px);
}

.theme-toggle {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    color: var(--text-primary);
    background: var(--surface);
}

.theme-toggle:hover {
    color: var(--text-heading);
    background: var(--surface-muted);
    transform: none;
}

.theme-toggle-icon {
    font-size: 1.2rem;
    line-height: 1;
}

#body .theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

:root[data-theme="dark"] .site-header {
    color: var(--text-primary);
    border-color: var(--border);
    background: rgba(13, 20, 16, 0.95);
}

:root[data-theme="dark"] .logo-name {
    color: #91c9ac;
}

:root[data-theme="dark"] .logo-tagline {
    color: #5a8470;
}

:root[data-theme="dark"] .logo-crest {
    /* Wrapper entfernt – kein Dark-Mode-Badge mehr nötig */
}

:root[data-theme="dark"] .logo-crest-img {
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}

:root[data-theme="dark"] .hero-wappen {
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.6)) brightness(1.06);
}

:root[data-theme="dark"] .site-nav,
:root[data-theme="dark"] .home-intro,
:root[data-theme="dark"] .recent-users-panel,
:root[data-theme="dark"] .page-panel,
:root[data-theme="dark"] .auth-box,
:root[data-theme="dark"] .form-box,
:root[data-theme="dark"] .emergency-board-panel,
:root[data-theme="dark"] .emergency-board-section,
:root[data-theme="dark"] .emergency-board-form fieldset,
:root[data-theme="dark"] .news-card,
:root[data-theme="dark"] .news-empty,
:root[data-theme="dark"] .content-panel,
:root[data-theme="dark"] .contact-inbox-item,
:root[data-theme="dark"] .contact-page-panel,
:root[data-theme="dark"] .news-edit-panel,
:root[data-theme="dark"] .dashboard-heading,
:root[data-theme="dark"] .analytics-kpi,
:root[data-theme="dark"] .analytics-panel,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .activity-item,
:root[data-theme="dark"] .user-info,
:root[data-theme="dark"] .debug-info {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--surface);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] .home-hero {
    background: linear-gradient(120deg, #1b2922, #20332a);
}

:root[data-theme="dark"] .news-empty {
    background: linear-gradient(135deg, #1b2721 0%, #1f2f28 100%);
}

:root[data-theme="dark"] .news-empty-icon {
    background: rgba(145, 201, 172, 0.12);
    color: #91c9ac;
}

:root[data-theme="dark"] .news-empty-title {
    color: var(--text-heading);
}

:root[data-theme="dark"] .news-empty-text {
    color: var(--text-muted);
}

:root[data-theme="dark"] .dashboard-section-title {
    color: var(--text-heading);
}

:root[data-theme="dark"] .dashboard-section-title i {
    color: #91c9ac;
}

:root[data-theme="dark"] .dashboard-shortcut-card {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .dashboard-shortcut-card:hover {
    border-color: #91c9ac;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .shortcut-title {
    color: var(--text-heading);
}

:root[data-theme="dark"] .shortcut-desc {
    color: var(--text-muted);
}

:root[data-theme="dark"] .shortcut-arrow {
    color: var(--text-muted);
}

:root[data-theme="dark"] .dashboard-shortcut-card:hover .shortcut-arrow {
    color: #91c9ac;
}

:root[data-theme="dark"] .shortcut-news {
    background: rgba(145, 201, 172, 0.15);
    color: #91c9ac;
}

:root[data-theme="dark"] .shortcut-contact {
    background: rgba(94, 182, 238, 0.15);
    color: #8ec5eb;
}

:root[data-theme="dark"] .shortcut-user {
    background: rgba(200, 140, 240, 0.15);
    color: #c993ec;
}

:root[data-theme="dark"] .shortcut-analytics {
    background: rgba(231, 182, 108, 0.15);
    color: #e7b66c;
}

:root[data-theme="dark"] .dashboard-logout {
    color: #f1a9a4;
    border-color: #553331;
    background: #231818;
}

:root[data-theme="dark"] .dashboard-logout:hover {
    color: #ffc2be;
    border-color: #7a4644;
    background: #312120;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

:root[data-theme="dark"] .news-card:hover {
    border-color: #50665a;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .emergency-board-section,
:root[data-theme="dark"] .emergency-board-privacy,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .activity-item,
:root[data-theme="dark"] .dashboard-shortcut,
:root[data-theme="dark"] .btn-secondary,
:root[data-theme="dark"] .content-count,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .site-nav a:hover,
:root[data-theme="dark"] .site-nav a.is-active {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--surface-muted);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .create-form input,
:root[data-theme="dark"] .create-form select,
:root[data-theme="dark"] .edit-form input,
:root[data-theme="dark"] .edit-form select,
:root[data-theme="dark"] .emergency-board-form input,
:root[data-theme="dark"] .emergency-board-form textarea {
    color: var(--text-primary);
    border-color: var(--border);
    background: #121c17;
}

:root[data-theme="dark"] .create-form label,
:root[data-theme="dark"] .edit-form label {
    color: var(--text-primary);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
    color: #84948a;
}

:root[data-theme="dark"] .site-nav a,
:root[data-theme="dark"] .menu-toggle,
:root[data-theme="dark"] .header-contact-icon,
:root[data-theme="dark"] .logo,
:root[data-theme="dark"] .text-link,
:root[data-theme="dark"] .back-link,
:root[data-theme="dark"] .contact-sender a,
:root[data-theme="dark"] .emergency-board-section dd a,
:root[data-theme="dark"] .auth-links a {
    color: var(--link);
}

:root[data-theme="dark"] .home-hero h1,
:root[data-theme="dark"] .news-card h3,
:root[data-theme="dark"] .managed-news-item h3,
:root[data-theme="dark"] .contact-inbox-item h3,
:root[data-theme="dark"] .content-panel-heading h1,
:root[data-theme="dark"] .content-panel-heading h2 {
    color: var(--text-heading);
}

:root[data-theme="dark"] .news-body {
    color: var(--text-primary);
}

:root[data-theme="dark"] .managed-news-item p,
:root[data-theme="dark"] .contact-message-body,
:root[data-theme="dark"] .contact-intro,
:root[data-theme="dark"] .activity-content p,
:root[data-theme="dark"] .activity-content strong,
:root[data-theme="dark"] .stat-label,
:root[data-theme="dark"] .auth-links,
:root[data-theme="dark"] .emergency-board-updated,
:root[data-theme="dark"] .emergency-board-form small,
:root[data-theme="dark"] .news-date {
    color: var(--text-muted);
}

:root[data-theme="dark"] .dashboard-shortcut:hover,
:root[data-theme="dark"] .btn-secondary:hover {
    color: var(--text-heading);
    border-color: #50665a;
    background: #2a3b32;
}

:root[data-theme="dark"] .alert-error {
    color: #ffc0b8;
    border-color: #75423f;
    background: #3a2524;
}

:root[data-theme="dark"] .alert-success {
    color: #b8e4c4;
    border-color: #3e674a;
    background: #213529;
}

:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .error-state {
    color: var(--text-muted);
}

:root[data-theme="dark"] .site-footer {
    color: var(--text-primary);
    background: #0b120e;
}

:root[data-theme="dark"] .site-footer .copyright,
:root[data-theme="dark"] .site-footer .footer-nav a {
    color: var(--text-muted);
}

:root[data-theme="dark"] #body {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--surface);
}

:root[data-theme="dark"] #body p {
    color: var(--text-muted);
}

:root[data-theme="dark"] #body h2,
:root[data-theme="dark"] #body strong {
    color: var(--text-heading);
}

:root[data-theme="light"] #body {
    color: #24312e;
    border-color: #dfe9e2;
    background: #ffffff;
}

:root[data-theme="light"] #body p {
    color: #687571;
}

:root[data-theme="light"] #body h2,
:root[data-theme="light"] #body strong {
    color: #20352d;
}

:root[data-theme="light"] .kicker {
    color: #38745f;
    border-color: #dfe9e2;
    background: #edf5ef;
    text-shadow: none;
}

:root[data-theme="light"] #body .block h2 {
    color: #38745f;
}

:root[data-theme="light"] #body .contact a {
    color: #24674f;
}

/* ── Über uns (About Page) Dark Theme ─────────────────────── */
:root[data-theme="dark"] .about-hero {
    background: linear-gradient(120deg, #1b2922 0%, #20332a 100%);
    border-color: var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .about-hero-content h1 {
    color: var(--text-heading);
}

:root[data-theme="dark"] .about-hero-content h1 span {
    color: #91c9ac;
}

:root[data-theme="dark"] .about-hero-lead {
    color: var(--text-muted);
}

:root[data-theme="dark"] .about-crest-sub {
    color: #91c9ac;
}

:root[data-theme="dark"] .about-crest-img {
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
}

:root[data-theme="dark"] .profile-card,
:root[data-theme="dark"] .value-card {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .profile-card:hover {
    border-color: #50665a;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .profile-name,
:root[data-theme="dark"] .value-card h3 {
    color: var(--text-heading);
}

:root[data-theme="dark"] .profile-fullname,
:root[data-theme="dark"] .value-card p {
    color: var(--text-muted);
}

:root[data-theme="dark"] .profile-role {
    color: #91c9ac;
}

:root[data-theme="dark"] .profile-quote {
    background: #14201a;
    border-color: #91c9ac;
    color: #c4d7cc;
}

:root[data-theme="dark"] .profile-bio {
    color: var(--text-primary);
}

:root[data-theme="dark"] .profile-card-footer {
    border-color: var(--border);
}

:root[data-theme="dark"] .profile-tag {
    background: #17241d;
    color: #91c9ac;
}

:root[data-theme="dark"] .profile-tags-label {
    color: var(--text-muted);
}

:root[data-theme="dark"] .profile-status-dot {
    border-color: var(--surface);
}

:root[data-theme="dark"] .profile-avatar-emerald {
    background: linear-gradient(135deg, #183324 0%, #1e4530 100%);
    color: #91c9ac;
}

:root[data-theme="dark"] .profile-avatar-teal {
    background: linear-gradient(135deg, #132f30 0%, #184143 100%);
    color: #82ded5;
}

:root[data-theme="dark"] .profile-badge-emerald {
    background: #172b20;
    color: #91c9ac;
}

:root[data-theme="dark"] .profile-badge-teal {
    background: #142b2c;
    color: #82ded5;
}

:root[data-theme="dark"] .about-cta-panel {
    background: linear-gradient(135deg, #182720 0%, #1e3328 100%);
    border-color: #2e4d3c;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

:root[data-theme="dark"] .about-cta-copy h3 {
    color: var(--text-heading);
}

:root[data-theme="dark"] .about-cta-copy p {
    color: var(--text-muted);
}

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