/* =====================================================
   WCAG 2.1 AA + GIGW 3.0 + IS 17802 Compliance
   Accessibility Layer for Login Page
   Non-invasive overlay - preserves existing light/dark mode
   ===================================================== */

/* ===== TEXT SCALING - WCAG 1.4.4 ===== */
/* Users can scale text up to 200% without loss of content or functionality */
/* IMPORTANT: Scale at HTML level only - NO em multipliers to prevent exponential growth */

/* Percentages must match the panel labels: Large 120%, Larger 140%, Maximum 200% */
html.large-text {
    font-size: 120%;
}

html.larger-text {
    font-size: 140%;
}

html.maximum-text {
    font-size: 200%;
}

/* DO NOT apply additional scaling to elements - html scaling is enough */
/* This prevents exponential/cascading text growth */

/* ===== DASHBOARD SPECIFIC SCALING ===== */
/* Remove hardcoded font-size declarations that block html-level scaling */
/* Elements will inherit from html root font-size change */
html.large-text .metric-value,
html.large-text .metric-label,
html.large-text .summary-value,
html.large-text .summary-label,
html.large-text .table td,
html.large-text .table tbody td,
html.large-text .table th,
html.large-text .table thead th,
html.large-text .stock-symbol,
html.large-text .description-text {
    font-size: inherit !important;
}

html.larger-text .metric-value,
html.larger-text .metric-label,
html.larger-text .summary-value,
html.larger-text .summary-label,
html.larger-text .table td,
html.larger-text .table tbody td,
html.larger-text .table th,
html.larger-text .table thead th,
html.larger-text .stock-symbol,
html.larger-text .description-text {
    font-size: inherit !important;
}

html.maximum-text .metric-value,
html.maximum-text .metric-label,
html.maximum-text .summary-value,
html.maximum-text .summary-label,
html.maximum-text .table td,
html.maximum-text .table tbody td,
html.maximum-text .table th,
html.maximum-text .table thead th,
html.maximum-text .stock-symbol,
html.maximum-text .description-text {
    font-size: inherit !important;
}

/* ===== HIGH CONTRAST MODE - WCAG 1.4.3 ===== */
body.high-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .row,
body.high-contrast .container {
    background: #000000 !important;
    border: 3px solid #ffffff !important;
    color: #ffffff !important;
}

/* Remove ALL gradients and colors from header/navbar */
body.high-contrast .navbar,
body.high-contrast .navbar-dark,
body.high-contrast .navbar-brand {
    background: #000000 !important;
    color: #ffffff !important;
    border-bottom: 3px solid #ffffff !important;
}

