/*
 * The project's own stylesheet, loaded after the vendored theme (static/css/apple/app.min.css, which is never edited).
 *
 * Success green (ENR-UAT1-48 second PR, U-205; Balaji, Nov 21, 2026): the theme's --bs-success is #4CD964, and white on
 * it is 1.8:1 (the Login button, 30 `btn-success` uses, `text-success`, `bg-success`). #198754 keeps white at 4.53:1,
 * and as text on a white page too (4.53:1). Hover #157347 (5.87:1 with white) and active #146c43 (6.45:1), Bootstrap
 * 5.3's own pair. Set here once: every success button, badge, alert and `text-success` follows the variable below.
 * The Browser check's contrast row (U-206) measures the result on every page.
 */
:root,
[data-bs-theme=light] {
  --bs-success: #198754;
  --bs-success-rgb: 25, 135, 84;
}

.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: #198754;
  --bs-btn-border-color: #198754;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #157347;
  --bs-btn-hover-border-color: #146c43;
  --bs-btn-focus-shadow-rgb: 60, 153, 110;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #146c43;
  --bs-btn-active-border-color: #13653f;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #198754;
  --bs-btn-disabled-border-color: #198754;
}

/* The theme also sets these two with fixed colours, after the variables. */
.btn-success,
.input-group > .btn + .btn-success,
.input-group > .btn + .dropdown-menu + .btn-success {
  border-left-color: #198754;
}

.btn-success:hover {
  border-color: #146c43;
  background-color: #157347;
}

.btn-success:active,
.btn-success.active {
  border-color: #13653f;
  background-color: #146c43;
}

.btn-outline-success {
  --bs-btn-color: #198754;
  --bs-btn-border-color: #198754;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #198754;
  --bs-btn-hover-border-color: #198754;
  --bs-btn-focus-shadow-rgb: 25, 135, 84;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #198754;
  --bs-btn-active-border-color: #198754;
  --bs-btn-disabled-color: #198754;
  --bs-btn-disabled-border-color: #198754;
}

.text-bg-success {
  color: #fff !important;
}

/* Form validation messages used the theme's fixed #4cd964 text colour. */
.valid-feedback,
.form-check-input.is-valid ~ .form-check-label,
.was-validated .form-check-input:valid ~ .form-check-label {
  color: #198754;
}

.form-control.is-valid,
.was-validated .form-control:valid,
.form-select.is-valid,
.was-validated .form-select:valid,
.form-check-input.is-valid,
.was-validated .form-check-input:valid {
  border-color: #198754;
}

.form-check-input.is-valid:checked,
.was-validated .form-check-input:valid:checked {
  background-color: #198754;
}

/*
 * Text contrast beyond the green (ENR-UAT1-48 second PR, U-206, A-UAT1-48-32). The Browser check's contrast row
 * measured every page: the theme's blue (#007AFF: white on it, and it as text on white, is 4.0:1; on the page's grey 3.2:1),
 * its grey (#7a7a7a, 4.3:1) and its red (#FF3B30, 3.6:1) failed the same 4.5:1 the green did. The darker shades below keep
 * the hues, are set here once like the green, and the theme's files are not edited. Primary is the theme's own darker shade
 * (#005cbf, which it uses for hover); white on it is 6.4:1 and it on the page's grey #e4e7e8 is 5.2:1. To go back to the
 * theme's colours, delete this block.
 */
:root,
[data-bs-theme=light] {
  --bs-primary: #005cbf;
  --bs-primary-rgb: 0, 92, 191;
  --bs-link-color: #005cbf;
  --bs-link-color-rgb: 0, 92, 191;
  --bs-link-hover-color: #004a99;
  --bs-link-hover-color-rgb: 0, 74, 153;
  --bs-secondary: #616161;
  --bs-secondary-rgb: 97, 97, 97;
  --bs-danger: #c4251c;
  --bs-danger-rgb: 196, 37, 28;
  /* Muted text, helper lines and inactive tabs: the theme's 50 to 75% of the body colour is 3 to 4:1 on white. */
  --bs-secondary-color: rgba(56, 56, 56, 0.85);
  --bs-secondary-color-rgb: 56, 56, 56;
  --bs-component-active-bg: #005cbf;
  --bs-app-theme: #005cbf;
  --bs-app-theme-rgb: 0, 92, 191;
  --bs-app-theme-hover: #004a99;
  --bs-app-theme-hover-border-color: #004a99;
  --bs-app-theme-active: #00448c;
  --bs-app-theme-active-border-color: #00448c;
  --bs-app-theme-disabled: #005cbf;
  --bs-app-theme-disabled-border-color: #005cbf;
}

