/*
 * Enterprise Theme Accessibility Overrides
 * Global contrast and hover readability hardening for light/dark themes.
 */

:root {
    --contrast-light-text: #0f172a;
    --contrast-light-muted: #334155;
    --contrast-dark-text: #f8fafc;
    --motion-interactive-duration: 180ms;
    --motion-surface-duration: 220ms;
    --sws-public-hover-border: rgba(75, 160, 255, 0.24);
    --sws-public-hover-shadow: 0 18px 36px rgba(6, 18, 34, 0.20);
    --sws-public-hover-shadow-light: 0 16px 34px rgba(22, 43, 80, 0.12);
    --sws-public-hover-fill: rgba(75, 160, 255, 0.08);
    --sws-public-hover-fill-light: rgba(30, 93, 184, 0.08);
    --sws-field-bg: #ffffff;
    --sws-field-border: #cbd5e1;
    --sws-field-text: #0f172a;
    --sws-field-placeholder: #64748b;
    --sws-menu-bg: #ffffff;
    --sws-menu-border: #d7e0ee;
    --sws-menu-text: #0f172a;
    --sws-menu-hover-bg: #eef4ff;
    --sws-focus-ring: rgba(30, 93, 184, 0.18);
    --sws-popup-bg: #ffffff;
    --sws-popup-border: #d7e0ee;
    --sws-popup-text: #0f172a;
    --sws-popup-backdrop: rgba(2, 6, 23, 0.46);
    --sws-popup-shadow: 0 24px 56px rgba(15, 23, 42, 0.22);
}

[data-theme="dark"] {
    --sws-field-bg: rgba(255, 255, 255, 0.06);
    --sws-field-border: rgba(255, 255, 255, 0.14);
    --sws-field-text: #f8fafc;
    --sws-field-placeholder: #94a3b8;
    --sws-menu-bg: #0d1a2e;
    --sws-menu-border: rgba(255, 255, 255, 0.12);
    --sws-menu-text: #f8fafc;
    --sws-menu-hover-bg: rgba(255, 255, 255, 0.08);
    --sws-focus-ring: rgba(96, 165, 250, 0.26);
    --sws-popup-bg: #0d1a2e;
    --sws-popup-border: rgba(255, 255, 255, 0.14);
    --sws-popup-text: #f8fafc;
    --sws-popup-backdrop: rgba(2, 6, 23, 0.72);
    --sws-popup-shadow: 0 28px 64px rgba(0, 0, 0, 0.46);
}

[data-theme="light"] {
    --sws-public-hover-border: rgba(30, 93, 184, 0.22);
    --sws-public-hover-fill: rgba(30, 93, 184, 0.07);
}

/* Keep button link states independent from global anchor hover rules */
a.btn,
a.btn:hover,
a.btn:focus,
a.btn:active,
a.btn:visited {
    text-decoration: none;
}

/* Primary button: always readable */
.btn-primary,
a.btn.btn-primary,
button.btn.btn-primary,
.btn-primary:hover,
a.btn.btn-primary:hover,
button.btn.btn-primary:hover,
.btn-primary:focus,
a.btn.btn-primary:focus,
.btn-primary:active,
a.btn.btn-primary:active,
.btn-primary:visited,
a.btn.btn-primary:visited {
    color: #ffffff !important;
}

/* Secondary button: dark mode */
.btn-secondary,
a.btn.btn-secondary,
button.btn.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.26);
    color: var(--contrast-dark-text) !important;
}

.btn-secondary:hover,
a.btn.btn-secondary:hover,
button.btn.btn-secondary:hover,
.btn-secondary:focus,
a.btn.btn-secondary:focus,
.btn-secondary:active,
a.btn.btn-secondary:active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.38);
    color: var(--contrast-dark-text) !important;
}

/* Secondary button: light mode */
[data-theme="light"] .btn-secondary,
[data-theme="light"] a.btn.btn-secondary,
[data-theme="light"] button.btn.btn-secondary {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--contrast-light-text) !important;
}

[data-theme="light"] .btn-secondary:hover,
[data-theme="light"] a.btn.btn-secondary:hover,
[data-theme="light"] button.btn.btn-secondary:hover,
[data-theme="light"] .btn-secondary:focus,
[data-theme="light"] a.btn.btn-secondary:focus,
[data-theme="light"] .btn-secondary:active,
[data-theme="light"] a.btn.btn-secondary:active {
    background: #cbd5e1;
    border-color: #94a3b8;
    color: var(--contrast-light-text) !important;
}

/* Ghost button contrast */
[data-theme="light"] .btn-ghost,
[data-theme="light"] a.btn.btn-ghost,
[data-theme="light"] button.btn.btn-ghost {
    background: #ffffff;
    border-color: #cbd5e1;
    color: var(--contrast-light-text) !important;
}

[data-theme="light"] .btn-ghost:hover,
[data-theme="light"] a.btn.btn-ghost:hover,
[data-theme="light"] button.btn.btn-ghost:hover {
    background: #eef4ff;
    border-color: #1e5db8;
    color: #0d3a7a !important;
}