body.high-contrast .nav-link,
body.high-contrast .navbar-toggler {
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

/* Navbar dropdown menu */
body.high-contrast .dropdown-menu {
    background: #ffffff !important;
    border: 3px solid #000000 !important;
}

body.high-contrast .dropdown-item {
    background: #ffffff !important;
    color: #000000 !important;
    border-bottom: 2px solid #000000 !important;
    font-weight: 600 !important;
}

body.high-contrast .dropdown-item:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .dropdown-divider {
    border-color: #000000 !important;
    border-width: 2px !important;
}

/* Sidebar header */
body.high-contrast .sidebar-header {
    background: #000000 !important;
    color: #ffffff !important;
    border-bottom: 3px solid #ffffff !important;
}

body.high-contrast .sidebar-header h5 {
    color: #ffffff !important;
}

/* Remove gradients from filter boxes and card headers */
body.high-contrast .filter-box-title,
body.high-contrast .ibox-title {
    background: #000000 !important;
    color: #ffffff !important;
    border: 3px solid #ffffff !important;
}

body.high-contrast .filter-box-title h5,
body.high-contrast .filter-box-title h2,
body.high-contrast .ibox-title h5,
body.high-contrast .ibox-title h2 {
    color: #ffffff !important;
}

body.high-contrast input,
body.high-contrast .form-control {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

body.high-contrast input::placeholder {
    color: #cccccc !important;
}

body.high-contrast button,
body.high-contrast .btn,
body.high-contrast .btn-primary,
body.high-contrast .btn-success,
body.high-contrast .btn-danger,
body.high-contrast .btn-default,
body.high-contrast .btn-secondary {
    background: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
    font-weight: 700 !important;
}

body.high-contrast button:hover,
body.high-contrast .btn:hover {
    background: #000000 !important;
    color: #ffffff !important;
    border: 3px solid #ffffff !important;
}

body.high-contrast button:focus,
body.high-contrast .btn:focus {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px !important;
}

body.high-contrast a {
    color: #ffffff !important;
    text-decoration: underline !important;
}

body.high-contrast label {
    color: #ffffff !important;
}

body.high-contrast .external-link-item {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
}

/* ===== DASHBOARD HIGH CONTRAST MODE ===== */
/* Override all colored elements for accessibility */

/* Portfolio cards - white background, black text, white border */
body.high-contrast .portfolio-card-multi {
    background: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
}

/* Card headers - remove ALL gradients, use solid black with white text */
body.high-contrast .multi-header,
body.high-contrast .export-card-header,
body.high-contrast .dashboard-header {
    background: #000000 !important;
    color: #ffffff !important;
    border: 3px solid #ffffff !important;
}

body.high-contrast .dashboard-title,
body.high-contrast .multi-header span {
    color: #ffffff !important;
}

/* Export section */
body.high-contrast .export-card,
body.high-contrast .export-section {
    background: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
}

/* All text in cards - black on white */
body.high-contrast .metric-value,
body.high-contrast .metric-label,
body.high-contrast .summary-value,
body.high-contrast .summary-label {
    color: #000000 !important;
}

/* Remove ALL color coding - profit/loss indicators */
body.high-contrast .metric-value.positive,
body.high-contrast .metric-value.negative,
body.high-contrast .text-red,
body.high-contrast .text-green {
    color: #000000 !important;
}

/* Badges - white background, BLACK TEXT, black border */
body.high-contrast .badge,
body.high-contrast .badge.bg-success,
body.high-contrast .badge.bg-danger,
body.high-contrast .badge.bg-warning,
body.high-contrast .badge.bg-info,
body.high-contrast .badge.bg-primary,
body.high-contrast span.badge,
body.high-contrast span.bg-success,
body.high-contrast span.bg-danger {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    font-weight: 700 !important;
}

/* Force text color on badge content */
body.high-contrast .badge *,
body.high-contrast .badge::before,
body.high-contrast .badge::after {
    color: #000000 !important;
}

/* Tables - white background, black text */
body.high-contrast .table {
    background: #ffffff !important;
    color: #000000 !important;
}

body.high-contrast .table thead th {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

body.high-contrast .table tbody td {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #000000 !important;
}

body.high-contrast .table tbody tr {
    background: #ffffff !important;
}

body.high-contrast .table-footer-light {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

/* Remove colored text in tables */
body.high-contrast .table td.text-red,
body.high-contrast .table td.text-green {
    color: #000000 !important;
}

/* Scrollable containers */
body.high-contrast .table-container,
body.high-contrast .scrollable-table {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
}

/* Export section */
body.high-contrast .export-card-content {
    background: #ffffff !important;
    color: #000000 !important;
}

body.high-contrast .description-text {
    color: #000000 !important;
}

/* Icons */
body.high-contrast .fas,
body.high-contrast .fa {
    color: inherit !important;
}

/* ===== RESPONSIVE LAYOUT FOR TEXT SCALING ===== */
/* Prevent content cutoff at large text sizes - from WebGroup2 best practices */

/* Stack columns to full width in large text modes */
html.large-text .col-lg-4,
html.large-text .col-lg-6,
html.large-text .col-lg-3,
html.large-text .col-md-6,
html.large-text .col-md-4 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

html.larger-text .col-lg-4,
html.larger-text .col-lg-6,
html.larger-text .col-lg-3,
html.larger-text .col-md-6,
html.larger-text .col-md-4 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

html.maximum-text .col-lg-4,
html.maximum-text .col-lg-6,
html.maximum-text .col-lg-3,
html.maximum-text .col-md-6,
html.maximum-text .col-md-4 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Allow content boxes to grow with text size */
html.large-text .portfolio-card-multi,
html.large-text .ibox,
html.large-text .ibox-content,
html.large-text .card {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
}

html.larger-text .portfolio-card-multi,
html.larger-text .ibox,
html.larger-text .ibox-content,
html.larger-text .card {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
}

html.maximum-text .portfolio-card-multi,
html.maximum-text .ibox,
html.maximum-text .ibox-content,
html.maximum-text .card {
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
}

/* Adjust grid layouts for readability */
html.large-text .portfolio-summary-multi,
html.larger-text .portfolio-summary-multi,
html.maximum-text .portfolio-summary-multi {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
}

/* ===== FOCUS INDICATORS - WCAG 2.4.7 ===== */
*:focus,
*:focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 2px !important;
}

body.high-contrast *:focus,
body.high-contrast *:focus-visible {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px !important;
}

/* ===== NAVIGATION FOCUS STYLES ===== */
.sidebar-link:focus,
.sidebar-link:focus-visible {
    outline: 3px solid #0d6efd !important;
    outline-offset: 2px !important;
    background: rgba(13, 110, 253, 0.1) !important;
}

[data-bs-theme="dark"] .sidebar-link:focus,
[data-bs-theme="dark"] .sidebar-link:focus-visible {
    outline: 3px solid #80bdff !important;
    background: rgba(128, 189, 255, 0.1) !important;
}

body.high-contrast .sidebar-link:focus,
body.high-contrast .sidebar-link:focus-visible {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px !important;
    background: transparent !important;
}

/* Sidebar button styling for accessibility */
.sidebar-link.w-100 {
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
}

.sidebar-link.w-100:hover {
    background: rgba(13, 110, 253, 0.05);
}

[data-bs-theme="dark"] .sidebar-link.w-100 {
    color: inherit;
}

[data-bs-theme="dark"] .sidebar-link.w-100:hover {
    background: rgba(128, 189, 255, 0.05);
}

/* High contrast sidebar - ALL menu items consistent styling */
body.high-contrast .sidebar,
body.high-contrast .sidebar-content,
body.high-contrast .sidebar-menu {
    background: #000000 !important;
}

body.high-contrast .sidebar-link,
body.high-contrast .sidebar-link.w-100,
body.high-contrast .sidebar-item a {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    margin-bottom: 2px !important;
}

body.high-contrast .sidebar-link:hover,
body.high-contrast .sidebar-link.w-100:hover {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
}

body.high-contrast .sidebar-item.active .sidebar-link,
body.high-contrast .sidebar-link.active {
    background: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
}

/* Submenu items in high contrast */
body.high-contrast .collapse a,
body.high-contrast .sidebar-menu .collapse li a {
    background: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
}

body.high-contrast .collapse a:hover {
    background: #ffffff !important;
    color: #000000 !important;
}

/* ===== ACCESSIBILITY TOOLBAR ===== */
.accessibility-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.accessibility-button {
    /* BAC-53146: was rgba(13,110,253,0.75) over white (~#64A1FD, 2.61:1 for the
       white icon). Solid darker blue at full opacity clears the 3:1 minimum. */
    background: #0b57c2;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    color: #ffffff;
    font-size: 18px;
    opacity: 1;
    outline: none;
}

.accessibility-button:hover,
.accessibility-button:focus {
    background: rgba(10, 88, 202, 0.95);
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    opacity: 1;
}

.accessibility-button:focus {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

.accessibility-panel {
    position: absolute;
    bottom: 50px;
    right: 0;
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    /* BAC-A11Y: on short viewports the panel used to grow past the top of the
       screen (heading + Theme Mode were cut off until the page was scrolled).
       Cap it to the visible area and let it scroll internally instead. */
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    overscroll-behavior: contain;

    display: none;
}

.accessibility-panel.show {
    display: block;
}

.accessibility-panel h2 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
}

.accessibility-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.accessibility-option:hover {
    background: #f8f9fa;
}

.accessibility-option input[type="checkbox"],
.accessibility-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.accessibility-option label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    font-size: 14px;
    color: #495057;
}

/* Settings sections */
.settings-section {
    margin-bottom: 15px;
}

.section-heading {
    font-size: 14px;
    font-weight: 700;
    color: #0d6efd;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #e9ecef;
}

/* Theme mode section */
.theme-mode-section {
    margin-bottom: 10px;
}

.theme-mode-title {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin: 0 0 5px 0;
}

.accessibility-divider {
    height: 2px;
    background: #dee2e6;
    margin: 12px 0;
}

.accessibility-reset {
    width: 100%;
    margin-top: 12px;
    padding: 9px;
    background: #dc3545;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.accessibility-reset:hover {
    background: #c82333;
}

/* Dark mode compatibility */
[data-bs-theme="dark"] .accessibility-panel {
    background: #2d3338;
    border-color: #495057;
}

[data-bs-theme="dark"] .accessibility-panel h2 {
    color: #e9ecef;
    border-color: #495057;
}

[data-bs-theme="dark"] .accessibility-option:hover {
    background: #3a4046;
}

[data-bs-theme="dark"] .accessibility-option label {
    color: #e9ecef;
}

[data-bs-theme="dark"] .section-heading {
    color: #80bdff;
    border-color: #495057;
}

[data-bs-theme="dark"] .theme-mode-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] .accessibility-divider {
    background: #495057;
}

[data-bs-theme="dark"] .accessibility-button {
    background: rgba(13, 110, 253, 0.75);
    border-color: rgba(26, 29, 32, 0.8);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .accessibility-button:hover,
[data-bs-theme="dark"] .accessibility-button:focus {
    background: rgba(10, 88, 202, 0.95);
    box-shadow: 0 3px 12px rgba(255, 255, 255, 0.15);
}

/* ===== HIGH CONTRAST MODE - ACCESSIBILITY PANEL ===== */
body.high-contrast .accessibility-panel {
    background: #ffffff !important;
    border: 3px solid #000000 !important;
    color: #000000 !important;
}

body.high-contrast .accessibility-panel h2,
body.high-contrast .section-heading,
body.high-contrast .theme-mode-title,
body.high-contrast .accessibility-option label {
    color: #000000 !important;
}

body.high-contrast .section-heading {
    border-color: #000000 !important;
}

body.high-contrast .accessibility-button {
    background: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
    opacity: 1 !important;
}

body.high-contrast .accessibility-button:hover,
body.high-contrast .accessibility-button:focus {
    background: #000000 !important;
    color: #ffffff !important;
    border: 3px solid #000000 !important;
}

body.high-contrast .accessibility-divider {
    background: #000000 !important;
}

/* High contrast focus indicators - WCAG 2.4.7 */
body.high-contrast *:focus,
body.high-contrast *:focus-visible {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px !important;
}

/* High contrast reset button - must be clearly actionable */
body.high-contrast .accessibility-reset {
    background: transparent !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
    font-weight: 700 !important;
}

body.high-contrast .accessibility-reset:hover,
body.high-contrast .accessibility-reset:focus {
    background: #000000 !important;
    color: #ffffff !important;
    outline: 3px solid #FFD700 !important;
}

/* ===== CAPTCHA ACCESSIBILITY ===== */
.captcha-audio-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #0d6efd;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.captcha-audio-btn:hover {
    background: #0b5ed7;
}

.captcha-audio-btn:focus {
    outline: 3px solid #80bdff;
    outline-offset: 2px;
}

body.high-contrast .captcha-audio-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

body.high-contrast .captcha-audio-btn:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

/* ===== SCREEN READER ONLY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ===== ARIA LIVE REGION ===== */
.aria-live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===== TARGET SIZE - WCAG 2.5.5 / 2.5.8 ===== */
/* Interactive controls must be at least 44x44 CSS px (E-09).
   Scoped to the login/auth pages via .container to avoid affecting dashboards. */
.container input.form-control,
.container select.form-control,
.container .btn,
.container button {
    min-height: 44px;
}

/* The password show/hide toggle is an icon button - give it a full tap area */
#togglePassword {
    min-width: 44px;
    min-height: 44px;
}

