.audit-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 0;
    border-radius: 0.4rem;
    padding: 0.4rem 0.45rem;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 0.95rem;
    white-space: nowrap;
}

.audit-page .navbar .audit-theme-toggle {
    padding: 0.4rem 0.45rem;
    color: rgba(255, 255, 255, 0.85);
}

#user-tools .audit-theme-toggle {
    margin-left: 0.4rem;
    color: inherit;
    vertical-align: middle;
}

.audit-theme-toggle:hover,
.audit-theme-toggle:focus-visible,
.audit-page .navbar .audit-theme-toggle:hover {
    background: rgba(127, 127, 127, 0.16);
    color: inherit;
}

.audit-theme-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.audit-theme-toggle-sun,
.audit-theme-toggle-moon {
    line-height: 1;
    opacity: 0.45;
}

.audit-theme-toggle-sun { opacity: 1; }

.audit-theme-toggle-track {
    position: relative;
    display: inline-block;
    width: 1.5rem;
    height: 0.8rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    opacity: 0.8;
}

.audit-theme-toggle-thumb {
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 50%;
    background: currentColor;
    transition: transform 0.15s ease;
}

.audit-theme-toggle[aria-pressed="true"] .audit-theme-toggle-thumb {
    transform: translateX(0.7rem);
}

.audit-theme-toggle[aria-pressed="true"] .audit-theme-toggle-sun { opacity: 0.45; }
.audit-theme-toggle[aria-pressed="true"] .audit-theme-toggle-moon { opacity: 1; }

.audit-theme-toggle-floating {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 10001;
    border: 1px solid #c9c9c9;
    background: #fff;
    color: #333;
}

html[data-bs-theme="dark"] .audit-theme-toggle-floating {
    border-color: #454545;
    background: #101010;
    color: #f0f0f0;
}

html[data-bs-theme="dark"] {
    color-scheme: dark;
    --bg: #000;
    --panel: #080808;
    --panel-2: #101010;
    --line: #303030;
    --line-dark: #454545;
    --text: #f0f0f0;
    --muted: #b7b7b7;
    --section: #15231d;
    --section-2: #101a15;
    --accent: #86c9ff;
    --accent-2: #a7d6ff;
    --bs-body-bg: #000;
    --bs-body-bg-rgb: 0, 0, 0;
    --bs-body-color: #f0f0f0;
    --bs-body-color-rgb: 240, 240, 240;
    --bs-emphasis-color: #fff;
    --bs-secondary-bg: #101010;
    --bs-tertiary-bg: #0b0b0b;
    --bs-border-color: #303030;
    --body-bg: #000;
    --body-fg: #f0f0f0;
    --header-bg: #0b0b0b;
    --header-color: #fff;
    --breadcrumbs-bg: #111;
    --darkened-bg: #101010;
    --selected-bg: #18231d;
    --selected-row: #101a15;
    --border-color: #303030;
    --link-fg: #8ac7ff;
    --link-hover-color: #b9e0ff;
}

html[data-bs-theme="dark"] body {
    background: #000 !important;
    color: #f0f0f0 !important;
}