/* Fix explicit white-background inline button variants (seen on some pages) */
.btn[style*="background: white"],
.btn[style*="background:#fff"],
.btn[style*="background: #fff"],
.btn[style*="background:#ffffff"],
.btn[style*="background: #ffffff"] {
    background: #ffffff !important;
    border: 1px solid #1e5db8 !important;
    color: #0d3a7a !important;
    box-shadow: none !important;
}

.btn[style*="background: white"]:hover,
.btn[style*="background:#fff"]:hover,
.btn[style*="background: #fff"]:hover,
.btn[style*="background:#ffffff"]:hover,
.btn[style*="background: #ffffff"]:hover {
    background: #eef4ff !important;
    color: #0d3a7a !important;
}

/* Light mode readability for core surfaces */
[data-theme="light"] .card,
[data-theme="light"] .card p,
[data-theme="light"] .admin-card,
[data-theme="light"] .admin-card p,
[data-theme="light"] .cp-card,
[data-theme="light"] .cp-card p,
[data-theme="light"] .sec-muted {
    color: var(--contrast-light-text);
}

[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
    color: var(--contrast-light-text) !important;
}

/* Global field consistency: input backgrounds, placeholder and focus in both themes */
html[data-theme] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html[data-theme] textarea,
html[data-theme] select,
html[data-theme] .cp-form-input,
html[data-theme] .cp-form-select,
html[data-theme] .cp-form-textarea,
html[data-theme] .admin-form input,
html[data-theme] .admin-form textarea,
html[data-theme] .admin-form select {
    background: var(--sws-field-bg) !important;
    border-color: var(--sws-field-border) !important;
    color: var(--sws-field-text) !important;
}

html[data-theme] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"])::placeholder,
html[data-theme] textarea::placeholder,
html[data-theme] .cp-form-input::placeholder,
html[data-theme] .cp-form-textarea::placeholder,
html[data-theme] .admin-form input::placeholder,
html[data-theme] .admin-form textarea::placeholder {
    color: var(--sws-field-placeholder) !important;
    opacity: 1 !important;
}

html[data-theme] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):focus,
html[data-theme] textarea:focus,
html[data-theme] select:focus,
html[data-theme] .cp-form-input:focus,
html[data-theme] .cp-form-select:focus,
html[data-theme] .cp-form-textarea:focus,
html[data-theme] .admin-form input:focus,
html[data-theme] .admin-form textarea:focus,
html[data-theme] .admin-form select:focus {
    box-shadow: 0 0 0 3px var(--sws-focus-ring) !important;
}

/* Dropdown and option consistency */
html[data-theme] select,
html[data-theme] select option,
html[data-theme] select optgroup {
    background: var(--sws-field-bg) !important;
    color: var(--sws-field-text) !important;
}

/* Ensure native popup rendering matches active theme across browsers */
html[data-theme="light"] select,
html[data-theme="light"] .cp-form-select,
html[data-theme="light"] .admin-form select {
    color-scheme: light !important;
}

html[data-theme="dark"] select,
html[data-theme="dark"] .cp-form-select,
html[data-theme="dark"] .admin-form select {
    color-scheme: dark !important;
}

html[data-theme="dark"] select option,
html[data-theme="dark"] select optgroup {
    background: #0d1a2e !important;
    color: #f8fafc !important;
}

html[data-theme="light"] select option,
html[data-theme="light"] select optgroup {
    background: #ffffff !important;
    color: #0f172a !important;
}

html[data-theme] select option:checked,
html[data-theme] select option:hover {
    background: #1e5db8 !important;
    color: #ffffff !important;
}

html[data-theme] select option:disabled {
    color: #94a3b8 !important;
    background: #f1f5f9 !important;
}

[data-theme="dark"] select option:disabled {
    color: #64748b !important;
    background: #0b1220 !important;
}

/* Menu surfaces */
html[data-theme] .crm-avatar-menu,
html[data-theme] .crm-mobile-nav,
html[data-theme] .cp-sidebar,
html[data-theme] .ap-sidebar,
html[data-theme] .bw-modal-box,
html[data-theme] .crm-modal-panel,
html[data-theme] .cp-modal-content,
html[data-theme] .admin-dropdown-menu,
html[data-theme] .callbacks-action-menu,
html[data-theme] .modal-content,
html[data-theme] .dropdown-menu,
html[data-theme] .admin-modal,
html[data-theme] .promo-popup,
html[data-theme] .promo-popup.enterprise,
html[data-theme] .promo-popup.promo-popup-ionos,
html[data-theme] .crm-modal-box {
    background: var(--sws-menu-bg) !important;
    border-color: var(--sws-menu-border) !important;
    color: var(--sws-menu-text) !important;
    box-shadow: var(--sws-popup-shadow) !important;
}

/* Overlay/backdrop consistency for all popup systems */
html[data-theme] .admin-modal-overlay,
html[data-theme] .callbacks-modal,
html[data-theme] .promo-popup-overlay,
html[data-theme] .crm-modal-backdrop,
html[data-theme] .modal,
html[data-theme] .bw-modal,
html[data-theme] .cp-modal,
html[data-theme] .crm-modal {
    background: var(--sws-popup-backdrop) !important;
}