.captcha-audio-btn {
    min-height: 44px;
}

/* Inline text links (footer, "Change / Forgot Password", external links):
   add vertical padding so the tap target reaches ~44px without breaking layout */
.container .page-footer a,
.page-footer a,
.container nav a,
.external-link-item,
.external-links-toggle {
    display: inline-block;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.5;
}

/* ===== SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #0d6efd;
    color: #ffffff;
    padding: 10px 20px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #80bdff;
    outline-offset: 2px;
}

/* =========================================================================
   COLOR CONTRAST FIXES  (WCAG 1.4.3 / 1.4.11 - GWC audit, 2026)
   Consolidated overrides for the color-contrast findings that had no
   inline code fix. Scoped and given dark-mode equivalents so they do not
   regress the dark theme.
   Covers: BAC-43164, BAC-49160, BAC-54613, BAC-54750, BAC-43440,
           BAC-49211, BAC-54780, BAC-43357, BAC-43116.
   ========================================================================= */

/* --- Form control & checkbox borders: #DEE2E6/#DCE0E4 gave only 1.26:1 vs
       the #FAFBFC field background. #6c757d clears the 3:1 non-text minimum.
       (BAC-49211 Ledger, BAC-54780 Portfolio) --- */
.form-control,
.form-select,
.date-input,
.form-check-input {
    border-color: #6c757d;
}
.form-check-input {
    border-width: 1px;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .date-input,
[data-bs-theme="dark"] .form-check-input {
    border-color: #8a919a;
}

/* --- Focus indicator on coloured / gradient chrome: the #005FCC ring had
       only 1.31:1 on the #6C6ACE header. A white ring + dark halo stays
       visible on any background. (BAC-43357) --- */
.navbar-modern .btn:focus-visible,
.navbar-modern a:focus-visible,
.navbar-modern button:focus-visible,
.dashboard-tabs .tab-button:focus-visible,
.portfolio-tabs .tab-button:focus-visible,
.offcanvas .btn:focus-visible,
.sidebar .sidebar-link:focus-visible {
    outline: 3px solid #ffffff !important;
    outline-offset: 0 !important;
    box-shadow: 0 0 0 6px #003a75 !important;
}

/* --- "Home" breadcrumb / nav link: #667EEA gave 3.47:1 on #F8F9FA.
       (BAC-43164, BAC-49160, BAC-54613, BAC-54750, BAC-43440) --- */
.breadcrumb a,
.breadcrumb-item a {
    color: #3f4fbf !important;
}
[data-bs-theme="dark"] .breadcrumb a,
[data-bs-theme="dark"] .breadcrumb-item a {
    color: #aeb8ff !important;
}

/* --- Profit/Loss figures: green #1AB394/#28A745 (2.65-3.13:1) and
       red #ED5565 (3.45:1) on white. Darkened to >=4.5:1; the !important
       also lifts the inline-styled grid numbers (num-pos/num-neg). --- */
.text-success,
.num-pos,
.text-green {
    color: #157347 !important;
}
.text-danger,
.num-neg,
.text-red {
    color: #c62828 !important;
}
[data-bs-theme="dark"] .text-success,
[data-bs-theme="dark"] .num-pos,
[data-bs-theme="dark"] .text-green {
    color: #4ade80 !important;
}
[data-bs-theme="dark"] .text-danger,
[data-bs-theme="dark"] .num-neg,
[data-bs-theme="dark"] .text-red {
    color: #f87171 !important;
}

/* --- Gradient "Sign in" and action buttons: white text sat at 4.42-4.48:1
       on the #6B6CD1/#6C6DD2 brand gradient. Darkening the gradient endpoints
       lifts the button label past 4.5:1 while keeping the brand hue.
       (BAC-43116 Sign in; contributes to BAC-54613 / BAC-54750 View/Add) --- */
.form-signin .btn-primary,
.btn-gradient-primary {
    background: linear-gradient(135deg, #4f46b8 0%, #5f3f8f 100%) !important;
    border-color: #4f46b8 !important;
    color: #ffffff !important;
}

/* --- Company name truncated in the header / offcanvas title: allow the text
       to wrap so it is fully visible by default. (BAC-54838, BAC-52785) --- */
.navbar-modern .navbar-brand,
.offcanvas-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

/* --- "Share"/detail icon-link inside the purple card headers (Ledger Balance
       etc.): the default link-blue icon sat at 1.19:1 on the #667eea/#764ba2
       gradient. Inherit the header's white and drop the muted opacity so the
       icon clears the 3:1 non-text minimum. (BAC-43192) --- */
.multi-header a {
    color: #ffffff !important;
}
.multi-header a .icon-muted,
.multi-header .icon-muted {
    opacity: 1 !important;
    color: #ffffff !important;
}

/* --- Focus Not Obscured (WCAG 2.2 SC 2.4.11).
       .navbar-modern is position:sticky;top:0 (~70px tall), so an element reached
       by Tab near the top of the viewport can end up scrolled underneath it.
       scroll-margin-top reserves that space whenever the browser scrolls an
       element into view, keeping the focused control visible. --- */
a, button, input, select, textarea, summary,
[tabindex]:not([tabindex="-1"]),
.sidebar-link, .tab-button, .page-link, .dropdown-item {
    scroll-margin-top: 90px;
    scroll-margin-bottom: 24px;
}

/* --- Reflow at ~320px without horizontal scroll (WCAG 1.4.10).
       BAC-54727 (Bills), BAC-54832 (Dashboard). The main culprit is flex
       items whose default min-width:auto refuses to shrink below their
       content (long search placeholders), forcing 2-D scrolling. --- */
@media (max-width: 480px) {
    .container,
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
        max-width: 100%;
    }
    /* Let search inputs shrink inside their group instead of overflowing */
    .input-group { flex-wrap: nowrap; }
    .input-group > .form-control,
    .input-group > .form-select,
    .input-group > input {
        min-width: 0;
    }
    .form-control,
    .form-select,
    .date-input {
        max-width: 100%;
    }
    /* Stack multi-column filter and metric grids so nothing is clipped */
    .filter-grid { grid-template-columns: 1fr !important; }
    .metric-row,
    .metric-row.combined-row { grid-template-columns: 1fr !important; }
    /* Tab strips wrap rather than pushing the page wider than the viewport */
    .dashboard-tabs,
    .portfolio-tabs { flex-wrap: wrap; }
    img { max-width: 100%; height: auto; }
}

/* =====================================================================
   ROUND 4 - "DAT Arham Wealth Backoffice Web App Revalidation" tracker
   (9 findings, WCAG 2.2 A/AA). Applied 2026-07-29.
   ===================================================================== */

/* --- #1 Reflow (SC 1.4.10, Critical) and #4 Resize Text (SC 1.4.4).
       At 400% zoom on a 1280px screen the viewport is ~320 CSS px. The
       navbar row is a single non-wrapping flex line: brand + toggler +
       the .ms-auto block (FY badge + user dropdown), so the right-hand
       block was painted ON TOP of the toggler and the brand was clipped.
       Letting the row wrap turns the overlap into a stack - no content
       is lost and no horizontal scrolling is introduced. --- */
@media (max-width: 700px) {
    .navbar-modern > .container-fluid {
        flex-wrap: wrap;
        row-gap: 0.5rem;
        column-gap: 0.5rem;
    }
    .navbar-modern .navbar-brand {
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
        font-size: 1rem;
        /* the scale(1.05) hover transform pushed the brand over its
           neighbours once the row got tight */
        transform: none !important;
    }
    .navbar-modern .ms-auto {
        margin-left: 0 !important;
        width: 100%;
    }
    .navbar-modern .navbar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        row-gap: 0.35rem;
    }
    .navbar-modern .badge {
        white-space: normal;
    }
}

