:root {
    color-scheme: light;
}

:root[data-bs-theme="dark"] {
    color-scheme: dark;
    --bg-dark: #121821;
    --card-dark: #1e293b;
    --border-color: #3b4a5f;
    --text-main: #e2e8f0;
    --text-muted: #aab7c7;
    --bg-light: #121821;
    --white: #1e293b;
    --text-dark: #e2e8f0;
}

:root[data-bs-theme="light"] {
    --bg-dark: #f8f9fa;
    --card-dark: #fff;
    --border-color: #dee2e6;
    --text-main: #212529;
    --text-muted: #6c757d;
    --bg-light: #f8f9fa;
    --white: #fff;
    --text-dark: #212529;
}

.theme-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 0.25rem 0.8rem rgb(0 0 0 / 18%);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
}

.theme-toggle:hover {
    filter: brightness(0.94);
}

.theme-toggle:focus-visible {
    outline: 3px solid var(--bs-primary);
    outline-offset: 2px;
}

.theme-status {
    position: fixed;
    right: 1.25rem;
    bottom: 5rem;
    z-index: 1080;
    max-width: min(24rem, calc(100vw - 2.5rem));
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: var(--bs-danger);
    color: #fff;
    box-shadow: 0 0.25rem 0.8rem rgb(0 0 0 / 18%);
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.5rem);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-status.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.policy-footer {
    border-color: var(--bs-border-color) !important;
}

.policy-footer-links {
    flex-wrap: wrap;
}