/* Menu item/readability normalization across custom dropdown systems */
html[data-theme] .dropdown-menu a,
html[data-theme] .dropdown-menu button,
html[data-theme] .admin-dropdown-menu a,
html[data-theme] .admin-dropdown-menu button,
html[data-theme] .callbacks-action-menu a,
html[data-theme] .callbacks-action-menu button,
html[data-theme] .crm-avatar-menu a,
html[data-theme] .crm-mobile-nav a,
html[data-theme] .ap-nav-item,
html[data-theme] .cp-nav-item {
    color: var(--sws-menu-text) !important;
    background: transparent !important;
    border-color: transparent !important;
}

html[data-theme] .crm-avatar-menu a,
html[data-theme] .crm-mobile-nav a,
html[data-theme] .ap-nav-item,
html[data-theme] .cp-nav-item {
    color: var(--sws-menu-text) !important;
}

@media (max-width: 480px) {
    html,
    body,
    .cp-container,
    .cp-main,
    .cp-content {
        max-width: 100vw !important;
        overflow-x: clip !important;
    }
}

html[data-theme] .crm-avatar-menu a:hover,
html[data-theme] .crm-mobile-nav a:hover,
html[data-theme] .ap-nav-item:hover,
html[data-theme] .cp-nav-item:hover,
html[data-theme] .dropdown-menu a:hover,
html[data-theme] .dropdown-menu button:hover,
html[data-theme] .admin-dropdown-menu a:hover,
html[data-theme] .admin-dropdown-menu button:hover,
html[data-theme] .callbacks-action-menu a:hover,
html[data-theme] .callbacks-action-menu button:hover,
html[data-theme] .dropdown-menu a:focus-visible,
html[data-theme] .dropdown-menu button:focus-visible,
html[data-theme] .admin-dropdown-menu a:focus-visible,
html[data-theme] .admin-dropdown-menu button:focus-visible,
html[data-theme] .callbacks-action-menu a:focus-visible,
html[data-theme] .callbacks-action-menu button:focus-visible {
    background: var(--sws-menu-hover-bg) !important;
    color: var(--sws-menu-text) !important;
}

html[data-theme] .crm-modal-panel .text-slate-800,
html[data-theme] .crm-modal-panel .text-slate-700,
html[data-theme] .crm-modal-panel .text-slate-600,
html[data-theme] .crm-modal-panel .text-slate-500,
html[data-theme] .bw-modal-box .text-slate-800,
html[data-theme] .bw-modal-box .text-slate-700,
html[data-theme] .bw-modal-box .text-slate-600,
html[data-theme] .cp-modal-content .text-slate-800,
html[data-theme] .cp-modal-content .text-slate-700,
html[data-theme] .cp-modal-content .text-slate-600 {
    color: var(--sws-menu-text) !important;
}

/* Form controls inside popup/modal contexts */
html[data-theme] .modal-content input,
html[data-theme] .modal-content textarea,
html[data-theme] .modal-content select,
html[data-theme] .admin-modal input,
html[data-theme] .admin-modal textarea,
html[data-theme] .admin-modal select,
html[data-theme] .bw-modal-box input,
html[data-theme] .bw-modal-box textarea,
html[data-theme] .bw-modal-box select,
html[data-theme] .cp-modal-content input,
html[data-theme] .cp-modal-content textarea,
html[data-theme] .cp-modal-content select,
html[data-theme] .crm-modal-panel input,
html[data-theme] .crm-modal-panel textarea,
html[data-theme] .crm-modal-panel select,
html[data-theme] .callbacks-modal-panel input,
html[data-theme] .callbacks-modal-panel textarea,
html[data-theme] .callbacks-modal-panel select {
    background: var(--sws-field-bg) !important;
    border-color: var(--sws-field-border) !important;
    color: var(--sws-field-text) !important;
}

