/* Brand artwork and document contents keep their own colors. */
:root[data-app-theme="light"]{color-scheme:light}
:root[data-app-theme="dark"]{color-scheme:dark;--text:#e6edf5;--text-mute:#aebdcd;--border:#3c4b5d;--bg:#101720;--card-bg:#1b2633;--form-surface:#18222f;--form-soft:#263444;--form-border:#52657a;--form-focus:#6ba3ec55;--form-danger:#ffb4b4;--form-success:#9be4b2;--gelb-hell:#3a321b;--grün-hell:#173b2b;--shadow:0 2px 10px #0005;--content-fallback:#101720;--content-overlay:#101720e8;--v437-accent-dark:#e6edf5}
:root[data-app-theme="dark"]{--page-bg:#101720;--v437-muted:#aebdcd;--v437-line:#3c4b5d;--v437-text:#e6edf5}
:root[data-app-theme="dark"]{--v437-surface:#1b2633;--v437-soft:#263444;--v437-shadow:0 2px 10px #0005}
:root[data-app-theme="dark"]{--platform-background:#101720;--platform-text:#e6edf5}
.app-appearance-choice{display:grid;gap:5px;padding:10px 12px;font-size:.9rem;font-weight:600;line-height:1.4}
.app-appearance-choice select{width:100%;min-height:44px;margin:0;padding:8px;font:inherit;border:1px solid var(--border,#dbe1e8);border-radius:8px;background:var(--card-bg,#fff);color:var(--text,#172033)}
html[data-app-theme="dark"] body{background-color:var(--bg)!important;color:var(--text)!important}
html[data-app-theme="dark"] :is(.card,.nav-tile,.member-section,.summary-box,.department-section,.department-hero,.settings-card,.settings-hub-card,.invoice-card,.app-create-panel,.app-plan-card,.ticket-card,.v412-order-card,.thread-view,.thread-list,.thread-row,.message-row,.chat-sidebar,.chat-main,.chat-list,.chat-message,.chat-pane,.v118-thread,.v427-thread,.encrypted-chat){background-color:var(--card-bg)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(.tenant-app>.page,.tenant-app>.page-wide,.tenant-app>main,.member-shell,.v118-form-shell,.app-form-section,.app-form-card){background-color:var(--bg)!important;color:var(--text)!important}
html[data-app-theme="dark"] :is(.app-user-menu,.app-context-menu,.app-context-static,.app-context-switcher,.app-more-panel,.app-primary-nav,.app-mobile-nav,.app-shell-top,.app-history-bar,.app-workspace-nav,.app-navigation-dialog,.app-segments,.v437-mobile-nav,.v437-more-grid,.v437-birthday-section,.v437-permissions-section,.v437-terms-card){background-color:var(--card-bg)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(.app-user-menu,.app-context-menu,.app-more-panel,.app-primary-nav,.app-mobile-nav,.app-history-bar,.app-navigation-dialog,.app-segments) :is(a,button,summary){color:var(--text)!important}
html[data-app-theme="dark"] :is(.app-user-button,.app-workspace-nav>a,.app-menu-close,.app-context-switcher summary,.app-context-switcher button,.app-history-bar button,.app-segments .btn,.btn-secondary,.btn-light){background-color:var(--form-soft)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(a,summary){color:#9bc5ff}
html[data-app-theme="dark"] :is(h1,h2,h3,h4,legend,label,th,td){color:var(--text)}
html[data-app-theme="dark"] :is(.hint,.subtitle,.member-meta,.app-field-help,.text-muted,.muted-text,small){color:var(--text-mute)!important}
html[data-app-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="color"]),textarea,select){background-color:var(--form-surface)!important;color:var(--text)!important;border-color:var(--form-border)!important}
html[data-app-theme="dark"] :is(input,textarea)::placeholder{color:#9aaabd!important;opacity:1}
html[data-app-theme="dark"] :is(input,textarea,select,button,a,summary):focus-visible{outline:3px solid #9bc5ff;outline-offset:3px}
html[data-app-theme="dark"] :is(table,thead,tbody,tr,th,td){background-color:var(--card-bg)!important;border-color:var(--border)!important;color:var(--text)!important}
html[data-app-theme="dark"] :is(th,tr:nth-child(even)>td){background-color:var(--form-soft)!important}
html[data-app-theme="dark"] :is(dialog,.vapp-error-dialog){background-color:#1b2633!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(.vapp-error-message,.vapp-error-title){color:var(--text)!important}
html[data-app-theme="dark"] :is(.error-box,.alert-danger,.form-error){background-color:#48272d!important;color:#ffd6d6!important;border-color:#bd6575!important}
html[data-app-theme="dark"] :is(.warning-box,.card.warn){background-color:#41351f!important;color:#ffe3a0!important;border-color:#ae8a40!important}
html[data-app-theme="dark"] :is(.success-box,.alert-success){background-color:#193b2b!important;color:#b7efcb!important;border-color:#4c9a6a!important}
html[data-app-theme="dark"] :is(.chat-message-own,.encrypted-chat-message-own,.is-active,[aria-current="page"]){background-color:#283c58!important;color:#ecf4ff!important}
html[data-app-theme="dark"] .app-design-content{background-color:var(--bg)!important}
html[data-app-theme="dark"] .encrypted-chat [data-chat-verification]{background-color:#332e1c;border-color:#aa914f}
html[data-app-theme="dark"] .encrypted-chat-message{background-color:var(--card-bg);border-color:var(--border)}
html[data-app-theme="dark"] :is(.v118-thread-message,.v118-thread-compose,.v427-tabs,.v427-thread-head,.v427-compose-wrap,.v428-comm-shell,.v428-comm-main,.v428-thread-main,.v428-card,.v428-context-card,.v437-more-panel section,.v437-more-search){background-color:var(--card-bg)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(.app-screen-title p,.app-menu-results,.app-team-stats small){color:var(--text-mute)!important}
@media(prefers-color-scheme:dark){html:not([data-app-theme]){color-scheme:dark}}
@media print{.app-appearance-choice{display:none!important}html[data-app-theme="dark"] body{background:#fff!important;color:#111!important}}

/* Visible without opening the account menu. A restores the device setting. */
#app-appearance-tools{position:fixed;top:calc(8px + env(safe-area-inset-top,0px));right:12px;z-index:70;display:inline-flex;align-items:center;gap:0;border:1px solid #8490a6;border-radius:999px;background:#111827ed;color:#fff;box-shadow:0 2px 8px #0004;isolation:isolate}
#app-appearance-tools button{display:inline-grid;place-items:center;flex:none;width:36px;min-width:36px;height:36px;min-height:36px;margin:0;padding:0!important;border:0!important;border-radius:999px;background:transparent!important;color:#fff!important;font:600 12px/1 system-ui,sans-serif;cursor:pointer;box-shadow:none!important}
#app-appearance-tools [data-app-theme-auto]{width:26px;min-width:26px;position:relative;border-radius:0 999px 999px 0}
#app-appearance-tools [data-app-theme-auto]::before{content:'';position:absolute;left:0;top:9px;bottom:9px;border-left:1px solid #8b96aa}
#app-appearance-tools [data-app-theme-auto][aria-pressed="true"]{color:#bdddff!important;text-decoration:underline;text-underline-offset:4px}
#app-appearance-tools svg{display:block;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.app-theme-sun{display:none}html[data-app-theme="dark"] .app-theme-sun{display:block}html[data-app-theme="dark"] .app-theme-moon{display:none}
#app-appearance-tools button:focus-visible{outline:3px solid #a9ceff!important;outline-offset:3px}
#app-appearance-tools[data-placement="account"],#app-appearance-tools[data-placement="platform"],#app-appearance-tools[data-placement="site"]{position:relative;top:auto;right:auto;align-self:center;flex:none;order:99}
html[data-app-theme] .app-user.app-appearance-account{display:flex!important;align-items:center!important;gap:6px!important;width:auto!important;min-width:112px!important;max-width:none!important}
.app-user.app-appearance-account>.app-user-button{flex:none}
.platform-nav>#app-appearance-tools{margin-left:12px}
@media(min-width:621px){
 html[data-app-theme] .vereinapp-stadion-head:has(#app-appearance-tools){max-width:calc(100% - 24px)!important}
 html[data-app-theme] .vereinapp-stadion-actions:has(#app-appearance-tools){min-width:0;flex-shrink:1;gap:6px}
 html[data-app-theme] .vereinapp-stadion-actions:has(#app-appearance-tools) .vereinapp-profile-slot{min-width:0;flex-shrink:1}
 html[data-app-theme] .vereinapp-stadion-actions:has(#app-appearance-tools) .app-context-main{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

/* Neutral hard-coded legacy colors receive the same palette as modern cards. */
html[data-app-theme="dark"] [data-app-neutral-surface]{background-color:var(--card-bg)!important}
html[data-app-theme="dark"] [data-app-neutral-gradient]{background-image:none!important}
html[data-app-theme="dark"] [data-app-neutral-ink="normal"]{color:var(--text)!important}
html[data-app-theme="dark"] [data-app-neutral-ink="quiet"]{color:var(--text-mute)!important}
html[data-app-theme="dark"] [data-app-neutral-ink="dark"]{color:#172033!important}
html[data-app-theme="dark"] :is(.member-event,.member-event-card,.v403-event-card,.v437-focus-card,.v437-birthday-card,.v437-permission-card){background-color:var(--card-bg)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(.app-context-main,.app-context-sub,.member-event-main,.member-event-main strong){color:var(--text)!important}
html[data-app-theme="dark"] :is(.member-event-type,.v437-date-badge strong){color:color-mix(in srgb,var(--grün,#bd2030) 45%,#fff 55%)!important}
html[data-app-theme="dark"] .v437-rsvp-label{background:#41351f!important;color:#ffe3a0!important}
html[data-app-theme="dark"] .v437-rsvp-label.member-rsvp-zugesagt{background:#193b2b!important;color:#b7efcb!important}
html[data-app-theme="dark"] .v437-rsvp-label.member-rsvp-abgesagt{background:#48272d!important;color:#ffd6d6!important}
@media print{.app-appearance-tools{display:none!important}}

/* Semantic success states remain green with the club brand palette. */
html[data-app-theme="dark"] .badge.badge-green{background-color:#193b2b!important;color:#b7efcb!important}

/* The shared website shell also styles the relocated profile menu. Keep its
   important white button rules inside the device/manual appearance palette. */
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu){background-color:var(--card-bg)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) button{background-color:var(--form-soft)!important;color:var(--text)!important;border-color:var(--border)!important;opacity:1!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) button:is(:hover,:focus-visible){background-color:#304156!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) button:focus-visible{outline:3px solid #9bc5ff!important;outline-offset:2px}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) button.is-active{background-color:#283c58!important;color:#ecf4ff!important;box-shadow:inset 3px 0 #9bc5ff!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) :is(strong,small,.app-context-group-title){opacity:1!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) strong{color:var(--text)!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) :is(small,.app-context-group-title){color:var(--text-mute)!important}
html[data-app-theme="dark"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) .app-context-close{background-color:var(--card-bg)!important;color:var(--text)!important}
html[data-app-theme="dark"] .vereinapp-platform-nav .vereinapp-profile-slot .app-context-switcher>summary{background-color:var(--form-soft)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-app-theme="dark"] .vereinapp-platform-nav .vereinapp-profile-slot .vereinapp-profile-label{color:var(--text-mute)!important}
html[data-app-theme="light"] .app-context-menu :is(strong,small,.app-context-group-title){opacity:1!important}
html[data-app-theme="light"] .app-context-menu strong{color:#172033!important}
html[data-app-theme="light"] .app-context-menu :is(small,.app-context-group-title){color:#526173!important}
html[data-app-theme="light"] :is(.app-context-menu,.vereinapp-platform-nav .vereinapp-profile-slot .app-context-menu) button:focus-visible{outline:3px solid #245a9b!important;outline-offset:2px}