html[data-bs-theme="dark"] body .container,
html[data-bs-theme="dark"] body .card,
html[data-bs-theme="dark"] body .card-body,
html[data-bs-theme="dark"] body .table-responsive,
html[data-bs-theme="dark"] body .hero,
html[data-bs-theme="dark"] body .help-card,
html[data-bs-theme="dark"] body .login-card,
html[data-bs-theme="dark"] body .cert-form,
html[data-bs-theme="dark"] body .activity-card,
html[data-bs-theme="dark"] body .header-info,
html[data-bs-theme="dark"] body .field,
html[data-bs-theme="dark"] body .chip {
    background: #080808 !important;
    color: #f0f0f0;
    border-color: #303030 !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] body .navbar,
html[data-bs-theme="dark"] body .navbar-dark.bg-dark,
html[data-bs-theme="dark"] body .card-header.bg-primary,
html[data-bs-theme="dark"] body .card-header.bg-danger {
    background: #0b0b0b !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] body .navbar .container {
    background: transparent !important;
    border: 0 !important;
}

html[data-bs-theme="dark"] body .header,
html[data-bs-theme="dark"] body .card-header,
html[data-bs-theme="dark"] body .btnbar,
html[data-bs-theme="dark"] body .legend span,
html[data-bs-theme="dark"] body .radio-group label,
html[data-bs-theme="dark"] body .checklist-badge,
html[data-bs-theme="dark"] body .role-badge,
html[data-bs-theme="dark"] body .meta,
html[data-bs-theme="dark"] body .filter-form,
html[data-bs-theme="dark"] body .f31-bee-assessment,
html[data-bs-theme="dark"] body .btnbar-preview-floating {
    background: #111 !important;
    color: #f0f0f0 !important;
    border-color: #383838 !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] body .cert-form h2,
html[data-bs-theme="dark"] body .activity-card.selected,
html[data-bs-theme="dark"] body .audit-loading-panel,
html[data-bs-theme="dark"] body .page .badge,
html[data-bs-theme="dark"] body .error-message,
html[data-bs-theme="dark"] body .nomenclature-suggestions,
html[data-bs-theme="dark"] body .checklist-errors,
html[data-bs-theme="dark"] body .checklist-legacy,
html[data-bs-theme="dark"] body .checklist-messages,
html[data-bs-theme="dark"] body .bg-light:not(.badge),
html[data-bs-theme="dark"] body .bg-white {
    background: #151515 !important;
    color: #f0f0f0 !important;
    border-color: #454545 !important;
}

html[data-bs-theme="dark"] body .header h1,
html[data-bs-theme="dark"] body .header h2,
html[data-bs-theme="dark"] body .card h1,
html[data-bs-theme="dark"] body .activity-card .card-title,
html[data-bs-theme="dark"] body .login-header h1,
html[data-bs-theme="dark"] body .section-title,
html[data-bs-theme="dark"] body .login-header p,
html[data-bs-theme="dark"] body .form-group label,
html[data-bs-theme="dark"] body .muted-note,
html[data-bs-theme="dark"] body .label {
    color: #f0f0f0 !important;
}

html[data-bs-theme="dark"] body table,
html[data-bs-theme="dark"] body .info-table,
html[data-bs-theme="dark"] body .audit-table,
html[data-bs-theme="dark"] body form > table {
    background: #080808 !important;
    border-color: #303030 !important;
}

html[data-bs-theme="dark"] body th,
html[data-bs-theme="dark"] body .info-table th,
html[data-bs-theme="dark"] body .f31-bee-table th {
    background: #151515 !important;
    color: #f0f0f0 !important;
    border-color: #303030 !important;
}

html[data-bs-theme="dark"] body td,
html[data-bs-theme="dark"] body .info-table td,
html[data-bs-theme="dark"] body td:first-child,
html[data-bs-theme="dark"] body td:nth-child(4) {
    background: #080808 !important;
    color: #f0f0f0 !important;
    border-color: #303030 !important;
}

html[data-bs-theme="dark"] body tbody tr.section-row td,
html[data-bs-theme="dark"] body tbody tr[style*="background:#eef2f7"] td {
    background: #15231d !important;
    color: #f0f0f0 !important;
}

html[data-bs-theme="dark"] body tbody tr.state-yes td { background: #0d2117 !important; }
html[data-bs-theme="dark"] body tbody tr.state-na td { background: #28200e !important; }
html[data-bs-theme="dark"] body tbody tr.state-no td { background: #2b1414 !important; }

html[data-bs-theme="dark"] body input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]),
html[data-bs-theme="dark"] body select,
html[data-bs-theme="dark"] body textarea,
html[data-bs-theme="dark"] body .form-control,
html[data-bs-theme="dark"] body .form-select {
    background: #101010 !important;
    color: #f0f0f0 !important;
    border-color: #555 !important;
}

html[data-bs-theme="dark"] body input::placeholder,
html[data-bs-theme="dark"] body textarea::placeholder { color: #aaa; }

html[data-bs-theme="dark"] body a:not(.btn):not(.nav-link):not(.navbar-brand) {
    color: #8ac7ff;
}

html[data-bs-theme="dark"] body .audit-loading-overlay.is-visible {
    background: rgba(0, 0, 0, 0.75);
}

html[data-bs-theme="dark"] body .hero p,
html[data-bs-theme="dark"] body .hero .meta,
html[data-bs-theme="dark"] body .page .label,
html[data-bs-theme="dark"] body .text-muted {
    color: #b7b7b7 !important;
}

html[data-bs-theme="dark"] body .btn:not(.btn-primary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-outline-primary):not(.btn-outline-success):not(.btn-outline-danger) {
    background: #181818;
    color: #f0f0f0;
    border-color: #505050;
}

html[data-bs-theme="dark"] body .table {
    --bs-table-bg: #080808;
    --bs-table-color: #f0f0f0;
    --bs-table-striped-bg: #101010;
    --bs-table-striped-color: #f0f0f0;
    --bs-table-hover-bg: #181818;
    --bs-table-hover-color: #fff;
    --bs-table-border-color: #303030;
}

html[data-bs-theme="dark"] .audit-list-page {
    background: #000;
    color: #f0f0f0;
}

html[data-bs-theme="dark"] .audit-list-page .navbar-dark.bg-dark,
html[data-bs-theme="dark"] .audit-list-page .card-header.bg-primary {
    background: #0b0b0b !important;
    box-shadow: none;
}

html[data-bs-theme="dark"] .audit-list-page .container.mt-4,
html[data-bs-theme="dark"] .audit-list-page .card,
html[data-bs-theme="dark"] .audit-list-page .card-body,
html[data-bs-theme="dark"] .audit-list-page .table-responsive {
    background: #080808;
    color: #f0f0f0;
    border-color: #303030;
    box-shadow: none;
}

html[data-bs-theme="dark"] .audit-list-page .filter-form {
    background: #111;
    border-color: #383838;
}

html[data-bs-theme="dark"] .audit-list-page .filter-form .form-control,
html[data-bs-theme="dark"] .audit-list-page .filter-form .form-select {
    background-color: #0b0b0b;
    color: #f0f0f0;
    border-color: #555;
}

html[data-bs-theme="dark"] .audit-list-page .filter-form .form-control::placeholder {
    color: #aaa;
}

html[data-bs-theme="dark"] .audit-list-page .navbar .badge.bg-light {
    background: #202020 !important;
    color: #f0f0f0 !important;
}

html[data-bs-theme="dark"] .audit-list-page .table {
    --bs-table-bg: #080808;
    --bs-table-color: #f0f0f0;
    --bs-table-striped-bg: #101010;
    --bs-table-striped-color: #f0f0f0;
    --bs-table-hover-bg: #181818;
    --bs-table-hover-color: #fff;
    --bs-table-border-color: #303030;
}

html[data-bs-theme="dark"] .audit-list-page .table thead th {
    background: #151515;
    color: #f0f0f0;
}

html[data-bs-theme="dark"] .audit-list-page .table td:first-child,
html[data-bs-theme="dark"] .audit-list-page .table td:nth-child(4) {
    background: var(--bs-table-bg);
    color: var(--bs-table-color);
}

html[data-bs-theme="dark"] .audit-list-page .table tbody tr:hover td {
    background: var(--bs-table-hover-bg);
}