/* --- #4 Resize Text (SC 1.4.4): at 200% text zoom the profile dropdown
       grew past the viewport bottom/right and was clipped with no way to
       reach the lower items. Cap its height and let it scroll, and keep it
       inside the viewport horizontally. --- */
.navbar-modern .dropdown-menu {
    max-height: min(70vh, 32rem);
    overflow-y: auto;
    max-width: calc(100vw - 1rem);
    overscroll-behavior: contain;
}
@media (max-width: 700px) {
    /* Static flow beats absolute positioning at narrow widths - the menu
       can never be pushed off-screen or clipped by an ancestor. */
    .navbar-modern .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        max-width: 100%;
        transform: none !important;
        margin-top: 0.25rem;
    }
}
/* Same protection for the sidebar: at large text it must scroll, not clip. */
.sidebar,
.offcanvas-body {
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* --- #3 Contrast (SC 1.4.3). rp/viewreport.cfm re-declared
       `.ibox-footer .btn-success { background:##28a745 }`, which beat the
       darkened brand token and put white text on 3.13:1. The token below is
       5.36:1. Kept as a global backstop so a future page-level override of
       the plain colour still lands on an accessible value. --- */
.btn-success,
.ibox-footer .btn-success,
.btn-success:not(:hover):not(:focus) {
    background-color: #107a5e;
    border-color: #107a5e;
    color: #ffffff;
}

/* --- #5 Non-text Contrast (SC 1.4.11) in High Contrast Mode.
       `body.high-contrast input` did not reach <select>, <textarea>, the
       date pickers or the Tabulator header filters, so their Bootstrap
       ##495057 text/placeholder stayed on the forced ##000 background
       (2.57:1). -webkit-text-fill-color is required because some inputs
       (date/number) ignore `color` in WebKit. --- */
body.high-contrast input,
body.high-contrast textarea,
body.high-contrast select,
body.high-contrast .form-control,
body.high-contrast .form-select,
body.high-contrast .date-input,
body.high-contrast .tabulator .tabulator-header-filter input {
    background: #000000 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border: 2px solid #ffffff !important;
    opacity: 1 !important;
}
body.high-contrast ::placeholder,
body.high-contrast input::placeholder,
body.high-contrast textarea::placeholder {
    /* ##e6e6e6 on ##000 = 16.9:1 */
    color: #e6e6e6 !important;
    -webkit-text-fill-color: #e6e6e6 !important;
    opacity: 1 !important;
}
/* Non-text: the field/button/card borders themselves must clear 3:1 */
body.high-contrast .card,
body.high-contrast .ibox,
body.high-contrast .ibox-content,
body.high-contrast .table,
body.high-contrast .table td,
body.high-contrast .table th,
body.high-contrast .input-group-text,
body.high-contrast .breadcrumb {
    border-color: #ffffff !important;
}

/* The same placeholder failure exists in the ordinary dark theme
   (##495057 placeholder on the dark field background). */
[data-bs-theme="dark"] ::placeholder,
[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] .form-select::placeholder,
[data-bs-theme="dark"] .tabulator .tabulator-header-filter input::placeholder {
    /* ##adb5bd on ##212529 = 7.0:1, on ##000 = 9.3:1 */
    color: #adb5bd !important;
    -webkit-text-fill-color: #adb5bd !important;
    opacity: 1 !important;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .date-input {
    color: #f1f3f5 !important;
    -webkit-text-fill-color: #f1f3f5 !important;
}

/* --- #9 Target Size (Minimum) (SC 2.5.8). The breadcrumb "Home" link was
       a 20x20 icon+text hit area. WCAG 2.2 AA needs 24x24 CSS px (or
       equivalent spacing). The earlier 44px rules were scoped to
       `.container` (login pages only) and never reached the post-login
       chrome. inline-flex + min sizes grow the box without moving text. --- */
/* Inline links: inline-flex keeps them in the text flow. */
.breadcrumb-item a,
.breadcrumb a,
.page-link,
.pagination a,
a.icon-link,
button.btn-icon {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    min-width: 24px;
}
/* Full-width menu rows: keep them block-level (flex, not inline-flex) so the
   hover/active background still spans the whole row. */
.sidebar-menu a,
.sidebar-link,
.offcanvas-body .sidebar-menu a,
.dropdown-item {
    display: flex;
    align-items: center;
    min-height: 24px;
}
/* Give bare icon links real padding so the 24px is hit area, not just box */
.breadcrumb-item a,
.breadcrumb a {
    padding: 4px 6px;
    margin: -4px -6px;   /* keeps the visual position unchanged */
    border-radius: 4px;
}
/* Sibling targets need 24px of spacing between their centres as well */
.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.75rem;
}
/* --- SC 2.5.8, second pass (Stage 2 audit). The rules above reached links,
       icon buttons and menu rows but never checkboxes or radios. Bootstrap
       sizes .form-check-input at 1em (16px), and where the control is wrapped
       in its label the label IS the target - the audit measured one at
       139.98 x 19.2, so the height failed. Three cases to cover:
         1. the control itself, when its label is a separate sibling element;
         2. the wrapping label, when the markup nests the input inside it;
         3. .form-check rows, so stacked options keep 24px between centres.
       min-* is used rather than width/height so any page that deliberately
       sizes a control larger keeps its own value. --- */
.form-check-input,
input[type="checkbox"],
input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
}
.form-check-label,
label.form-check-label {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
}
.form-check {
    min-height: 24px;
}
/* Stacked checkboxes/radios: 24px between adjacent target centres. */
.form-check + .form-check {
    margin-top: 0.25rem;
}

