/* ─────────────────────────────────────────────────────────────────────────────
   Bootstrap success → the brand green of record (#716)

   DESIGN.md's migration plan says Bootstrap's success classes are "overridden centrally rather
   than per-page". This is that file. It must load AFTER bootstrap.min.css, which is why it is a
   separate stylesheet rather than a section of brand-tokens.css — that one loads before Bootstrap
   and would simply be overwritten.

   WHY A VARIABLE OVERRIDE ALONE IS NOT ENOUGH, which is worth knowing before anyone "simplifies"
   this file: Bootstrap 5.3 contains ZERO uses of `var(--bs-success)`. The classes are split:

     .text-success / .bg-success / .border-success  →  read var(--bs-success-rgb)   ✓ variable works
     .btn-success / .link-success                   →  hardcode #198754              ✗ needs the class

   So setting the variable and stopping would look like a fix and change roughly half of what it
   appears to. Both halves are here.

   CONTRAST — every change here IMPROVES it, which is why this was safe to do centrally:

     #198754 on white            4.53:1   →   #107838 on white            5.58:1
     white on #198754            4.53:1   →   white on #107838            5.58:1
     #28a745 on white (BS4 era)  3.13:1   →                               5.58:1

   NOT TOUCHED, deliberately: `.alert-success`. Bootstrap gives it its own hardcoded, contrast-
   tuned trio (#0f5132 on #d1e7dd, border #badbcc) that does not derive from --bs-success at all,
   so this file does not reach it and should not. Repointing alert TEXT at a brand token was
   considered and rejected on the numbers: --color-green-dk on Bootstrap's light-green alert
   surface reads 4.49:1, just under the 4.5 floor DESIGN.md sets, and the primary green is 2.62:1.
   An alert is the one place legibility outranks brand consistency.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
    /* Drives .text-success, .bg-success, .border-success and anything else reading the rgb triple. */
    --bs-success: #107838;
    --bs-success-rgb: 16, 120, 56;
}

/* Hardcoded in Bootstrap, so restated here. Values mirror the brand ramp: green-dk at rest,
   deeper on hover/active, matching how --color-green/--color-green-dk relate elsewhere. */
.btn-success {
    --bs-btn-bg: var(--color-green-dk);
    --bs-btn-border-color: var(--color-green-dk);
    --bs-btn-hover-bg: #0c5d2b;
    --bs-btn-hover-border-color: #0c5d2b;
    --bs-btn-active-bg: #0a4f24;
    --bs-btn-active-border-color: #0a4f24;
    --bs-btn-disabled-bg: var(--color-green-dk);
    --bs-btn-disabled-border-color: var(--color-green-dk);
    /* Focus ring uses the brand green's rgb so the halo matches the rest of the app's 3px ring. */
    --bs-btn-focus-shadow-rgb: 34, 164, 71;
}

.link-success {
    color: var(--color-green-dk) !important;
}

.link-success:hover,
.link-success:focus {
    color: #0c5d2b !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Form switches and checkboxes → the green of record

   Every toggle in the app rendered Bootstrap blue (#0d6efd): the Load Attributes switches on
   Post New Load, every checkbox, every radio. DESIGN.md allows one accent, and blue is not it.

   Same split as the success classes above — Bootstrap 5.3 hardcodes all of these, so a variable
   override alone changes nothing:

     .form-check-input:checked              background-color/border-color: #0d6efd
     .form-check-input:focus                border-color: #86b7fe, box-shadow: rgba(13,110,253,.25)
     .form-switch .form-check-input:focus   thumb SVG filled #86b7fe

   THE :checked:focus RESTORE IS LOAD-BEARING. Bootstrap orders its own `:checked` rule (white
   thumb) after its `:focus` rule (tinted thumb), so a checked, focused switch keeps a white knob.
   This file loads later, so our `:focus` override would otherwise beat Bootstrap's `:checked` and
   paint a green knob on a green track — an "on" switch that looks blank the moment it is focused.

   CONTRAST, non-text UI per WCAG 1.4.11 (3:1 floor). Unlike the success classes above, this
   change LOWERS contrast and still passes — worth stating plainly rather than leaving the
   file's earlier "every change improves it" to cover it:

     white thumb on #22A447 track   3.25:1  ✓ (was 4.50:1 on Bootstrap's #0d6efd)
     #22A447 track on white page    3.25:1  ✓
     green focus thumb on white     3.25:1  ✓

   #107838 (green-dk) would score better, and .btn-success uses it. Not used here on purpose:
   DESIGN.md assigns green-dk to hover/pressed and #22A447 to the resting accent, and a switch
   that is simply "on" is at rest. Consistency with every other resting accent in the app beats
   1.2 points of headroom above a floor we already clear.

   The focus ring uses --focus-ring, so toggles get the app's 3px green halo rather than
   Bootstrap's 4px blue one. State is never carried by colour alone here — the knob also moves.
   ───────────────────────────────────────────────────────────────────────────── */

.form-check-input:checked {
    background-color: var(--color-green);
    border-color: var(--color-green);
}

.form-check-input:focus {
    border-color: var(--color-green);
    box-shadow: var(--focus-ring);
}

/* Unchecked + focused: Bootstrap swaps in a blue-tinted knob. Green, same geometry. */
.form-switch .form-check-input:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2322A447'/%3e%3c/svg%3e");
}

/* Checked + focused: put Bootstrap's white knob back — see the note above. */
.form-switch .form-check-input:checked:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

/* ─────────────────────────────────────────────────────────────────────────────
   #155724 — the success-text green this file deliberately does NOT repoint (#716).

   Roughly thirty sites paint dark green text on Bootstrap's pale green success surface
   (#d4edda): the MC-number lookup's "Active" badge, the BOL pre-upload hints, the bulk-upload
   modal, the agent-keys and admin dashboards, connector-details. It reads as a stray in a grep
   and is not one. Same reasoning as .alert-success above, and the same arithmetic:

     #155724 on #d4edda   6.99:1   ✓
     #107838 on #d4edda   4.49:1   — just under the 4.5 floor DESIGN.md sets
     #22A447 on #d4edda   2.62:1   ✗

   Repointing would take a comfortable pass to a fail, on the one kind of component
   where legibility outranks brand consistency. Recorded here so the next sweep does not have
   to re-derive it, and so "why is this green still here" has an answer that is a number.
   ───────────────────────────────────────────────────────────────────────────── */
