/* Management-specific colors. Loaded after the existing page styles. */
html[data-bmf-dark-active="true"] .bmf-role-page {
    background: var(--bmf-bg);
    color: var(--bmf-text);
}
html[data-bmf-dark-active="true"] .bmf-role-header {
    background: rgba(33, 34, 44, .97);
    border-color: var(--bmf-border);
    box-shadow: 0 5px 22px rgba(0, 0, 0, .25);
}
html[data-bmf-dark-active="true"] :is(.bmf-role-header__section, .bmf-role-navigation a) { color: #eda2bf; }
html[data-bmf-dark-active="true"] :is(.bmf-role-container h1, .bmf-role-card h2, .bmf-role-card h3, .bmf-page-overview h2, .bmf-management-toolbar h2, .bmf-offers-panel h2, .bmf-facilities-panel h2) { color: var(--bmf-text); }
html[data-bmf-dark-active="true"] :is(
    .bmf-page-overview > article,
    .bmf-status-row > div,
    .bmf-offers-panel,
    .bmf-facilities-panel,
    .bmf-facility-card,
    .bmf-availability-day,
    .bmf-treatment-table-wrap
) {
    background: var(--bmf-surface);
    border-color: var(--bmf-border);
    color: var(--bmf-text-secondary);
    box-shadow: none;
}
html[data-bmf-dark-active="true"] :is(.bmf-role-card, .bmf-role-card p, .bmf-role-card li, .bmf-status-row strong, .bmf-availability-day__entry strong, .bmf-facilities-panel p) { color: var(--bmf-text-secondary); }
html[data-bmf-dark-active="true"] :is(.bmf-page-intro, .bmf-availability-note, .bmf-booking-hint, .bmf-availability-day p, .bmf-availability-day__entry span) { color: var(--bmf-muted); }
html[data-bmf-dark-active="true"] :is(.bmf-role-card a, .bmf-facility-link, .bmf-row-action, .bmf-booking-hint a) { color: #efa0c3 !important; }
html[data-bmf-dark-active="true"] :is(.bmf-dashboard-btn, .bmf-account-menu__summary, .bmf-modal-secondary, .bmf-facility-delete button, .bmf-admin-logs__refresh) {
    background: var(--bmf-surface-2);
    border-color: var(--bmf-border);
    color: var(--bmf-text);
}
html[data-bmf-dark-active="true"] :is(.bmf-dashboard-btn:hover, .bmf-modal-secondary:hover, .bmf-account-menu__summary:hover, .bmf-admin-logs__refresh:hover) { background: var(--bmf-surface-3); }
html[data-bmf-dark-active="true"] :is(.bmf-account-menu__panel, .bmf-post-modal) {
    background: var(--bmf-surface);
    border-color: var(--bmf-border);
    color: var(--bmf-text);
    box-shadow: var(--bmf-shadow);
}
html[data-bmf-dark-active="true"] .bmf-account-avatar { background: linear-gradient(135deg,#4c3848,#38384c); color: #f4c9db; }
html[data-bmf-dark-active="true"] .bmf-account-menu__identity { border-color: var(--bmf-border); }
html[data-bmf-dark-active="true"] .bmf-account-menu__identity strong { color: var(--bmf-text); }
html[data-bmf-dark-active="true"] .bmf-account-menu__identity span { color: var(--bmf-muted); }
html[data-bmf-dark-active="true"] :is(.bmf-account-menu__panel > a, .bmf-account-menu__logout button) { color: var(--bmf-text-secondary); }
html[data-bmf-dark-active="true"] :is(.bmf-account-menu__panel > a:hover, .bmf-account-menu__logout button:hover) { background: var(--bmf-surface-3); color: #f4a4c6; }
html[data-bmf-dark-active="true"] :is(.bmf-post-modal__header, .bmf-post-modal__close) {
    background: var(--bmf-surface);
    color: var(--bmf-text);
    border-color: var(--bmf-border);
}
html[data-bmf-dark-active="true"] :is(.bmf-post-modal__header h2, .bmf-post-modal__body h2) { color: var(--bmf-text); }
html[data-bmf-dark-active="true"] .bmf-post-modal__header p { color: var(--bmf-muted); }
html[data-bmf-dark-active="true"] .bmf-post-modal__close:hover { background: var(--bmf-surface-3); }
html[data-bmf-dark-active="true"] .bmf-post-field { color: var(--bmf-text-secondary); }
html[data-bmf-dark-active="true"] :is(.bmf-post-field > input, .bmf-post-field > select, .bmf-post-field > textarea, .home-login-form input, .home-login-form select, .home-login-form textarea, .bmf-booking-filter input) {
    background: var(--bmf-input-bg);
    color: var(--bmf-text);
    border-color: var(--bmf-border);
}
html[data-bmf-dark-active="true"] :is(.bmf-post-field > input, .bmf-post-field > select, .bmf-post-field > textarea, .bmf-booking-filter input):focus-visible {
    border-color: var(--bmf-accent);
    outline-color: rgba(232, 135, 173, .35);
}
html[data-bmf-dark-active="true"] :is(.bmf-post-checkbox, .bmf-booking-filter label) { color: var(--bmf-text-secondary); }
html[data-bmf-dark-active="true"] .bmf-management-table {
    background: var(--bmf-surface);
    border-color: var(--bmf-border);
}
html[data-bmf-dark-active="true"] .bmf-management-table__toolbar {
    background: var(--bmf-surface);
    border-color: var(--bmf-border);
}
html[data-bmf-dark-active="true"] .bmf-management-table__search-label,
html[data-bmf-dark-active="true"] .bmf-management-table__counter { color: var(--bmf-text-secondary); }
html[data-bmf-dark-active="true"] .bmf-management-table__search input {
    background: var(--bmf-input-bg);
    color: var(--bmf-text);
    border-color: var(--bmf-border);
}
html[data-bmf-dark-active="true"] .bmf-management-table thead { background: var(--bmf-surface-2); }
html[data-bmf-dark-active="true"] .bmf-management-table th {
    color: var(--bmf-text-secondary);
    border-color: var(--bmf-border);
}
html[data-bmf-dark-active="true"] .bmf-management-table td {
    color: var(--bmf-text);
    border-color: var(--bmf-border-subtle);
}
html[data-bmf-dark-active="true"] .bmf-management-table tbody tr:hover:not(.bmf-management-table__empty) { background: var(--bmf-surface-3); }
html[data-bmf-dark-active="true"] .bmf-management-table__empty td { color: var(--bmf-muted); }
html[data-bmf-dark-active="true"] .bmf-treatment-table { background: var(--bmf-surface); }
html[data-bmf-dark-active="true"] .bmf-treatment-table th { background: var(--bmf-surface-2); color: var(--bmf-text-secondary); }
html[data-bmf-dark-active="true"] .bmf-treatment-table td { color: var(--bmf-text); }
html[data-bmf-dark-active="true"] :is(.bmf-treatment-table th, .bmf-treatment-table td) { border-color: var(--bmf-border); }
html[data-bmf-dark-active="true"] :is(.bmf-availability-day h3, .bmf-facility-card p, .bmf-facility-card strong) { color: var(--bmf-text); }
html[data-bmf-dark-active="true"] :is(.bmf-availability-day__exception, .bmf-facility-badge, .bmf-treatment-status.is-inactive, .bmf-management-grid .bmf-table-status--inactive) {
    background: #433141;
    color: #f5b4d1;
}
html[data-bmf-dark-active="true"] :is(.bmf-management-grid .bmf-table-status--active, .bmf-treatment-status.is-active) {
    background: #234539;
    color: #a2edc6;
}
html[data-bmf-dark-active="true"] .bmf-booking-slot {
    background: #443044;
    color: #fac3db;
    border-color: #97647c;
}
html[data-bmf-dark-active="true"] .bmf-booking-slot:hover { background: #5b3b55; }
html[data-bmf-dark-active="true"] :is(.bmf-admin-logs__tabs, .bmf-admin-logs__detail pre) { border-color: var(--bmf-border); }
html[data-bmf-dark-active="true"] .bmf-admin-logs__detail pre {
    background: var(--bmf-input-bg);
    color: var(--bmf-text);
}
html[data-bmf-dark-active="true"] :is(.bmf-admin-logs__header h2, .bmf-admin-logs__detail summary, .bmf-admin-logs__tabs a.is-selected) { color: #f0a5c5; }
html[data-bmf-dark-active="true"] .bmf-admin-logs__tabs a { color: var(--bmf-muted); }
html[data-bmf-dark-active="true"] .bmf-admin-logs__count,
html[data-bmf-dark-active="true"] .bmf-admin-logs__empty { color: var(--bmf-muted); }
html[data-bmf-dark-active="true"] .bmf-admin-logs__error,
html[data-bmf-dark-active="true"] .bmf-auth-error {
    background: #4b303d;
    color: #ffb9c8;
    border-color: #80505e;
}
html[data-bmf-dark-active="true"] .bmf-auth-success {
    background: #234638;
    color: #b4f0cd;
    border-color: #396c56;
}
html[data-bmf-dark-active="true"] .bmf-global-toast {
    background: var(--bmf-surface);
    color: var(--bmf-text);
    border-color: var(--bmf-border);
    border-left-color: var(--bmf-primary);
}
html[data-bmf-dark-active="true"] .bmf-global-toast--error { border-left-color: #f28c96; }
html[data-bmf-dark-active="true"] .bmf-global-toast__close { color: var(--bmf-text-secondary); }

/* UI demonstration page: original landing remains outside this scope. */
html[data-bmf-dark-active="true"][data-bmf-ui-route="true"] :is(main, section) { color: var(--bmf-text); }
html[data-bmf-dark-active="true"][data-bmf-ui-route="true"] :is(.bmf-panel, .bmf-card, .bmf-data-table, .bmf-metric-card) { background: var(--bmf-surface); }
html[data-bmf-dark-active="true"][data-bmf-ui-route="true"] :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
    background-color: var(--bmf-input-bg);
    border-color: var(--bmf-border);
    color: var(--bmf-text);
}

/* UI showroom theme selector. */
.bmf-ui-theme-switch { display: none; }
html[data-bmf-ui-route="true"] .bmf-ui-theme-switch {
    position: fixed;
    right: clamp(12px, 2vw, 24px);
    bottom: clamp(12px, 2vw, 24px);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px;
    border: 1px solid #e7d7df;
    border-radius: 14px;
    background: #ffffff;
    color: #654d5b;
    box-shadow: 0 12px 36px rgba(40, 27, 36, .14);
    font-size: 13px;
}
.bmf-ui-theme-switch__title {
    margin: 0 8px;
    font-weight: 650;
}
.bmf-ui-theme-switch button {
    border: none;
    background: transparent;
    color: inherit;
    padding: 8px 12px;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
}
.bmf-ui-theme-switch button.is-selected,
.bmf-ui-theme-switch button[aria-pressed="true"] {
    background: #b8587d;
    color: #ffffff;
    font-weight: 700;
}
.bmf-ui-theme-switch button:focus-visible {
    outline: 2px solid #b8587d;
    outline-offset: 2px;
}
html[data-bmf-dark-active="true"][data-bmf-ui-route="true"] .bmf-ui-theme-switch {
    border-color: var(--bmf-border, #493d47);
    background: var(--bmf-surface, #24232b);
    color: var(--bmf-text, #f4edf1);
}
html[data-bmf-dark-active="true"][data-bmf-ui-route="true"] .bmf-ui-theme-switch button.is-selected,
html[data-bmf-dark-active="true"][data-bmf-ui-route="true"] .bmf-ui-theme-switch button[aria-pressed="true"] {
    background: #c46b92;
    color: #171018;
}
@media (max-width: 400px) {
    .bmf-ui-theme-switch__title { display: none; }
    .bmf-ui-theme-switch button { padding: 8px 10px; }
}

/* White labels on solid accent controls in dark mode. Keep unselected links rose. */
html[data-bmf-dark-active="true"] :is(
    .bmf-doctor-bookings__views a.is-active,
    .bmf-doctor-bookings__apply,
    .bmf-doctor-bookings__confirm,
    .bmf-notifications__apply,
    .bmf-button--primary,
    .bmf-pagination button.is-active,
    .bmf-slot.is-selected,
    .bmf-calendar__day.is-selected,
    .bmf-step.is-active span,
    .bmf-step.is-done span,
    .home-login-form__submit
){color:#fff!important}

/* Solid action buttons must keep readable text in dark mode. */
html[data-bmf-dark-active="true"] .bmf-role-card a.bmf-new-button,
html[data-bmf-dark-active="true"] .bmf-role-card a.bmf-new-button:visited,
html[data-bmf-dark-active="true"] .bmf-role-card a.bmf-new-button:hover {
    background: #96365e;
    border-color: #96365e;
    color: #fff !important;
}
html[data-bmf-dark-active="true"] .bmf-role-card a.bmf-new-button:hover {
    background: #ab416d;
    border-color: #ab416d;
}
html[data-bmf-dark-active="true"] .bmf-role-card a.bmf-new-button :is(span, svg) {
    color: inherit !important;
    opacity: 1;
}
/* Selected navigation links and their expanded parent are visible in both themes. */
html[data-bmf-dark-active="true"] .bmf-account-menu__panel > a.is-active,
html[data-bmf-dark-active="true"] .bmf-account-menu__group > a.is-active {
    background: #483344;
    color: #fff0f6;
    font-weight: 750;
}
html[data-bmf-dark-active="true"] .bmf-account-menu__group.is-current-group > summary {
    background: #38303e;
    color: #f6d6e5;
}
html[data-bmf-dark-active="true"] .bmf-account-menu__group.is-current-group > summary .bmf-icon {
    color: inherit;
}