html[data-theme] input:disabled,
html[data-theme] textarea:disabled,
html[data-theme] select:disabled,
html[data-theme] input[readonly],
html[data-theme] textarea[readonly] {
    opacity: 1 !important;
    color: var(--sws-field-placeholder) !important;
    border-color: var(--sws-field-border) !important;
    background: color-mix(in srgb, var(--sws-field-bg) 86%, #94a3b8) !important;
}

/* Inline white text inside light admin cards caused unreadable content */
[data-theme="light"] .admin-card [style*="color:#fff"],
[data-theme="light"] .admin-card [style*="color: #fff"],
[data-theme="light"] .admin-card [style*="color:#ffffff"],
[data-theme="light"] .admin-card [style*="color: #ffffff"],
[data-theme="light"] .admin-card [style*="color: white"] {
    color: var(--contrast-light-text) !important;
}

/* Customer portal buttons */
.cp-btn-primary,
.cp-btn-primary:hover,
.cp-btn-primary:focus,
.cp-btn-primary:active {
    color: #ffffff !important;
}

[data-theme="light"] .cp-btn-secondary,
[data-theme="light"] .cp-btn-secondary:hover,
[data-theme="light"] .cp-btn-secondary:focus,
[data-theme="light"] .cp-btn-secondary:active {
    color: var(--contrast-light-text) !important;
}

[data-theme="dark"] .cp-btn-secondary,
[data-theme="dark"] .cp-btn-secondary:hover,
[data-theme="dark"] .cp-btn-secondary:focus,
[data-theme="dark"] .cp-btn-secondary:active {
    color: var(--contrast-dark-text) !important;
}

/* Hover remaster: stable hitboxes and cleaner visual feedback */
.btn,
.glass-btn,
.cp-btn,
.theme-toggle,
.nav-logo,
.card,
.service-card,
.process-step,
.differentiator-item,
.trust-bar-content,
.trust-item,
.stat-card,
.tool-card,
.status-card,
.cp-card {
    transition:
        background-color var(--motion-interactive-duration) ease,
        color var(--motion-interactive-duration) ease,
        border-color var(--motion-interactive-duration) ease,
        box-shadow var(--motion-surface-duration) ease,
        opacity var(--motion-interactive-duration) ease,
        filter var(--motion-interactive-duration) ease !important;
}

.btn:hover,
.btn:focus,
.glass-btn:hover,
.glass-btn:focus,
.theme-toggle:hover,
.theme-toggle:focus,
.nav-logo:hover,
.nav-logo:focus,
.card:hover,
.service-card:hover,
.process-step:hover,
.differentiator-item:hover,
.trust-bar-content:hover,
.trust-item:hover,
.stat-card:hover,
.tool-card:hover,
.status-card:hover,
.cp-card:hover {
    transform: none !important;
}

.card:hover,
.service-card:hover,
.process-step:hover,
.trust-bar-content:hover,
.cp-card:hover {
    box-shadow: 0 18px 34px rgba(3, 10, 20, 0.22) !important;
}

[data-theme="light"] .card:hover,
[data-theme="light"] .service-card:hover,
[data-theme="light"] .process-step:hover,
[data-theme="light"] .trust-bar-content:hover,
[data-theme="light"] .cp-card:hover {
    box-shadow: 0 16px 32px rgba(22, 43, 80, 0.12) !important;
}

.differentiator-item:hover,
.trust-item:hover,
.stat-card:hover,
.status-card:hover {
    box-shadow: 0 10px 24px rgba(3, 10, 20, 0.14) !important;
}

.tool-card:hover {
    box-shadow: 0 14px 30px rgba(30, 93, 184, 0.16) !important;
}

.tool-card:hover .tool-button,
.service-card:hover .service-icon {
    transform: none !important;
}

.btn-primary:hover,
.btn-secondary:hover,
.glass-btn-primary:hover,
.glass-btn-secondary:hover,
.cp-btn-primary:hover,
.cp-btn-secondary:hover,
.cp-btn-success:hover,
.cp-btn-error:hover,
.cp-btn-ghost:hover {
    filter: brightness(1.03);
}

main#mainContent .card,
main#mainContent .service-card,
main#mainContent .process-step,
main#mainContent .differentiator-item,
main#mainContent .trust-bar-content,
.navigation .btn,
.nav-mobile-menu .btn,
.footer-simple a,
.footer-links a,
.footer-cookie-btn,
.navigation .nav-menu a,
.navigation .nav-mobile-menu a {
    position: relative;
    isolation: isolate;
}

main#mainContent .card::after,
main#mainContent .service-card::after,
main#mainContent .differentiator-item::after,
main#mainContent .trust-bar-content::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(circle at top right, rgba(96, 165, 250, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 42%);
    transition: opacity var(--motion-surface-duration) ease;
}

[data-theme="light"] main#mainContent .card::after,
[data-theme="light"] main#mainContent .service-card::after,
[data-theme="light"] main#mainContent .differentiator-item::after,
[data-theme="light"] main#mainContent .trust-bar-content::after {
    background:
        radial-gradient(circle at top right, rgba(30, 93, 184, 0.10), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), transparent 38%);
}

.navigation .btn-primary::before,
.nav-mobile-menu .btn-primary::before,
main#mainContent .btn-primary::before {
    top: 1px !important;
    left: 1px !important;
    right: 1px !important;
    bottom: 1px !important;
    width: auto !important;
    height: auto !important;
    border-radius: inherit;
    transform: none !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 34%),
        radial-gradient(circle at 85% 25%, rgba(255, 255, 255, 0.14), transparent 26%) !important;
    opacity: 0.52;
    transition: opacity var(--motion-interactive-duration) ease, filter var(--motion-interactive-duration) ease !important;
}

.navigation .nav-menu a,
.navigation .nav-mobile-menu a,
.footer-simple a,
.footer-links a,
.footer-cookie-btn {
    border: 1px solid transparent;
    border-radius: 12px;
}

.footer-simple a.footer-cookie-link-plain {
    border: 1px solid transparent !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: var(--space-xs) var(--space-sm) !important;
}

