/* MNL-BUYER-QA-P1-02: shared WCAG 2.2 AA remediation layer. */
:where(a, button, input, select, textarea, summary, [role="button"], [role="link"], [tabindex]):focus-visible {
    outline: 3px solid #d97706 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px var(--bs-body-bg, #fff) !important;
}

/* Keep semantic component tokens aligned with the active application theme. */
html[data-theme="light"] {
    --muted: #475569;
    --text-muted: #475569;
    --surface: var(--card, #ffffff);
    --card-bg: var(--card, #ffffff);
    --border-color: var(--border, #e2e8f0);
}

html[data-theme="dark"] {
    --surface: var(--card, #111827);
    --card-bg: var(--card, #111827);
    --border-color: var(--border, #334155);
    --text-muted: var(--muted, #cbd5e1);
}

html[data-theme="dark"] body .milaro-login-page a.text-decoration-none,
html[data-theme="dark"] body .profile-activity-title-row span,
html[data-theme="dark"] body #manalia-help .help-link-card span,
html[data-theme="dark"] body #manalia-help .help-inline-link,
html[data-theme="dark"] body #manalia-help .help-topic-links a,
html[data-theme="dark"] body #manalia-help .help-back-link {
    color: #b7d58f !important;
}

html[data-theme="dark"] body .profile-auth-login {
    background: #14532d !important;
    color: #dcfce7 !important;
}

html[data-theme="dark"] body .profile-auth-logout {
    background: #7f1d1d !important;
    color: #fee2e2 !important;
}

html[data-theme="light"] body .role-workspace__privacy {
    color: #166534 !important;
}

html[data-theme="light"] body .finance-kpi-card.income span,
html[data-theme="light"] body .finance-kpi-card.income small,
html[data-theme="light"] body .payments-page .payments-summary-card.total span,
html[data-theme="light"] body .payments-page .payments-summary-card.total small {
    color: #475569 !important;
}

html[data-theme="light"] body .profile-auth-logout {
    color: #991b1b !important;
}

html[data-theme="light"] body .profile-activity-title-row span {
    color: #3f532f !important;
}

html[data-theme="dark"] body .future-reports-page .version-link,
html[data-theme="dark"] body .future-reports-page .future-live-card a,
html[data-theme="dark"] body .future-reports-page tbody td:nth-child(9) a {
    color: #b7d58f !important;
}

.reception-search-stage .reception-page-heading {
    margin: 0;
    font-size: clamp(2.4rem, 8vw, 5.2rem);
    font-weight: 950;
    letter-spacing: -.08em;
    color: var(--text, #111827);
}

.btn-primary,
html[data-theme] .btn-primary {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus-visible,
html[data-theme] .btn-primary:hover,
html[data-theme] .btn-primary:focus-visible {
    background-color: #065f46 !important;
    border-color: #065f46 !important;
}

.btn-dark,
html[data-theme] .btn-dark {
    background-color: #1f2937 !important;
    border-color: #1f2937 !important;
    color: #fff !important;
}

.btn-dark:hover,
.btn-dark:focus-visible,
html[data-theme] .btn-dark:hover,
html[data-theme] .btn-dark:focus-visible {
    background-color: #111827 !important;
    border-color: #111827 !important;
}

.btn span,
.btn i,
.table-bulk-actions .btn span,
.invoice-action-btn .invoice-action-btn__title {
    color: inherit !important;
}

html[data-theme] body .btn span,
html[data-theme] body .btn i,
html[data-theme] body .table td .btn span,
html[data-theme] body .panel .invoice-action-btn span {
    color: inherit !important;
}

html[data-theme] body .table td .btn-primary,
html[data-theme] body .table td .btn-primary:hover,
html[data-theme] body .table td .btn-primary:focus-visible {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #fff !important;
}

.table-row-checkbox,
.table-check-all,
.patient-native-checkbox,
input[type="checkbox"],
input[type="radio"] {
    min-width: 28px !important;
    min-height: 28px !important;
}

#globalSearchInput {
    min-height: 32px !important;
}

.form-control-sm {
    min-width: 24px;
}

.table-selected-count,
.reception-action-count,
html[data-theme] .table-selected-count,
html[data-theme] .reception-action-count {
    background: #111827 !important;
    color: #fff !important;
}

.badge.bg-dark,
html[data-theme] .badge.bg-dark {
    background: #334155 !important;
    color: #fff !important;
}

.status-pill,
.status-pill * {
    color: #374151 !important;
}

.status-pill.status-pending,
.status-pill.status-confirmed {
    background: #dbeafe !important;
    color: #1e3a8a !important;
}

.status-pill.status-checked_in {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

.status-pill.status-in_service {
    background: #ede9fe !important;
    color: #5b21b6 !important;
}

.status-pill.status-partial {
    background: #fef3c7 !important;
    color: #78350f !important;
}

.status-pill.status-completed,
.status-pill.status-done {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.status-pill.status-cancelled,
.status-pill.status-unpaid {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.status-pill.status-no_show {
    background: #fef3c7 !important;
    color: #92400e !important;
}

html[data-theme] body .table td span.status-pill.status-pending,
html[data-theme] body .table td span.status-pill.status-confirmed {
    background: #dbeafe !important;
    color: #1e3a8a !important;
}

html[data-theme] body .table td span.status-pill.status-checked_in {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

html[data-theme] body .table td span.status-pill.status-in_service {
    background: #ede9fe !important;
    color: #5b21b6 !important;
}

html[data-theme="light"] body .table td span.status-pill.status-partial {
    background: #fef3c7 !important;
    color: #78350f !important;
}

html[data-theme="dark"] body .table td span.status-pill.status-partial {
    background: #78350f !important;
    color: #fef3c7 !important;
}

html[data-theme] body .table td span.status-pill.status-completed,
html[data-theme] body .table td span.status-pill.status-done {
    background: #dcfce7 !important;
    color: #166534 !important;
}

html[data-theme] body .table td span.status-pill.status-cancelled,
html[data-theme] body .table td span.status-pill.status-unpaid {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

html[data-theme] body .table td span.status-pill.status-no_show {
    background: #fef3c7 !important;
    color: #92400e !important;
}

html[data-theme] body span.table-selected-count,
html[data-theme] body span.reception-action-count {
    background: #111827 !important;
    color: #fff !important;
}

html[data-theme="light"] .text-muted {
    color: #475569 !important;
}

html[data-theme="dark"] .text-muted {
    color: #cbd5e1 !important;
}

html[data-theme="light"] body .alert .invoice-cancel-reason {
    color: #475569 !important;
}

html[data-theme="dark"] body .alert .invoice-cancel-reason {
    color: #cbd5e1 !important;
}

html[data-theme="light"] body .finance-kpi-card.net.negative span,
html[data-theme="light"] body .finance-kpi-card.net.negative small {
    color: #475569 !important;
}

html[data-theme="light"] body .settings-count {
    color: #3730a3 !important;
}

.select2-container .select2-selection__clear {
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 2px 8px !important;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 620px) {
    .topbar-context {
        order: 2;
        display: block !important;
        flex: 1 1 64px;
        min-width: 0;
    }

    .topbar-context h1 {
        display: block !important;
        margin: 0 !important;
        overflow: hidden;
        font-size: 13px !important;
        line-height: 1.35;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-mobile-search-toggle {
        order: 3 !important;
    }

    .topbar-actions {
        order: 4 !important;
    }

    .topbar .global-search {
        order: 5 !important;
    }
}