.btn-primary {
  --bs-btn-bg: #005cbf;
  --bs-btn-border-color: #005cbf;
  --bs-btn-hover-bg: #004a99;
  --bs-btn-hover-border-color: #004a99;
  --bs-btn-focus-shadow-rgb: 38, 124, 204;
  --bs-btn-active-bg: #00448c;
  --bs-btn-active-border-color: #00448c;
  --bs-btn-disabled-bg: #005cbf;
  --bs-btn-disabled-border-color: #005cbf;
}

.btn-primary,
.input-group > .btn + .btn-primary,
.input-group > .btn + .dropdown-menu + .btn-primary {
  border-left-color: #004a99;
}

.btn-primary:hover {
  border-color: #004a99;
  background-color: #004a99;
}

.btn-outline-primary {
  --bs-btn-color: #005cbf;
  --bs-btn-border-color: #005cbf;
  --bs-btn-hover-bg: #005cbf;
  --bs-btn-hover-border-color: #005cbf;
  --bs-btn-focus-shadow-rgb: 0, 92, 191;
  --bs-btn-active-bg: #005cbf;
  --bs-btn-active-border-color: #005cbf;
  --bs-btn-disabled-color: #005cbf;
  --bs-btn-disabled-border-color: #005cbf;
}

.btn-link {
  --bs-btn-color: #005cbf;
  --bs-btn-hover-color: #004a99;
  --bs-btn-active-color: #004a99;
  --bs-btn-focus-shadow-rgb: 38, 124, 204;
}

.btn-secondary {
  --bs-btn-bg: #616161;
  --bs-btn-border-color: #616161;
  --bs-btn-hover-bg: #4d4d4d;
  --bs-btn-hover-border-color: #4d4d4d;
  --bs-btn-active-bg: #404040;
  --bs-btn-active-border-color: #404040;
  --bs-btn-disabled-bg: #616161;
  --bs-btn-disabled-border-color: #616161;
}

.btn-secondary,
.input-group > .btn + .btn-secondary,
.input-group > .btn + .dropdown-menu + .btn-secondary {
  border-left-color: #4d4d4d;
}

.btn-outline-secondary {
  --bs-btn-color: #616161;
  --bs-btn-border-color: #616161;
  --bs-btn-hover-bg: #616161;
  --bs-btn-hover-border-color: #616161;
  --bs-btn-focus-shadow-rgb: 97, 97, 97;
  --bs-btn-active-bg: #616161;
  --bs-btn-active-border-color: #616161;
  --bs-btn-disabled-color: #616161;
  --bs-btn-disabled-border-color: #616161;
}

.btn-danger {
  --bs-btn-bg: #c4251c;
  --bs-btn-border-color: #c4251c;
  --bs-btn-hover-bg: #a31f17;
  --bs-btn-hover-border-color: #a31f17;
  --bs-btn-focus-shadow-rgb: 207, 70, 62;
  --bs-btn-active-bg: #8f1b14;
  --bs-btn-active-border-color: #8f1b14;
  --bs-btn-disabled-bg: #c4251c;
  --bs-btn-disabled-border-color: #c4251c;
}

.btn-danger,
.input-group > .btn + .btn-danger,
.input-group > .btn + .dropdown-menu + .btn-danger {
  border-left-color: #a31f17;
}

.btn-danger:hover {
  border-color: #a31f17;
  background-color: #a31f17;
}