.navigation .nav-menu a::after,
.navigation .nav-mobile-menu a::after,
.footer-simple a::after,
.footer-links a::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 6px;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, rgba(75, 160, 255, 0.95) 50%, transparent 100%);
    opacity: 0;
    transform: scaleX(0.72);
    transform-origin: center;
    transition: opacity var(--motion-interactive-duration) ease, transform var(--motion-interactive-duration) ease;
    pointer-events: none;
}

.footer-simple a.footer-cookie-link-plain::after {
    content: '' !important;
}

[data-theme="light"] .navigation .nav-menu a::after,
[data-theme="light"] .navigation .nav-mobile-menu a::after,
[data-theme="light"] .footer-simple a::after,
[data-theme="light"] .footer-links a::after {
    background: linear-gradient(90deg, transparent 0%, rgba(30, 93, 184, 0.9) 50%, transparent 100%);
}

/* Cookie settings button: remove legacy shine underline and keep unified hover behavior only. */
.footer-cookie-btn::after {
    content: none !important;
}

.trust-bar-content::before {
    background:
        radial-gradient(circle at 12% 50%, rgba(75, 160, 255, 0.12), transparent 24%),
        linear-gradient(90deg, transparent 0%, rgba(75, 160, 255, 0.03) 50%, transparent 100%) !important;
    opacity: 0.55;
    animation: none !important;
    background-position: center center !important;
    transition: opacity var(--motion-surface-duration) ease !important;
}

[data-theme="light"] .trust-bar-content::before {
    background:
        radial-gradient(circle at 12% 50%, rgba(30, 93, 184, 0.08), transparent 24%),
        linear-gradient(90deg, transparent 0%, rgba(30, 93, 184, 0.04) 50%, transparent 100%) !important;
}

@media (hover: hover) and (pointer: fine) {
    .navigation .nav-menu a:hover,
    .navigation .nav-mobile-menu a:hover,
    .footer-simple a:hover,
    .footer-links a:hover,
    .footer-cookie-btn:hover {
        background: var(--sws-public-hover-fill) !important;
        border-color: var(--sws-public-hover-border) !important;
        box-shadow: 0 10px 22px rgba(6, 18, 34, 0.08);
    }

    [data-theme="light"] .navigation .nav-menu a:hover,
    [data-theme="light"] .navigation .nav-mobile-menu a:hover,
    [data-theme="light"] .footer-simple a:hover,
    [data-theme="light"] .footer-links a:hover,
    [data-theme="light"] .footer-cookie-btn:hover {
        background: var(--sws-public-hover-fill-light) !important;
        box-shadow: 0 10px 22px rgba(22, 43, 80, 0.08);
    }

    .footer-simple a.footer-cookie-link-plain:hover,
    [data-theme="light"] .footer-simple a.footer-cookie-link-plain:hover {
        background: var(--sws-public-hover-fill) !important;
        border-color: var(--sws-public-hover-border) !important;
        box-shadow: 0 10px 22px rgba(6, 18, 34, 0.08) !important;
    }

    [data-theme="light"] .footer-simple a.footer-cookie-link-plain:hover {
        background: var(--sws-public-hover-fill-light) !important;
        box-shadow: 0 10px 22px rgba(22, 43, 80, 0.08) !important;
    }

    .navigation .nav-menu a:hover::after,
    .navigation .nav-mobile-menu a:hover::after,
    .footer-simple a:hover::after,
    .footer-links a:hover::after {
        opacity: 1;
        transform: scaleX(1);
    }

    .navigation .btn-primary:hover,
    .nav-mobile-menu .btn-primary:hover,
    main#mainContent .btn-primary:hover {
        box-shadow: 0 18px 34px rgba(30, 93, 184, 0.28), 0 0 44px rgba(75, 160, 255, 0.12) !important;
        filter: saturate(1.03) brightness(1.01) !important;
    }

    .navigation .btn-primary:hover::before,
    .nav-mobile-menu .btn-primary:hover::before,
    main#mainContent .btn-primary:hover::before {
        left: 1px !important;
        opacity: 0.9;
    }

    main#mainContent .btn-secondary:hover,
    main#mainContent .btn-ghost:hover,
    .navigation .theme-toggle:hover,
    .nav-mobile-menu .theme-toggle:hover {
        box-shadow: 0 14px 28px rgba(6, 18, 34, 0.14) !important;
    }

    [data-theme="light"] main#mainContent .btn-secondary:hover,
    [data-theme="light"] main#mainContent .btn-ghost:hover,
    [data-theme="light"] .navigation .theme-toggle:hover,
    [data-theme="light"] .nav-mobile-menu .theme-toggle:hover {
        box-shadow: 0 14px 28px rgba(22, 43, 80, 0.10) !important;
    }

    main#mainContent .card:hover,
    main#mainContent .service-card:hover,
    main#mainContent .process-step:hover,
    main#mainContent .differentiator-item:hover,
    main#mainContent .trust-bar-content:hover {
        border-color: var(--sws-public-hover-border) !important;
        box-shadow: var(--sws-public-hover-shadow) !important;
        filter: none !important;
    }

    [data-theme="light"] main#mainContent .card:hover,
    [data-theme="light"] main#mainContent .service-card:hover,
    [data-theme="light"] main#mainContent .process-step:hover,
    [data-theme="light"] main#mainContent .differentiator-item:hover,
    [data-theme="light"] main#mainContent .trust-bar-content:hover {
        box-shadow: var(--sws-public-hover-shadow-light) !important;
    }

    main#mainContent .card:hover::after,
    main#mainContent .service-card:hover::after,
    main#mainContent .differentiator-item:hover::after,
    main#mainContent .trust-bar-content:hover::after {
        opacity: 1;
    }

    main#mainContent .process-step:hover {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 42%),
            var(--color-card-bg) !important;
    }

    [data-theme="light"] main#mainContent .process-step:hover {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.84), transparent 36%),
            var(--color-card-bg) !important;
    }

    .trust-bar-content:hover::before {
        opacity: 0.88;
    }

    .trust-item:hover {
        box-shadow: none !important;
        filter: saturate(1.04);
    }
}