/* --- #8 Multiple Ways (SC 2.4.5): styling for the new sidebar menu
       search and the Site Map page. --- */
.menu-search-wrap {
    padding: 0.5rem 0.75rem 0.75rem;
}
.menu-search-wrap .form-control {
    min-height: 36px;
    font-size: 0.9rem;
}
/* The filter hides non-matching rows with [hidden]; author display rules on
   .sidebar-item would otherwise beat the UA stylesheet's display:none. */
.sidebar-menu [hidden] {
    display: none !important;
}
.sitemap-group {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}
.sitemap-group h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.sitemap-group ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.sitemap-group li + li {
    margin-top: 2px;
}
.sitemap-group a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 2px;
}
.breadcrumb-sitemap-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 4px;
    /* same token as the breadcrumb "Home" link - 7.1:1 on ##f8f9fa */
    color: #3f4fbf;
    text-decoration: underline;
    white-space: nowrap;
}
[data-bs-theme="dark"] .breadcrumb-sitemap-link {
    color: #aeb8ff;
}
body.high-contrast .breadcrumb-sitemap-link {
    color: #ffffff !important;
}


/* =========================================================================
   ROUND 5 - Codec Networks / Adroit Financial audit (WCAG 2.2)
   SC 2.2.1 Timing Adjustable - session-expiry warning dialog.
   Markup is built by /WebGroup/js/session-timeout.js.
   Contrast: white on #3f3f9e = 8.6:1; dark text on #ffffff = 16:1.
   Targets: buttons are 44px tall (SC 2.5.8 / 2.5.5).
   ========================================================================= */