.btn-outline-danger {
  --bs-btn-color: #c4251c;
  --bs-btn-border-color: #c4251c;
  --bs-btn-hover-bg: #c4251c;
  --bs-btn-hover-border-color: #c4251c;
  --bs-btn-focus-shadow-rgb: 196, 37, 28;
  --bs-btn-active-bg: #c4251c;
  --bs-btn-active-border-color: #c4251c;
  --bs-btn-disabled-color: #c4251c;
  --bs-btn-disabled-border-color: #c4251c;
}

/* The sidebar's group headings: the theme's white at 45% on black is 4.4:1. */
.app-sidebar .menu .menu-header {
  color: rgba(255, 255, 255, 0.6);
}

/* Inactive tabs (the theme sets this on `.nav` itself, at 50%) and helper lines under a field (a fixed #919191). */
.nav {
  --bs-nav-link-color: rgba(var(--bs-component-color-rgb), 0.75);
}

.form-text {
  color: #616161;
}

/*
 * Warning and info text (BEB-727 review round 1, F3; same approach as A-UAT1-48-32). The theme's `text-warning` is #FF9500
 * (2.20:1 on white) and `text-info` is #5AC8FA (1.90:1): conditional messages on the onboarding pages, the critical
 * illness note and two beneficiary and dependent notes use them. Darker shades of the same hues, each at 4.5:1 on white
 * AND on the page's grey #e4e7e8 (#965800: 5.69 and 4.58; #056e9e: 5.63 and 4.53). Only the TEXT classes change: the
 * `bg-warning text-dark` badges keep the theme's orange (dark text on it is 7.0:1) and the `alert-warning` and
 * `alert-info` boxes keep the theme's own tints (their text is 7.4:1 or better). The `btn-warning` button (white text)
 * takes the same orange with its hover and active shades (5.69, 7.25, 8.76 with white); since UAT1-D56 no template or
 * script uses `btn-warning` (the one Cancel button that did is `btn-cancel`, below). To go back to the theme's colours,
 * delete this block.
 */
.text-warning {
  color: #965800 !important;
}

.text-info {
  color: #056e9e !important;
}

.btn-warning {
  --bs-btn-bg: #965800;
  --bs-btn-border-color: #965800;
  --bs-btn-hover-bg: #804a00;
  --bs-btn-hover-border-color: #804a00;
  --bs-btn-focus-shadow-rgb: 170, 108, 38;
  --bs-btn-active-bg: #6e4000;
  --bs-btn-active-border-color: #6e4000;
  --bs-btn-disabled-bg: #965800;
  --bs-btn-disabled-border-color: #965800;
}

.btn-warning,
.input-group > .btn + .btn-warning,
.input-group > .btn + .dropdown-menu + .btn-warning {
  border-left-color: #804a00;
}

.btn-warning:hover {
  border-color: #804a00;
  background-color: #804a00;
}

.btn-warning:active,
.btn-warning.active {
  border-color: #6e4000;
  background-color: #6e4000;
}

/*
 * Cancel buttons (Balaji's exception, UAT1-D56, Nov 23, 2026). Wave 7's contrast PR (#222, `8ecabcb`) darkened the Cancel
 * button's orange to #965800 (through `btn-warning`, above). Balaji put it back: white text on the theme's #ff9500, exactly
 * as on `470e3235` (the theme's own `btn-warning` values, restated here under a class of the project's own). He accepts
 * that it fails contrast (white on #ff9500 is 2.2:1). The class is for Cancel buttons and nothing else: the Browser check's
 * contrast row skips elements inside `.btn-cancel` and no other element (`scripts/browser_check/ui_lib.js`), so any other
 * low-contrast element still fails. Defined once, here. To undo, change the template back to `btn-warning` and delete this
 * block and the row's exception.
 */
.btn-cancel {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: #ff9500;
  --bs-btn-border-color: #ff9500;
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #bf7000;
  --bs-btn-hover-border-color: #bf7000;
  --bs-btn-focus-shadow-rgb: 255, 165, 38;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: #bf7000;
  --bs-btn-active-border-color: #bf7000;
  --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
  --bs-btn-disabled-color: #ffffff;
  --bs-btn-disabled-bg: #ffb040;
  --bs-btn-disabled-border-color: #ffb040;
}