.policy-footer-links a {
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.policy-footer-links a:hover,
.policy-footer-links a:focus-visible {
    color: var(--bs-primary);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.policy-modal .modal-content {
    overflow: hidden;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.policy-modal-header,
.policy-modal-footer {
    padding: 1.25rem 1.5rem;
    border-color: var(--bs-border-color);
    background: var(--bs-body-bg);
}

.policy-modal-header {
    align-items: flex-start;
    gap: 1rem;
}

.policy-modal-header .modal-title {
    margin-top: 0.2rem;
    color: var(--bs-emphasis-color);
    font-size: 1.35rem;
}

.policy-modal-eyebrow {
    color: var(--bs-primary);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.policy-content {
    padding: 1.25rem 1.5rem 1.75rem;
    color: var(--bs-body-color);
    font-size: 0.9rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.policy-updated {
    margin: 0 0 1.1rem;
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 600;
}

.policy-intro {
    margin: 0 0 1.5rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--bs-primary-border-subtle);
    border-radius: 0.85rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-emphasis-color);
}

.policy-section {
    margin: 0 0 1.35rem;
    padding: 0 0 1.2rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.policy-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.policy-section h3 {
    margin: 0 0 0.55rem;
    color: var(--bs-emphasis-color);
    font-size: 1rem;
    font-weight: 750;
    line-height: 1.5;
}

.policy-section p {
    margin: 0 0 0.65rem;
}

.policy-section p:last-child {
    margin-bottom: 0;
}

.policy-list {
    display: grid;
    gap: 0.45rem;
    margin: 0.55rem 0 0.75rem;
    padding-left: 1.25rem;
}

.policy-list li::marker {
    color: var(--bs-primary);
}

.policy-callout {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--bs-info-border-subtle);
    border-radius: 0.85rem;
    background: var(--bs-info-bg-subtle);
    color: var(--bs-emphasis-color);
}

.policy-callout-warning {
    border-color: var(--bs-warning-border-subtle);
    background: var(--bs-warning-bg-subtle);
}

.policy-modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--bs-border-color);
}

:root[data-bs-theme="dark"] body,
:root[data-bs-theme="dark"] body.bg-light {
    background-color: #121821 !important;
    color: #e2e8f0;
}

:root[data-bs-theme="dark"] .bg-light,
:root[data-bs-theme="dark"] .bg-body-secondary,
:root[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #263449 !important;
    color: #e2e8f0 !important;
}

:root[data-bs-theme="dark"] .bg-white,
:root[data-bs-theme="dark"] .card,
:root[data-bs-theme="dark"] .modal-content,
:root[data-bs-theme="dark"] .dropdown-menu,
:root[data-bs-theme="dark"] .list-group-item,
:root[data-bs-theme="dark"] .filter-bar,
:root[data-bs-theme="dark"] .table-container,
:root[data-bs-theme="dark"] .glass-card,
:root[data-bs-theme="dark"] #sidebar,
:root[data-bs-theme="dark"] .sidebar,
:root[data-bs-theme="dark"] .sidebar-header,
:root[data-bs-theme="dark"] .sidebar-profile {
    background-color: #1e293b !important;
    color: #e2e8f0;
}

:root[data-bs-theme="dark"] .text-dark,
:root[data-bs-theme="dark"] .text-body,
:root[data-bs-theme="dark"] .logo-text,
:root[data-bs-theme="dark"] .fc .fc-toolbar-title {
    color: #e2e8f0 !important;
}

:root[data-bs-theme="dark"] .text-muted,
:root[data-bs-theme="dark"] .text-secondary {
    color: #aab7c7 !important;
}

:root[data-bs-theme="dark"] .border,
:root[data-bs-theme="dark"] .border-top,
:root[data-bs-theme="dark"] .border-bottom,
:root[data-bs-theme="dark"] .border-start,
:root[data-bs-theme="dark"] .border-end,
:root[data-bs-theme="dark"] .table,
:root[data-bs-theme="dark"] .table td,
:root[data-bs-theme="dark"] .table th,
:root[data-bs-theme="dark"] .list-group-item {
    border-color: #3b4a5f !important;
}

:root[data-bs-theme="dark"] .form-control,
:root[data-bs-theme="dark"] .form-select,
:root[data-bs-theme="dark"] .input-group-text,
:root[data-bs-theme="dark"] .form-check-input {
    background-color: #111827;
    border-color: #475569;
    color: #e2e8f0;
}

:root[data-bs-theme="dark"] .form-control::placeholder {
    color: #94a3b8;
}

:root[data-bs-theme="dark"] .table {
    --bs-table-color: #e2e8f0;
    --bs-table-bg: #1e293b;
    --bs-table-striped-bg: #263449;
    --bs-table-hover-bg: #334155;
    --bs-table-border-color: #3b4a5f;
}

:root[data-bs-theme="dark"] .table thead th,
:root[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: #263449 !important;
    color: #e2e8f0;
}

:root[data-bs-theme="dark"] .fc .fc-scrollgrid,
:root[data-bs-theme="dark"] .fc .fc-scrollgrid td,
:root[data-bs-theme="dark"] .fc .fc-scrollgrid th {
    border-color: #3b4a5f;
}

:root[data-bs-theme="dark"] .fc .fc-daygrid-day,
:root[data-bs-theme="dark"] .fc .fc-col-header-cell {
    background-color: #1e293b;
}

:root[data-bs-theme="dark"] .fc .fc-daygrid-day-number,
:root[data-bs-theme="dark"] .fc .fc-col-header-cell-cushion,
:root[data-bs-theme="dark"] .fc .fc-day-other .fc-daygrid-day-number {
    color: #d5deea;
}

:root[data-bs-theme="dark"] .fc .fc-button {
    background-color: #263449 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}

:root[data-bs-theme="dark"] .fc .fc-button:hover {
    background-color: #334155 !important;
}

:root[data-bs-theme="dark"] .fc .fc-today-button {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
}

:root[data-bs-theme="dark"] .fc .fc-day-sun {
    background-color: #3b2630 !important;
}

:root[data-bs-theme="dark"] .fc .fc-day-sat {
    background-color: #233449 !important;
}

:root[data-bs-theme="dark"] .fc .fc-day-sun .fc-daygrid-day-number,
:root[data-bs-theme="dark"] .fc .fc-day-sun .fc-col-header-cell-cushion {
    color: #ff9ca8 !important;
}

:root[data-bs-theme="dark"] .fc .fc-day-sat .fc-daygrid-day-number,
:root[data-bs-theme="dark"] .fc .fc-day-sat .fc-col-header-cell-cushion {
    color: #8fc5ff !important;
}

:root[data-bs-theme="dark"] .fc .fc-daygrid-day:has(.fc-bg-event) {
    background-color: #432a32 !important;
}

:root[data-bs-theme="dark"] .fc .fc-bg-event {
    background-color: #a94758 !important;
    opacity: 0.24;
}

:root[data-bs-theme="dark"] .fc .fc-day-today {
    background-color: #293951 !important;
    box-shadow: inset 0 0 0 2px #60a5fa;
}

:root[data-bs-theme="dark"] .holiday-label {
    color: #ff9ca8 !important;
}

:root[data-bs-theme="dark"] .pay-stub {
    background: #fff !important;
    border: 1px solid #d8dee8 !important;
    color: #212529 !important;
}

:root[data-bs-theme="dark"] .pay-stub .text-dark,
:root[data-bs-theme="dark"] .pay-stub .text-body {
    color: #212529 !important;
}

:root[data-bs-theme="dark"] .pay-stub .text-muted {
    color: #5f6873 !important;
}

:root[data-bs-theme="dark"] .pay-stub .table {
    --bs-table-color: #212529;
    --bs-table-bg: transparent;
    --bs-table-border-color: #dee2e6;
    color: #212529 !important;
}

:root[data-bs-theme="dark"] .pay-stub .table > :not(caption) > * > * {
    color: #212529;
    background-color: transparent;
}

:root[data-bs-theme="dark"] .pay-stub .border-dark {
    border-color: #343a40 !important;
}

:root[data-bs-theme="dark"] .pay-stub .border-top {
    border-color: #dee2e6 !important;
}

:root[data-bs-theme="dark"] .pay-stub .bg-primary.bg-opacity-10 {
    background-color: #e8f0ff !important;
}

:root[data-bs-theme="dark"] .pay-stub .badge.bg-secondary-subtle {
    background-color: #e9ecef !important;
    color: #495057 !important;
}

:root[data-bs-theme="light"] body,
:root[data-bs-theme="light"] body.bg-dark {
    background-color: #f8f9fa !important;
    color: #212529;
}

:root[data-bs-theme="light"] .sidebar,
:root[data-bs-theme="light"] .sidebar-header,
:root[data-bs-theme="light"] .sidebar-profile,
:root[data-bs-theme="light"] .content-wrapper,
:root[data-bs-theme="light"] .content-section,
:root[data-bs-theme="light"] .table-container,
:root[data-bs-theme="light"] .glass-card,
:root[data-bs-theme="light"] .card,
:root[data-bs-theme="light"] .modal-content {
    background-color: #fff !important;
    color: #212529;
}

:root[data-bs-theme="light"] .text-light {
    color: #212529 !important;
}

:root[data-bs-theme="light"] .sidebar .nav-link {
    color: #475569 !important;
}

:root[data-bs-theme="light"] .sidebar .nav-link:hover,
:root[data-bs-theme="light"] .sidebar .nav-link.active,
:root[data-bs-theme="light"] .sidebar > .text-white {
    color: #212529 !important;
}

:root[data-bs-theme="light"] .text-muted {
    color: #6c757d !important;
}

:root[data-bs-theme="light"] .form-control,
:root[data-bs-theme="light"] .form-select,
:root[data-bs-theme="light"] .search-box {
    background-color: #fff;
    color: #212529;
}

:root[data-bs-theme="light"] .table thead th {
    background-color: #f8fafc !important;
    color: #475569 !important;
}

:root[data-bs-theme="light"] .table tbody tr:hover {
    background-color: #f8fafc !important;
}

:root[data-bs-theme="light"] .sidebar {
    background-color: #fff !important;
    border-color: #e2e8f0 !important;
    color: #1f2937 !important;
    box-shadow: 0 0.5rem 1.5rem rgb(15 23 42 / 6%);
}

:root[data-bs-theme="light"] .sidebar > .text-white,
:root[data-bs-theme="light"] .sidebar .nav-link,
:root[data-bs-theme="light"] .sidebar .btn-outline-secondary {
    color: #334155 !important;
}

:root[data-bs-theme="light"] .sidebar .nav-link:hover {
    background-color: #f1f5f9 !important;
    color: #1d4ed8 !important;
}

:root[data-bs-theme="light"] .sidebar .nav-link.active {
    background-color: #eff6ff !important;
    border-left-color: #2563eb !important;
    color: #1d4ed8 !important;
}

:root[data-bs-theme="light"] .sidebar .btn-outline-secondary {
    border-color: #cbd5e1 !important;
}

:root[data-bs-theme="light"] .main-content {
    color: #1f2937;
}

:root[data-bs-theme="light"] .main-content .text-white,
:root[data-bs-theme="light"] .main-content .text-white-50,
:root[data-bs-theme="light"] .modal-content .text-white,
:root[data-bs-theme="light"] .modal-content .text-white-50 {
    color: #334155 !important;
}

:root[data-bs-theme="light"] .main-content .card-net-salary .text-white,
:root[data-bs-theme="light"] .main-content .card-net-salary .text-white-50,
:root[data-bs-theme="light"] .main-content .bg-success .text-white,
:root[data-bs-theme="light"] .main-content .bg-success .text-white-50,
:root[data-bs-theme="light"] .modal-content .bg-primary .text-white {
    color: #fff !important;
}

:root[data-bs-theme="light"] .main-content .card-net-salary {
    background: linear-gradient(145deg, #198754, #0f5132) !important;
}

:root[data-bs-theme="light"] .main-content .table-container,
:root[data-bs-theme="light"] .main-content .card,
:root[data-bs-theme="light"] .modal-content {
    border-color: #e2e8f0 !important;
    box-shadow: 0 0.5rem 1.5rem rgb(15 23 42 / 6%);
}

:root[data-bs-theme="light"] .main-content .table {
    --bs-table-color: #334155;
    --bs-table-bg: #fff;
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f1f5f9;
    --bs-table-border-color: #e2e8f0;
}

:root[data-bs-theme="light"] .main-content .table thead th,
:root[data-bs-theme="light"] .main-content .table-container > .px-4 {
    background-color: #f8fafc !important;
    color: #475569 !important;
}

:root[data-bs-theme="light"] .main-content .table-hover tbody tr:hover {
    background-color: #f1f5f9 !important;
}

:root[data-bs-theme="light"] .main-content .form-control,
:root[data-bs-theme="light"] .main-content .form-select,
:root[data-bs-theme="light"] .modal-content .form-control,
:root[data-bs-theme="light"] .modal-content .form-select,
:root[data-bs-theme="light"] .modal-content .input-group-text {
    background-color: #fff !important;
    border-color: #cbd5e1 !important;
    color: #1f2937 !important;
}

:root[data-bs-theme="light"] .main-content .form-control::placeholder,
:root[data-bs-theme="light"] .modal-content .form-control::placeholder {
    color: #64748b !important;
}

:root[data-bs-theme="light"] .main-content .form-control:focus,
:root[data-bs-theme="light"] .main-content .form-select:focus,
:root[data-bs-theme="light"] .modal-content .form-control:focus,
:root[data-bs-theme="light"] .modal-content .form-select:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 18%) !important;
}

:root[data-bs-theme="light"] .bg-light-dark,
:root[data-bs-theme="light"] .main-content .bg-light {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

:root[data-bs-theme="light"] .bg-dark {
    background-color: #e9eef5 !important;
    color: #334155 !important;
}

:root[data-bs-theme="light"] .bg-dark .text-secondary {
    color: #475569 !important;
}

:root[data-bs-theme="light"] .main-content .badge.bg-dark {
    border-color: #cbd5e1 !important;
}

:root[data-bs-theme="light"] .main-content .btn-outline-secondary {
    border-color: #cbd5e1 !important;
    color: #475569 !important;
}

:root[data-bs-theme="light"] .main-content .btn-outline-secondary:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #1f2937 !important;
}

@media (max-width: 575.98px) {
    .theme-toggle {
        right: 0.75rem;
        bottom: 0.75rem;
        padding: 0.55rem 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-status {
        transition: none;
    }
}