/* Process cards reserve ::after for connector arrows on desktop.
   Do not repurpose it for hover overlays, otherwise the hover sheen appears offset. */
@media (min-width: 1200px) {
    main#mainContent .process-step::after {
        content: '\2192';
        display: block;
        position: absolute;
        top: 50%;
        right: -32px;
        inset: auto;
        width: auto;
        height: auto;
        border-radius: 0;
        background: none;
        opacity: 0.78;
        transform: translateY(-50%);
        font-size: var(--font-size-3xl);
        font-weight: var(--font-weight-bold);
        color: var(--color-primary-base);
        pointer-events: none;
        transition: opacity var(--motion-interactive-duration) ease, color var(--motion-interactive-duration) ease;
    }

    main#mainContent .process-step:hover::after {
        opacity: 1;
        color: #4ba0ff;
    }

    [data-theme="light"] main#mainContent .process-step:hover::after {
        color: #1e5db8;
    }

    main#mainContent .process-step:last-child::after {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .glass-btn,
    .cp-btn,
    .theme-toggle,
    .nav-logo,
    .card,
    .service-card,
    .process-step,
    .differentiator-item,
    .trust-bar-content,
    .trust-item,
    .stat-card,
    .tool-card,
    .status-card,
    .cp-card,
    .service-icon,
    .tool-button,
    .card::after,
    .service-card::after,
    .process-step::after,
    .differentiator-item::after,
    .trust-bar-content::after,
    .btn::before,
    .glass-btn::before {
        animation: none !important;
        transition: none !important;
    }
}

/* Layout scroll fix: avoid nested page scrolling in main content areas */
@media (min-width: 769px) {
    .cp-container,
    .ap-shell,
    .ap-main,
    .cp-main {
        overflow: visible !important;
    }

    .cp-main,
    .ap-main {
        height: auto !important;
        max-height: none !important;
    }

    .cp-sidebar,
    .ap-sidebar {
        height: auto !important;
        max-height: none !important;
    }
}