.session-timeout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 16px;
}

.session-timeout-dialog {
    background: #ffffff;
    color: #1c1c1c;
    max-width: 32rem;
    width: 100%;
    border-radius: 10px;
    border: 2px solid #3f3f9e;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    max-height: 90vh;
    overflow-y: auto;
}

.session-timeout-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: #1c1c1c;
}

.session-timeout-desc {
    margin: 0 0 12px;
    line-height: 1.5;
}

.session-timeout-countdown {
    margin: 0 0 20px;
    font-weight: 600;
    /* 5.9:1 on white - the countdown is never the only cue, the text says it too */
    color: #b3261e;
}

.session-timeout-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.session-timeout-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
}

.session-timeout-btn-primary {
    background: #3f3f9e;
    color: #ffffff;
    border-color: #3f3f9e;
}

.session-timeout-btn-primary:hover:not([disabled]) {
    background: #32327e;
    border-color: #32327e;
}

.session-timeout-btn-secondary {
    background: #ffffff;
    color: #1c1c1c;
    border-color: #5a5a5a;
}

.session-timeout-btn-secondary:hover {
    background: #ececec;
}

.session-timeout-btn:focus-visible,
.session-timeout-btn:focus {
    outline: 3px solid #b35c00;
    outline-offset: 2px;
}

.session-timeout-btn[disabled] {
    opacity: 1;            /* keep contrast while the keep-alive is in flight */
    cursor: progress;
}

