/* == Module header (D6). Purpose/Status are hand-written; Module-Map.py --check verifies the rest. ==
   Purpose:   Brothers Sound & Security color contract, V46.90.
   Status:    active
   Loaded by: alarm-monitoring.html, change-password.html, customer-portal.html,
              customer-welcome.html, fire-inspections.html, login.html, phone-sign-in.html,
              reset-password.html, single-sign-on.html, support-desk.html, support-sessions.html,
              support-verify-email.html, and 1 more (MODULES.md)
   Replaces:  none
   History:   90, 305, 311, 315, 319, 382
   == end of module header == */
/* Brothers Sound & Security color contract, V46.90.
   Blue: actions, selection, focus, progress. Green: success / healthy / billed.
   Amber: pending / attention. Red: errors, outages, destructive actions only.
   Module icon colors and provider logos retain their established identities.
   Keep these tokens when importing shared LogicFortress components. */
@layer app {
    html:root,
    html:root body {
        --bss-primary: var(--brand-primary, #087fe3); /* BSS 305 (2026-10-15, review O7): alias of brand-tokens.css */
        --bss-primary-hover: #066bc0;
        --bss-brand-green: #09ab3a;
        --bss-success: #137d48;
        --bss-success-soft: #e3f3e9;
        --bss-warning: #977100;
        --bss-warning-soft: #fff3d6;
        --bss-danger: #c43838;
        --bss-danger-soft: #fbe9e9;
        --bss-selected: #e4f1fe;
        --accent: var(--bss-primary);
        --blue: var(--bss-primary);
        --brand: var(--bss-primary);
        --lf-red: var(--bss-primary);
        --activity31: var(--bss-primary);
        --drive-accent: var(--bss-primary);
        --drive-selected: var(--bss-selected);
        --selected: var(--bss-selected);
        --green: var(--bss-success);
        --amber: var(--bss-warning);
        --red: var(--bss-danger);
    }

    html.dark,
    html.dark body {
        --bss-primary: var(--brand-primary, #58b0ff); /* BSS 305 (2026-10-15, review O7): alias of brand-tokens.css */
        --bss-primary-hover: #85c5ff;
        --bss-success: #58d889;
        --bss-success-soft: #203e2d;
        --bss-warning: #f0bf57;
        --bss-warning-soft: #40361f;
        --bss-danger: #ff8289;
        --bss-danger-soft: #48282d;
        --bss-selected: #203b53;
    }

    /* Native and dynamically inserted controls inherit the same accent. */

    html body .bss-primary90 {
        background: var(--bss-primary);
        color: #fff;
        border-color: var(--bss-primary)
    }

    html body .bss-primary90:hover {
        background: var(--bss-primary-hover)
    }

    html body .bss-admin-badge90 {
        background: var(--bss-selected);
        color: var(--bss-primary);
        border-color: var(--bss-primary)
    }

    html body .bss-danger90 {
        background: var(--bss-danger);
        color: #fff;
        border-color: var(--bss-danger)
    }

    html body .bss-destructive90 {
        color: var(--bss-danger)
    }

    html body :is(.danger, .discard-button42, #delete-user, #btn-delete-selected-sales) {
        color: var(--bss-danger)
    }

    html body .discard42 .discard-button42,
    html body .bss-danger90 {
        background: var(--bss-danger);
        color: #fff
    }

    html body :is(.billing-icon-next.awaiting-next, .billing-status-button-next.awaiting-next>span:last-child) {
        color: var(--bss-warning);
        border-color: var(--bss-warning)
    }

    html body :is(.billing-icon-next.manual-next, .billing-icon-next.billed-next) {
        color: var(--bss-success);
        border-color: var(--bss-success)
    }

    html body :is(#notice.error, #receive-error, .login-error, .dialog-error, #item-edit-error, #photo-view-error) {
        color: var(--bss-danger)
    }

    /* BSS 311 (2026-10-15, review O2): from ui-layer-235 (look and consistency): buttons: brand fill for the main action only (this file is
       loaded by every page, the public request form included). Every line is forced because design-system.css fills
       and rounds `.primary` the same way (the link blue, 7px) and files-page.css styles every button on the Files page
       by the body id. */
    body :is(button.primary, .button.primary, a.button.primary, .bss-primary90) {
        background: var(--u-primary) !important; /* design-system.css (LF 319 / BSS 382: new name) fills/rounds .primary with !important */
        border-color: var(--u-primary) !important; /* design-system.css fills/rounds .primary with !important */
        color: var(--u-on-primary) !important; /* design-system.css fills/rounds .primary with !important */
    }
    body :is(button.primary, .bss-primary90):not(:disabled):hover {
        background: var(--u-primary-hover) !important; /* design-system.css (LF 319 / BSS 382: new name) fills/rounds .primary with !important */
        border-color: var(--u-primary-hover) !important; /* design-system.css fills/rounds .primary with !important */
    }
    /* a destructive main action is red (after the brand fill above, which it overrides) */
    body button.primary.ui-danger { /* over the brand fill above */
        color: #fff;
    }
    /* over the brand fill above */

    /* BSS 311 (2026-10-15, review O2): from ui-layer-235 (look and consistency): in dark mode the light link blue is for text only; every
       button that used it as a fill with white text gets the deeper button blue (white text 5:1), destructive buttons
       stay red; leftover hard-coded blues that missed 4.5:1. */
    html.dark body :is(#file-prompt-ok, #sidebar-pane button[onclick="promptScanIn()"], #receive-submit, .login-card form > button:not([type="button"]),
        #restore-submit, .lf-primary, #bio-prompt-modal button[onclick="acceptBiometricsEnrollment()"], .photo-toolbar [data-photo="close"],
        .inventory-actions-next .primary, .bss-contact-avatar102, .bss-primary90):not(.ui-danger) {
        /* !important: design-system.css (LF 319 / BSS 382: new name) fills these buttons with the link blue, !important */
        background: var(--u-primary) !important; /* design-system.css fills these with the link blue, !important */
        color: #fff !important; /* design-system.css fills these with the link blue, !important */
    }
    html.dark body :is(#file-prompt-ok, #sidebar-pane button[onclick="promptScanIn()"], #receive-submit, .login-card form > button:not([type="button"]),
        #restore-submit, .lf-primary, .inventory-actions-next .primary, .bss-primary90):hover {
        background: var(--u-primary-hover) !important; /* design-system.css (LF 319 / BSS 382: new name) fills these with the link blue, !important */
    }
    html body :is(.upload76, details > summary, [role="tab"][aria-selected="true"] strong) {
        color: var(--u-accent) !important; /* files-page.css: every Files-page link inherits, by the body id; controls.css colours focused controls */
    }
    .sitecell163 small { color: var(--u-muted); }
    /* BSS 315 (2026-10-15, review O2): from ui-layer-245: Incident history's "Create / link ticket" button matches the secondary buttons on
       Tickets (card fill, outline, readable text) and wraps inside its column. Forced with `html body` + !important: the
       `html body` button fill, colour and padding rules of design-system.css and the hover fills above are. */
    html body button[data-incident101] { /* forced: design-system.css (LF 319 / BSS 382: new name)'s `html body` button rules are !important */
        align-items: center;
        min-height: 28px; /* forced: design-system.css's `html body` button rules are !important */
        max-width: 100%; /* forced: design-system.css (LF 319 / BSS 382: new name)'s `html body` button rules are !important */
        text-align: center; /* forced: design-system.css's `html body` button rules are !important */
        cursor: pointer;
    }
    /* forced: the hover fills above are !important */

    /* BSS 311 (2026-10-15, review O2): from ui-layer-235 (look and consistency): focus is always visible, on every page (bss-verify63 loads
       no other suite sheet). Forced with `html body`: controls.css removes the outline of every focused control,
       and of the dialog Close button by its label, the same way; app-header-account.css's ring is forced too. */
    /* controls.css un-outlines focused controls with !important */
}

/* priority rules. Rules above sit in the app layer; these plain rules
   win over any of them (what !important used to do), and compete with each other as before. */
html body input:is([type=checkbox], [type=radio], [type=range]), html body progress {
    accent-color: var(--bss-primary);
}
body :is(button.primary, .button.primary, a.button.primary, .bss-primary90) {
    /* design-system.css fills/rounds .primary with !important */
    border-radius: 8px;
    /* design-system.css fills/rounds .primary with !important */
    font-weight: 600;
}
body button.primary.ui-danger {
    background: #c43838;
    /* over the brand fill above */
    border-color: #c43838;
}
body button.primary.ui-danger:not(:disabled):hover {
    background: #a92e2e;
    border-color: #a92e2e;
}
html.dark body :is(#file-prompt-ok, #sidebar-pane button[onclick="promptScanIn()"], #receive-submit, .login-card form > button:not([type="button"]), #restore-submit, .lf-primary, #bio-prompt-modal button[onclick="acceptBiometricsEnrollment()"], .photo-toolbar [data-photo="close"], .inventory-actions-next .primary, .bss-contact-avatar102, .bss-primary90):not(.ui-danger) {
    /* design-system.css fills these with the link blue, !important */
    border-color: var(--u-primary);
}
html body button[data-incident101] {
    display: inline-flex;
    padding: 3px 8px;
    /* forced: design-system.css's `html body` button rules are !important */
    border: 1px solid var(--u-line-strong);
    /* forced: design-system.css's `html body` button rules are !important */
    border-radius: 6px;
    /* forced: design-system.css's `html body` button rules are !important */
    background: var(--u-card);
    /* forced: design-system.css's `html body` button rules are !important */
    color: var(--u-text);
    /* forced: design-system.css's `html body` button rules are !important */
    font-size: 12px;
    /* forced: design-system.css's `html body` button rules are !important */
    font-weight: 500;
    /* forced: design-system.css's `html body` button rules are !important */
    line-height: 1.3;
    white-space: normal;
    box-shadow: none;
}
html body button[data-incident101]:hover {
    background: var(--u-hover);
    /* forced: the hover fills above are !important */
    border-color: var(--u-accent);
}
html body :is(button, a, [role=button], summary):focus-visible, html body button[aria-label^="Close"]:focus-visible {
    outline: 2px solid var(--u-focus);
    outline-offset: 2px;
}