/* Sidebar Edge Toggle (Customer/Admin/CRM) */
.sws-sidebar-edge-toggle {
    position: absolute;
    top: 50%;
    right: -13px;
    transform: translateY(-50%);
    width: 26px;
    height: 76px;
    border: 1px solid var(--sws-menu-border);
    border-left: 0;
    border-radius: 0 14px 14px 0;
    background: var(--sws-menu-bg);
    color: var(--sws-menu-text);
    box-shadow: 0 12px 22px rgba(2, 6, 23, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 180ms ease;
}

.sws-sidebar-edge-toggle:hover,
.sws-sidebar-edge-toggle:focus-visible {
    background: var(--sws-menu-hover-bg);
    color: var(--sws-menu-text);
    box-shadow: 0 16px 30px rgba(2, 6, 23, 0.28);
    outline: none;
}

.sws-sidebar-edge-toggle svg {
    width: 12px;
    height: 12px;
    display: block;
    transition: transform 180ms ease;
}

html[data-cp-sidebar="collapsed"] .cp-sidebar,
html[data-ap-sidebar="collapsed"] .ap-sidebar {
    margin-left: -244px !important;
    overflow: visible !important;
}

@media (min-width: 1024px) {
    .cp-content,
    .admin-container,
    .crm-main-shell {
        transition: max-width 220ms ease, width 220ms ease, padding 220ms ease;
    }

    html[data-cp-sidebar="expanded"] .cp-content {
        width: min(100%, var(--crm-content-max)) !important;
        max-width: min(100%, var(--crm-content-max)) !important;
    }

    html[data-cp-sidebar="collapsed"] .cp-content {
        width: min(100%, 1720px) !important;
        max-width: min(100%, 1720px) !important;
    }

    html[data-ap-sidebar="expanded"] .admin-container {
        max-width: 1400px !important;
    }

    html[data-ap-sidebar="collapsed"] .admin-container {
        max-width: 1720px !important;
    }
}

html[data-cp-sidebar="collapsed"] .cp-sidebar > *:not(.sws-sidebar-edge-toggle),
html[data-ap-sidebar="collapsed"] .ap-sidebar > *:not(.sws-sidebar-edge-toggle) {
    opacity: 0;
    pointer-events: none;
}

html[data-cp-sidebar="collapsed"] .cp-sidebar .sws-sidebar-edge-toggle svg,
html[data-ap-sidebar="collapsed"] .ap-sidebar .sws-sidebar-edge-toggle svg,
html[data-crm-aside="collapsed"] .crm-command-aside .sws-sidebar-edge-toggle svg,
html[data-crm-aside="collapsed"] .crm-sidebar .sws-sidebar-edge-toggle svg {
    transform: rotate(180deg);
}

@media (min-width: 1280px) {
    .crm-command-aside,
    .crm-sidebar {
        overflow: visible;
    }

    html[data-crm-aside="expanded"] .crm-main-shell {
        max-width: min(100%, 1480px) !important;
    }

    html[data-crm-aside="collapsed"] .crm-main-shell {
        max-width: min(100%, 1760px) !important;
    }

    .crm-page-wrap.crm-page-wrap--with-sidebar {
        transition: padding-left 220ms ease;
    }

    html[data-crm-aside="expanded"] .crm-page-wrap.crm-page-wrap--with-sidebar {
        padding-left: 308px !important;
    }

    html[data-crm-aside="collapsed"] .crm-page-wrap.crm-page-wrap--with-sidebar {
        padding-left: 24px !important;
    }

    html[data-crm-aside="collapsed"] .crm-layout-shell {
        grid-template-columns: 1rem minmax(0, 1fr) !important;
    }

    html[data-crm-aside="collapsed"] .crm-command-aside,
    html[data-crm-aside="collapsed"] .crm-sidebar {
        transform: translateX(calc(-100% + 16px));
    }

    html[data-crm-aside="collapsed"] .crm-command-aside > *:not(.sws-sidebar-edge-toggle),
    html[data-crm-aside="collapsed"] .crm-sidebar > *:not(.sws-sidebar-edge-toggle) {
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 1279px) {
    .crm-command-aside .sws-sidebar-edge-toggle,
    .crm-sidebar .sws-sidebar-edge-toggle {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .cp-sidebar .sws-sidebar-edge-toggle,
    .ap-sidebar .sws-sidebar-edge-toggle {
        display: none !important;
    }
}

/* Public scroll stability: avoid iOS/Android compositor scroll artifacts from fixed layers */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
    html,
    body {
        background-attachment: scroll !important;
    }

    .background-techlines-overlay,
    .hero-tech-lines,
    .hero-particles {
        display: none !important;
    }

    .navigation,
    .nav-mobile-menu,
    .theme-toggle,
    .footer-minimal,
    .footer-simple,
    .trust-bar-content,
    .card,
    .card-glass,
    .service-card,
    .process-step,
    .differentiator-item,
    .differentiators-image,
    .differentiators-badge,
    .cta-section-gradient,
    .google-rating-badge,
    .review-card,
    .reviews-empty,
    .qualification-trust-marker,
    .status-badge,
    main#mainContent [style*="backdrop-filter"],
    main#mainContent [style*="-webkit-backdrop-filter"] {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .trust-bar-content,
    .google-rating-badge,
    .review-card,
    .reviews-empty,
    .qualification-trust-marker,
    main#mainContent [style*="overflow: hidden"] {
        overflow: visible !important;
    }

    .review-author-avatar,
    .background-techlines-overlay,
    .hero,
    .hero.hero-compact,
    main#mainContent .card[style*="overflow: hidden"] > div[style*="height: 240px"],
    main#mainContent [style*="border-radius"][style*="overflow: hidden"] {
        overflow: hidden !important;
    }
}

/* Desktop-only stability for homepage services cards */
@media (min-width: 769px) {
    #leistungen.services-section,
    #leistungen .container,
    #leistungen .service-card > * {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        overflow-y: visible !important;
    }

    #leistungen .services-grid {
        grid-auto-rows: 1fr !important;
        align-items: stretch !important;
    }

    #leistungen .service-card {
        display: grid !important;
        grid-template-rows: auto auto 1fr !important;
        align-content: start !important;
        height: 100% !important;
        min-height: 100% !important;
        transform: none !important;
        isolation: auto !important;
        contain: none !important;
    }

    #leistungen .service-card .service-description {
        margin-bottom: 0 !important;
    }

    #leistungen .service-icon {
        overflow: hidden !important;
    }
}

/* Desktop CTA stability: keep CTA and immediate next section in page-level scroll flow */
@media (min-width: 769px) {
    /* Neutralize global desktop overflow-x locks from mobile-first layer inside public main content */
    main#mainContent,
    main#mainContent > .section,
    main#mainContent > .section > .container {
        overflow: visible !important;
    }

    main#mainContent .cta-section,
    main#mainContent .cta-section-gradient > .container,
    main#mainContent .cta-section + .section,
    main#mainContent .cta-section + .section > .container,
    main#mainContent .cta-section + .section [style*="max-width"] {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    main#mainContent .cta-section-gradient {
        overflow: hidden !important;
    }

    main#mainContent .cta-section-gradient::before {
        pointer-events: none;
    }
}

