:root {
    --site-surface-base: #ffffff;
    --site-surface-soft: #f7f5f1;
    --site-surface-muted: #efe9df;
    --site-border-color: rgba(96, 76, 51, 0.12);
    --site-text-primary: #24180f;
    --site-text-secondary: #6e5b47;
    --site-shadow-soft: 0 18px 42px rgba(52, 39, 24, 0.08);
}

[data-bs-theme="dark"],
body.dark-mode {
    --site-surface-base: #191613;
    --site-surface-soft: #221e1a;
    --site-surface-muted: #2b2622;
    --site-border-color: rgba(216, 188, 154, 0.1);
    --site-text-primary: #f3ede4;
    --site-text-secondary: #ab9e90;
    --site-shadow-soft: 0 20px 48px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] body,
body.dark-mode {
    background: linear-gradient(180deg, #151310 0%, #191613 100%);
    color: var(--site-text-primary);
}

[data-bs-theme="dark"] .site-main-shell,
body.dark-mode .site-main-shell {
    background: transparent;
}

[data-bs-theme="dark"] main,
[data-bs-theme="dark"] section,
[data-bs-theme="dark"] article,
body.dark-mode main,
body.dark-mode section,
body.dark-mode article {
    color: inherit;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .accordion-item,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .dropdown-menu:not(.modern-dropdown-menu),
[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .page-item .page-link,
[data-bs-theme="dark"] .breadcrumb,
[data-bs-theme="dark"] .alert,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .form-check-input,
[data-bs-theme="dark"] .btn-light,
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer,
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .offcanvas,
body.dark-mode .accordion-item,
body.dark-mode .list-group-item,
body.dark-mode .dropdown-menu:not(.modern-dropdown-menu),
body.dark-mode .table,
body.dark-mode .page-item .page-link,
body.dark-mode .breadcrumb,
body.dark-mode .alert,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .input-group-text,
body.dark-mode .form-check-input,
body.dark-mode .btn-light,
body.dark-mode .bg-white,
body.dark-mode .bg-light,
body.dark-mode .card-header,
body.dark-mode .card-footer {
    background-color: var(--site-surface-soft) !important;
    border-color: var(--site-border-color) !important;
    color: var(--site-text-primary) !important;
    box-shadow: var(--site-shadow-soft);
}

[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] .form-select,
body.dark-mode .form-control::placeholder,
body.dark-mode .form-select {
    color: var(--site-text-secondary) !important;
}

[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] small,
body.dark-mode .text-muted,
body.dark-mode .text-secondary,
body.dark-mode small {
    color: var(--site-text-secondary) !important;
}

[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] p,
[data-bs-theme="dark"] li,
[data-bs-theme="dark"] dt,
[data-bs-theme="dark"] dd,
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] span,
[data-bs-theme="dark"] strong,
[data-bs-theme="dark"] div,
[data-bs-theme="dark"] a:not(.btn):not(.modern-brand):not(.modern-utility-button):not(.modern-icon-button):not(.user-profile-btn),
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode p,
body.dark-mode li,
body.dark-mode dt,
body.dark-mode dd,
body.dark-mode label,
body.dark-mode span,
body.dark-mode strong,
body.dark-mode div,
body.dark-mode a:not(.btn):not(.modern-brand):not(.modern-utility-button):not(.modern-icon-button):not(.user-profile-btn) {
    color: inherit;
}

[data-bs-theme="dark"] a:not(.btn):hover,
body.dark-mode a:not(.btn):hover {
    color: #f3d6aa;
}

[data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-dark,
body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-dark {
    color: var(--site-text-primary);
    border-color: var(--site-border-color);
}

[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-dark:hover,
body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-dark:hover {
    background-color: rgba(216, 188, 154, 0.12);
    border-color: rgba(216, 188, 154, 0.2);
}

[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table > :not(caption) > * > *,
body.dark-mode .table,
body.dark-mode .table > :not(caption) > * > * {
    color: var(--site-text-primary) !important;
    border-color: var(--site-border-color) !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *,
body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

[data-bs-theme="dark"] hr,
body.dark-mode hr {
    border-color: var(--site-border-color);
    opacity: 1;
}

[data-bs-theme="dark"] img,
body.dark-mode img {
    opacity: 0.98;
}

/* --- Survey Widget Dark Mode Contrast Overrides --- */
[data-bs-theme="dark"] .survey-widget-card,
body.dark-mode .survey-widget-card {
    background: var(--site-surface-soft) !important;
    border: 1px solid var(--site-border-color) !important;
}

[data-bs-theme="dark"] .survey-question-title,
body.dark-mode .survey-question-title {
    color: var(--site-text-primary) !important;
}

[data-bs-theme="dark"] .survey-option-card,
body.dark-mode .survey-option-card {
    background: var(--site-surface-base) !important;
    border-color: var(--site-border-color) !important;
}

[data-bs-theme="dark"] .survey-option-text,
body.dark-mode .survey-option-text {
    color: var(--site-text-primary) !important;
}

[data-bs-theme="dark"] .survey-radio-icon,
body.dark-mode .survey-radio-icon {
    color: var(--site-text-secondary) !important;
}

[data-bs-theme="dark"] .survey-radio-input:checked + .survey-option-card,
body.dark-mode .survey-radio-input:checked + .survey-option-card {
    border-color: var(--bs-primary, #5b6f57) !important;
    background: color-mix(in srgb, var(--bs-primary, #5b6f57) 12%, var(--site-surface-base)) !important;
}

[data-bs-theme="dark"] .survey-radio-input:checked + .survey-option-card .survey-option-text,
body.dark-mode .survey-radio-input:checked + .survey-option-card .survey-option-text {
    color: var(--bs-primary, #5b6f57) !important;
}

[data-bs-theme="dark"] .survey-radio-input:checked + .survey-option-card .check-icon,
body.dark-mode .survey-radio-input:checked + .survey-option-card .check-icon {
    color: var(--bs-primary, #5b6f57) !important;
}

[data-bs-theme="dark"] .result-bar-header,
body.dark-mode .result-bar-header {
    color: var(--site-text-primary) !important;
}

[data-bs-theme="dark"] .result-bar-container,
body.dark-mode .result-bar-container {
    background: var(--site-surface-muted) !important;
}

[data-bs-theme="dark"] .survey-submit-btn,
body.dark-mode .survey-submit-btn {
    background-color: var(--bs-primary, #5b6f57) !important;
    border-color: var(--bs-primary, #5b6f57) !important;
    color: #fffdf8 !important;
}

[data-bs-theme="dark"] .survey-submit-btn:hover,
body.dark-mode .survey-submit-btn:hover {
    background-color: color-mix(in srgb, var(--bs-primary, #5b6f57) 85%, #000) !important;
    border-color: color-mix(in srgb, var(--bs-primary, #5b6f57) 85%, #000) !important;
}

[data-bs-theme="dark"] .text-dark,
body.dark-mode .text-dark {
    color: var(--site-text-primary) !important;
}