/* Local copy so the live region works even if Bootstrap 5 CSS is absent. */
.session-timeout-live.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[data-bs-theme="dark"] .session-timeout-dialog {
    background: #1e1e24;
    color: #f1f1f1;
    border-color: #aeb8ff;
}
[data-bs-theme="dark"] .session-timeout-title {
    color: #f1f1f1;
}
[data-bs-theme="dark"] .session-timeout-countdown {
    color: #ff9a91;        /* 6.4:1 on #1e1e24 */
}
[data-bs-theme="dark"] .session-timeout-btn-primary {
    background: #aeb8ff;
    color: #14141a;
    border-color: #aeb8ff;
}
[data-bs-theme="dark"] .session-timeout-btn-secondary {
    background: #1e1e24;
    color: #f1f1f1;
    border-color: #b9b9c4;
}

body.high-contrast .session-timeout-dialog {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}
body.high-contrast .session-timeout-title,
body.high-contrast .session-timeout-desc,
body.high-contrast .session-timeout-countdown {
    color: #ffffff !important;
}
body.high-contrast .session-timeout-btn {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

@media (max-width: 480px) {
    .session-timeout-actions { flex-direction: column; }
    .session-timeout-btn { width: 100%; }
}

/* =========================================================================
   ROUND 5 - Codec Networks / Adroit Financial audit
   SC 1.4.3 Contrast (Minimum) - defects this file had not yet covered.

   Measured with the sRGB relative-luminance formula; "bg" for the badges is
   the 15%-alpha tint composited over white, which is what actually paints.

     .widget-badge.success   #27ae60 on #dff3e7  2.48:1  ->  #1b7a43  4.63:1
     .widget-badge.warning   #f39c12 on #fdf0db  1.95:1  ->  #8a5a00  5.27:1
     .widget-badge.danger    #e74c3c on #fbe4e2  3.15:1  ->  #b3261e  5.38:1
     .widget-badge.info      #16a085 on #dcf1ed  2.79:1  ->  #0f6b5c  5.44:1
     .widget-badge.primary   #667eea on #e8ecfc  3.11:1  ->  #3f3f9e  7.38:1
     sidebar active sub-link #667eea on #233240  3.58:1  ->  #aeb8ff  6.93:1
     white on brand gradient #667eea            3.66:1  ->  #4c51bf  6.49:1

   The brand gradient keeps its indigo -> purple identity; only the light stop
   is darkened, because that is the end white label text actually sits on.
   ========================================================================= */

.widget-badge.success { color: #1b7a43; }
.widget-badge.warning { color: #8a5a00; }
.widget-badge.danger  { color: #b3261e; }
.widget-badge.info    { color: #0f6b5c; }
.widget-badge.primary { color: #3f3f9e; }

.sidebar-menu ul li.active a { color: #aeb8ff; }

/* Brand gradient carrying white text - stylesheet declarations. */
.navbar-modern,
.navbar-modern .dropdown-item:hover,
.card-header,
.modal-header {
    background: linear-gradient(135deg, #4c51bf 0%, #764ba2 100%);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: linear-gradient(135deg, #4c51bf 0%, #764ba2 100%) !important;
    border-color: #4c51bf !important;
}

/* Same gradient written as an inline style on ~65 form/report templates.
   Attribute-substring selectors let one rule cover them all without editing
   every file; !important is required to beat the inline declaration. */
[style*="linear-gradient"][style*="667eea"] {
    background-image: linear-gradient(135deg, #4c51bf 0%, #764ba2 100%) !important;
}

[data-bs-theme="dark"] .widget-badge.success { color: #6ee7a0; }
[data-bs-theme="dark"] .widget-badge.warning { color: #ffc861; }
[data-bs-theme="dark"] .widget-badge.danger  { color: #ff9a91; }
[data-bs-theme="dark"] .widget-badge.info    { color: #5fd6c0; }
[data-bs-theme="dark"] .widget-badge.primary { color: #aeb8ff; }

/* =====================================================================
   ROUND 6 - BarrierBreak "Back_Office_Web_Application_RR1" regression
   round. Residuals that Rounds 2-5 declared fixed but which the RR1
   retest still failed, because the earlier rule never actually reached
   the audited element. Applied 2026-08-21.
   ===================================================================== */

/* --- BAC-43116 Sign in button (Login page), Level AA 1.4.3.
       Round 2b scoped the darkened gradient to ".form-signin .btn-primary",
       but index.cfm has no .form-signin ancestor - only .form-signin-heading -
       so the rule never matched, and css/webgroup-modern.css (which carries
       the darkened plain .btn-primary) is not loaded on the login page.
       /Focaps/css/login-modern.css:197 therefore won with
       linear-gradient(#667eea,#764ba2) !important = 3.66:1.
       A plain .btn-primary rule here beats it: same specificity, both
       !important, and accessibility-login.css is linked AFTER
       login-modern.css on index.cfm (and after webgroup-modern.css in
       Menu.cfm). NOTE: source order alone was NOT enough - login-modern.css
       targets "button#Btn" (an ID, specificity 1-0-1), which outranks a bare
       .btn-primary even with !important, so #Btn must be matched explicitly.
       #Btn is the primary action button on all six pre-login pages.
       White on #4f46b8 = 7.24:1, on #5f3f8f = 7.80:1. --- */
.btn-primary,
button#Btn,
.btn-login {
    background: linear-gradient(135deg, #4f46b8 0%, #5f3f8f 100%) !important;
    border-color: #4f46b8 !important;
    color: #ffffff !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
button#Btn:hover,
button#Btn:focus,
button#Btn:active,
.btn-login:hover,
.btn-login:focus,
.btn-login:active {
    background: linear-gradient(135deg, #5f3f8f 0%, #4f46b8 100%) !important;
    border-color: #5f3f8f !important;
    color: #ffffff !important;
}

/* --- BAC-54750 "Export" button, and the same latent fault on the other
       brand buttons. Bootstrap 5 ships --bs-btn-hover-color:#000 for the
       info/success/warning variants, so :hover flipped the label to BLACK
       over our darkened background (#0A648F) = 3.2:1, even though the
       resting state was already fixed. Force the label to stay white; the
       backgrounds are dark enough that white clears 4.5:1
       (#0a5e94 = 6.91:1, #107a5e = 5.36:1). --- */
.btn-info,
.btn-info:hover,
.btn-info:focus,
.btn-info:active,
.btn-success,
.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-danger,
.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
    color: #ffffff !important;
}

/* --- BAC-49160 / BAC-54613 calendar day cells, Level AA 1.4.3.
       The day cells and the prev/next/clear controls in the shared date
       picker render as .btn-outline-secondary (custom-forms.js). No
       stylesheet overrode :hover, so Bootstrap's default #6c757d fill with
       #333333 text stood at 2.69:1. #495057 with white = 8.05:1. --- */
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active,
.btn-outline-secondary.active {
    background-color: #495057 !important;
    border-color: #495057 !important;
    color: #ffffff !important;
}

/* --- BAC-43357 focus indicator on the "share" icon-link, Level AA 1.4.11.
       Round 2 gave the white ring + dark halo to .navbar-modern, the tab
       strips, .offcanvas and .sidebar, but the share/detail link inside the
       purple card headers (.multi-header a) was not in that list, so the
       generic #005fcc ring still applied - 1.03:1 on the #7354AF header.
       Same treatment as the other coloured chrome. --- */
.multi-header a:focus-visible,
.multi-header button:focus-visible,
.filter-box-title a:focus-visible,
.filter-box-title button:focus-visible,
.card-header a:focus-visible,
.card-header button:focus-visible,
.modal-header a:focus-visible,
.modal-header button:focus-visible {
    outline: 3px solid #ffffff !important;
    outline-offset: 0 !important;
    box-shadow: 0 0 0 6px #003a75 !important;
}

/* --- BAC-43016 layout guard. /Focaps/css/login-modern.css sets
       body{display:flex;align-items:center;justify-content:center} on the
       login pages. Moving <footer> out of <main> (so contentinfo is no longer
       nested in main) made it a SECOND flex item on body, which painted it
       beside the card instead of under it. This shell restores a single flex
       item and stacks main + footer vertically. The footer remains a sibling
       of <main>, so the landmark fix is unaffected. --- */
.login-page-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
}
.login-page-shell > main {
    width: 100%;
}

/* ============================================================================
   ROUND 7 - Paterson / EnableUser audit EU20260819 (run 2026-08-19)
   ========================================================================= */

/* --- SC 1.4.3. Bootstrap 5 ships .btn-outline-primary with --bs-btn-color:
       #0d6efd, which is only 3.68:1 on white - it fails as normal text on the
       FTP quick-range buttons (Ledger/FTP.cfm "Last 7 days" ... "Last 1 year")
       and anywhere else the outline variant is used. Round 6 gave the same
       treatment to -secondary but never covered -primary. #0a58ca = 6.44:1.
       :hover is pinned too - Bootstrap fills with #0d6efd and white text, which
       measures exactly 4.50:1, on the threshold with no margin. --- */
.btn-outline-primary {
    --bs-btn-color: #0a58ca;
    --bs-btn-border-color: #0a58ca;
    --bs-btn-hover-bg: #0a58ca;
    --bs-btn-hover-border-color: #0a58ca;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-bg: #0a4bab;
    --bs-btn-active-border-color: #0a4bab;
    --bs-btn-active-color: #ffffff;
    color: #0a58ca;
    border-color: #0a58ca;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: #0a58ca;
    border-color: #0a58ca;
    color: #ffffff;
}

/* --- BAC-A11Y 1.4.3 (report: ExpenseTO .btn-danger, #ffffff on #f8f9fa = 1.05:1).
       The footer PDF button rendered with no fill of its own, leaving white
       text on the light footer. Same global backstop pattern as .btn-success
       above: #c62828 with white text = 5.62:1. --- */
.btn-danger,
.ibox-footer .btn-danger,
.btn-danger:not(:hover):not(:focus) {
    background-color: #c62828;
    border-color: #c62828;
    color: #ffffff;
}
.btn-danger:hover,
.btn-danger:focus {
    background-color: #b71c1c;
    border-color: #b71c1c;
}
body.high-contrast .btn-danger {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 3px solid #000000 !important;
}

/* --- BAC-A11Y 1.4.3: login / OTP link colours. /Focaps/css/login-modern.css
       now uses #4c51bf (6.49:1 on white) instead of #667eea (3.66:1). In the
       dark theme the card behind these links is #2d3338 / #0f172a, where an
       indigo that dark would fail, so dark mode gets a light indigo
       (#aeb8ff = 6.76:1 on #2d3338). !important is needed because
       login-modern.css marks the footer-link hover colour !important. --- */
[data-bs-theme="dark"] .text-center a:not(.btn),
[data-bs-theme="dark"] .confirm-link,
[data-bs-theme="dark"] .external-links-toggle:hover,
[data-bs-theme="dark"] .page-header a:hover,
[data-bs-theme="dark"] .page-footer a:hover {
    color: #aeb8ff !important;
}