/* Standalone pages (without shared headers): unified light/dark surfaces */
.sws-standalone-page {
    color: #0f172a;
}

.sws-standalone-page .container,
.sws-standalone-page .checkout-card,
.sws-standalone-page .month-section,
.sws-standalone-page .callback-card,
.sws-standalone-page .card,
.sws-standalone-page .table-section,
.sws-standalone-page .empty-state,
.sws-standalone-page .info-item,
.sws-standalone-page .timeline,
.sws-standalone-page .success-box,
.sws-standalone-page .error-box,
.sws-standalone-page .next-steps,
.sws-standalone-page .info-card,
.sws-standalone-page .warning-box,
.sws-standalone-page .document-card {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #dbe3f1 !important;
}

html[data-theme="dark"] .sws-standalone-page {
    color: #e2e8f0;
}

html[data-theme="dark"] .sws-standalone-page .container,
html[data-theme="dark"] .sws-standalone-page .checkout-card,
html[data-theme="dark"] .sws-standalone-page .month-section,
html[data-theme="dark"] .sws-standalone-page .callback-card,
html[data-theme="dark"] .sws-standalone-page .card,
html[data-theme="dark"] .sws-standalone-page .table-section,
html[data-theme="dark"] .sws-standalone-page .empty-state,
html[data-theme="dark"] .sws-standalone-page .info-item,
html[data-theme="dark"] .sws-standalone-page .timeline,
html[data-theme="dark"] .sws-standalone-page .success-box,
html[data-theme="dark"] .sws-standalone-page .error-box,
html[data-theme="dark"] .sws-standalone-page .next-steps,
html[data-theme="dark"] .sws-standalone-page .info-card,
html[data-theme="dark"] .sws-standalone-page .warning-box,
html[data-theme="dark"] .sws-standalone-page .document-card,
html[data-theme="dark"] .sws-standalone-page .header,
html[data-theme="dark"] .sws-standalone-page header {
    background: #0d1a2e !important;
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .sws-standalone-page h1,
html[data-theme="dark"] .sws-standalone-page h2,
html[data-theme="dark"] .sws-standalone-page h3,
html[data-theme="dark"] .sws-standalone-page .callback-title,
html[data-theme="dark"] .sws-standalone-page .event-title,
html[data-theme="dark"] .sws-standalone-page .month-header,
html[data-theme="dark"] .sws-standalone-page .document-title,
html[data-theme="dark"] .sws-standalone-page .detail-label,
html[data-theme="dark"] .sws-standalone-page .field-value,
html[data-theme="dark"] .sws-standalone-page .timeline-title,
html[data-theme="dark"] .sws-standalone-page .timeline-text,
html[data-theme="dark"] .sws-standalone-page .section-title {
    color: #f8fafc !important;
}

html[data-theme="dark"] .sws-standalone-page p,
html[data-theme="dark"] .sws-standalone-page .subtitle,
html[data-theme="dark"] .sws-standalone-page .field-label,
html[data-theme="dark"] .sws-standalone-page .document-meta,
html[data-theme="dark"] .sws-standalone-page .document-number,
html[data-theme="dark"] .sws-standalone-page .timestamp {
    color: #94a3b8 !important;
}

html[data-theme="dark"] .sws-standalone-page table th {
    background: #14253f !important;
    color: #cbd5e1 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .sws-standalone-page table td,
html[data-theme="dark"] .sws-standalone-page .detail-row,
html[data-theme="dark"] .sws-standalone-page .callback-header,
html[data-theme="dark"] .sws-standalone-page .callback-footer,
html[data-theme="dark"] .sws-standalone-page .event-actions {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .sws-standalone-page tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

html[data-theme="dark"] .sws-standalone-page input,
html[data-theme="dark"] .sws-standalone-page select,
html[data-theme="dark"] .sws-standalone-page textarea {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="dark"] .sws-standalone-page .button-secondary,
html[data-theme="dark"] .sws-standalone-page .btn-secondary,
html[data-theme="dark"] .sws-standalone-page .filter-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="dark"] .sws-standalone-page .code-block {
    background: #020617 !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

html[data-theme="light"] .sws-maintenance-page {
    background: linear-gradient(180deg, #f1f6ff 0%, #dfeeff 45%, #d7ebff 100%) !important;
    color: #0f172a !important;
}

html[data-theme="light"] .sws-maintenance-page .status-badge,
html[data-theme="light"] .sws-maintenance-page .btn-secondary {
    background: rgba(255, 255, 255, 0.88) !important;
    color: #10213b !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
}

html[data-theme="light"] .sws-maintenance-page .description,
html[data-theme="light"] .sws-maintenance-page .progress-text {
    color: #334155 !important;
    text-shadow: none !important;
}
