/* ==========================================================================
   Dark theme, site wide (public site, account pages, PO app, staff pages).
   Turned on by html[data-theme="dark"] (main/_theme_head.html: the footer
   switch, or the device's own setting on Auto). Every rule starts with that
   selector, so the light theme is exactly as it was.

   One palette (below). Brand navy is lifted a little so it reads on dark;
   brand red stays. Status colours keep their meaning, with dark tints.
   ========================================================================== */

/* Built-in controls and scrollbars follow the chosen theme, not the device. */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] {
    color-scheme: dark;

    --d-bg: #0f1216;          /* page */
    --d-surface: #171b22;     /* cards, panels */
    --d-raised: #1e232c;      /* inputs, table heads, hover */
    --d-raised-2: #262c37;
    --d-line: #2c333f;        /* borders */
    --d-line-2: #3a4250;
    --d-text: #e6e9ee;
    --d-text-2: #c0c7d2;
    --d-text-3: #8d97a6;
    --d-blue: #4a8fd8;        /* brand navy, lifted for dark */
    --d-blue-strong: #2f6fb3; /* navy buttons (white text) */
    --d-blue-tint: #172536;
    --d-red: #ff4d63;
    --d-green: #3ecf8e;
    --d-amber-tint: #2f2712;

    /* The site's own colour variables (store.css, pages.css, shop.css,
       home.css, account.css, legal.css, checkout.css). Only ones that
       always mean a background, a border or text are swapped. */
    --rr-bg: var(--d-bg);  --rr-card: var(--d-surface);  --rr-line: var(--d-line);
    --rr-text: var(--d-text);  --rr-text-2: var(--d-text-2);  --rr-text-3: var(--d-text-3);
    --rr-blue: var(--d-blue);  --rr-blue-dark: var(--d-blue-strong);  --rr-blue-tint: var(--d-blue-tint);
    --rr-green-tint: #12301f;  --rr-amber-tint: var(--d-amber-tint);
    --rr-shadow: 0 2px 12px rgba(0, 0, 0, .35);
    --rr-steel: var(--d-surface);  --rr-card-bg: var(--d-surface);  --rr-mid: var(--d-text-3);
    --rr-border: var(--d-line);  --rr-navy: var(--d-blue);

    --p-blue: var(--d-blue);  --p-blue-dark: var(--d-blue-strong);  --p-blue-tint: var(--d-blue-tint);
    --p-red-tint: #3a1519;  --p-bg: var(--d-bg);  --p-white: var(--d-surface);  --p-bg-image: var(--d-raised);
    --p-border: var(--d-line);  --p-text-1: var(--d-text);  --p-text-2: var(--d-text-2);
    --p-text-3: var(--d-text-3);  --p-text-muted: #6f7a89;
    --p-shadow: 0 2px 12px rgba(0, 0, 0, .35);  --p-shadow-lg: 0 8px 32px rgba(0, 0, 0, .45);
    --p-shadow-hover: 0 16px 48px rgba(0, 0, 0, .5);

    --blue: var(--d-blue);  --blue-dark: var(--d-blue-strong);  --blue-tint: var(--d-blue-tint);
    --red-tint: #3a1519;  --bg: var(--d-bg);  --bg-card: var(--d-surface);  --bg-image: var(--d-raised);
    --border: var(--d-line);  --text-1: var(--d-text);  --text-2: var(--d-text-2);  --text-3: var(--d-text-3);
    --text-muted: #6f7a89;  --shadow-card: 0 2px 12px rgba(0, 0, 0, .35);

    --lg-navy: var(--d-blue);  --lg-ink: var(--d-text);  --lg-steel: var(--d-surface);
    --lg-mid: var(--d-text-3);  --lg-line: var(--d-line);

    --steel-line: var(--d-line);  --panel: var(--d-surface);  --paper: var(--d-bg);
    --charcoal: var(--d-text);  --charcoal-soft: var(--d-text-2);  --steel: var(--d-text-3);
    --success-tint: #12301f;  --danger-tint: #3a1a12;  --warning-tint: var(--d-amber-tint);  --warning-line: #6b5520;

    /* PO app status colours (status-colors.css): same colours, dark tints */
    --rr-st-needs-tint: #3a1716;  --rr-st-work-tint: #3a2212;  --rr-st-counted-tint: #142a45;
    --rr-st-loaded-tint: #23272f;  --rr-st-delivered-tint: #0f2e21;
    --rr-urg-ink: #e6e9ee;
    --rr-btn-view: var(--d-blue-strong);  --rr-btn-view-dark: #275f9b;
    --rr-surface: var(--d-surface);   /* Deliveries page cards */
}

/* ---- Page ---------------------------------------------------------------- */
html[data-theme="dark"] body { background-color: var(--d-bg) !important; color: var(--d-text); }
/* Plain elements use :where() so they weigh no more than a bare tag: any
   class (a button, a badge, a page's own heading colour) still wins. */
:where(html[data-theme="dark"]) :where(h1, h2, h3, h4, h5, h6) { color: var(--d-text); }
:where(html[data-theme="dark"]) a { color: var(--d-blue); }
:where(html[data-theme="dark"]) a:hover { color: #7fb0e6; }
html[data-theme="dark"] hr { border-color: var(--d-line); }
html[data-theme="dark"] ::selection { background: #2f6fb3; color: #fff; }
html[data-theme="dark"] img { color-scheme: normal; }

/* ---- Bootstrap 4 ----------------------------------------------------------- */
html[data-theme="dark"] .text-dark, html[data-theme="dark"] .text-body { color: var(--d-text) !important; }
html[data-theme="dark"] .text-muted, html[data-theme="dark"] .text-secondary { color: var(--d-text-3) !important; }
html[data-theme="dark"] .text-black-50 { color: var(--d-text-3) !important; }
html[data-theme="dark"] .text-primary { color: var(--d-blue) !important; }
html[data-theme="dark"] .text-danger { color: var(--d-red) !important; }
html[data-theme="dark"] .text-success { color: var(--d-green) !important; }
html[data-theme="dark"] .text-info { color: #4fc3dc !important; }
html[data-theme="dark"] .text-warning { color: #f5c04a !important; }
html[data-theme="dark"] .bg-white, html[data-theme="dark"] .bg-light { background-color: var(--d-surface) !important; }
html[data-theme="dark"] .border, html[data-theme="dark"] .border-top, html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-left, html[data-theme="dark"] .border-right { border-color: var(--d-line) !important; }
html[data-theme="dark"] .border-light { border-color: var(--d-line-2) !important; }
html[data-theme="dark"] .shadow, html[data-theme="dark"] .shadow-sm, html[data-theme="dark"] .shadow-lg { box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .45) !important; }

html[data-theme="dark"] .card, html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .modal-content, html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .popover, html[data-theme="dark"] .toast, html[data-theme="dark"] .jumbotron {
    background-color: var(--d-surface); color: var(--d-text); border-color: var(--d-line);
}
html[data-theme="dark"] .card-header, html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-header, html[data-theme="dark"] .modal-footer { border-color: var(--d-line); }
html[data-theme="dark"] .card-header:not([class*="bg-"]), html[data-theme="dark"] .card-footer:not([class*="bg-"]) { background-color: var(--d-raised); }
html[data-theme="dark"] .close { color: var(--d-text); text-shadow: none; }
html[data-theme="dark"] .dropdown-item { color: var(--d-text); }
html[data-theme="dark"] .dropdown-item:hover, html[data-theme="dark"] .dropdown-item:focus { background-color: var(--d-raised-2); color: #fff; }
html[data-theme="dark"] .dropdown-header { color: var(--d-text-3); }
html[data-theme="dark"] .dropdown-divider { border-color: var(--d-line); }
html[data-theme="dark"] .list-group-item-action:hover, html[data-theme="dark"] .list-group-item-action:focus { background-color: var(--d-raised); color: var(--d-text); }
html[data-theme="dark"] .modal-backdrop.show { opacity: .7; }

html[data-theme="dark"] .table { color: var(--d-text); }
html[data-theme="dark"] .table th, html[data-theme="dark"] .table td, html[data-theme="dark"] .table thead th { border-color: var(--d-line); }
html[data-theme="dark"] .table-bordered, html[data-theme="dark"] .table-bordered th, html[data-theme="dark"] .table-bordered td { border-color: var(--d-line); }
html[data-theme="dark"] .table .thead-light th, html[data-theme="dark"] .table-light,
html[data-theme="dark"] .table-light > th, html[data-theme="dark"] .table-light > td { background-color: var(--d-raised); color: var(--d-text-2); border-color: var(--d-line); }
html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, .03); }
html[data-theme="dark"] .table-hover tbody tr:hover { background-color: rgba(255, 255, 255, .05); color: var(--d-text); }
html[data-theme="dark"] .table-active, html[data-theme="dark"] .table-active > td, html[data-theme="dark"] .table-active > th { background-color: var(--d-raised-2); }
html[data-theme="dark"] .table-warning, html[data-theme="dark"] .table-warning > td, html[data-theme="dark"] .table-warning > th { background-color: #3a3112; }
html[data-theme="dark"] .table-danger, html[data-theme="dark"] .table-danger > td, html[data-theme="dark"] .table-danger > th { background-color: #3a1716; }
html[data-theme="dark"] .table-success, html[data-theme="dark"] .table-success > td, html[data-theme="dark"] .table-success > th { background-color: #0f2e21; }
html[data-theme="dark"] .table-info, html[data-theme="dark"] .table-info > td, html[data-theme="dark"] .table-info > th,
html[data-theme="dark"] .table-primary, html[data-theme="dark"] .table-primary > td { background-color: #142a45; }
html[data-theme="dark"] .table-secondary, html[data-theme="dark"] .table-secondary > td { background-color: var(--d-raised-2); }

html[data-theme="dark"] .form-control, html[data-theme="dark"] .custom-select,
html[data-theme="dark"] .input-group-text, html[data-theme="dark"] .custom-file-label,
html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="search"], html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="number"], html[data-theme="dark"] input[type="password"], html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="date"], html[data-theme="dark"] input[type="url"] {
    background-color: var(--d-raised); color: var(--d-text); border-color: var(--d-line-2);
}
html[data-theme="dark"] .form-control:focus, html[data-theme="dark"] .custom-select:focus,
html[data-theme="dark"] input:focus, html[data-theme="dark"] textarea:focus, html[data-theme="dark"] select:focus {
    background-color: var(--d-raised-2); color: #fff; border-color: var(--d-blue);
}
html[data-theme="dark"] .form-control::placeholder, html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #737e8d; }
html[data-theme="dark"] .form-control:disabled, html[data-theme="dark"] .form-control[readonly] { background-color: #14181e; color: var(--d-text-3); }
html[data-theme="dark"] .custom-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23c0c7d2' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e"); }
html[data-theme="dark"] .custom-control-label::before { background-color: var(--d-raised); border-color: var(--d-line-2); }
html[data-theme="dark"] .form-text, html[data-theme="dark"] small.text-muted { color: var(--d-text-3) !important; }
html[data-theme="dark"] legend, html[data-theme="dark"] label { color: inherit; }

html[data-theme="dark"] .btn-light { background-color: var(--d-raised-2); border-color: var(--d-line-2); color: var(--d-text); }
html[data-theme="dark"] .btn-light:hover { background-color: #303744; color: #fff; }
html[data-theme="dark"] .btn-outline-secondary { color: var(--d-text-2); border-color: var(--d-line-2); }
html[data-theme="dark"] .btn-outline-secondary:hover { background-color: var(--d-raised-2); color: #fff; }
html[data-theme="dark"] .btn-outline-dark { color: var(--d-text); border-color: var(--d-text-3); }
html[data-theme="dark"] .btn-outline-dark:hover { background-color: var(--d-text); color: var(--d-bg); }
html[data-theme="dark"] .btn-outline-primary { color: var(--d-blue); border-color: var(--d-blue); }
html[data-theme="dark"] .btn-outline-primary:hover { background-color: var(--d-blue-strong); border-color: var(--d-blue-strong); color: #fff; }
html[data-theme="dark"] .btn-link { color: var(--d-blue); }
html[data-theme="dark"] .btn-dark { background-color: var(--d-raised-2); border-color: var(--d-line-2); }

html[data-theme="dark"] .alert-info { background-color: #132a3a; border-color: #1f4560; color: #b9def2; }
html[data-theme="dark"] .alert-success { background-color: #10291c; border-color: #1d4a33; color: #b5ecce; }
html[data-theme="dark"] .alert-warning { background-color: #2f2712; border-color: #5a4a1c; color: #f3dc9b; }
html[data-theme="dark"] .alert-danger, html[data-theme="dark"] .alert-error { background-color: #33161a; border-color: #5c2229; color: #f6bcc3; }
html[data-theme="dark"] .alert-secondary, html[data-theme="dark"] .alert-light { background-color: var(--d-raised); border-color: var(--d-line); color: var(--d-text-2); }
html[data-theme="dark"] .alert-primary { background-color: var(--d-blue-tint); border-color: #24405f; color: #c5dbf3; }
html[data-theme="dark"] .alert a:not(.btn) { color: inherit; text-decoration: underline; }
html[data-theme="dark"] .badge-light { background-color: var(--d-raised-2); color: var(--d-text); }
html[data-theme="dark"] .badge-secondary { background-color: #4a5260; }

html[data-theme="dark"] .nav-tabs { border-color: var(--d-line); }
html[data-theme="dark"] .nav-tabs .nav-link:hover { border-color: var(--d-line) var(--d-line) transparent; }
html[data-theme="dark"] .nav-tabs .nav-link.active, html[data-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    background-color: var(--d-surface); color: var(--d-text); border-color: var(--d-line) var(--d-line) var(--d-surface);
}
html[data-theme="dark"] .nav-pills .nav-link:not(.active) { color: var(--d-text-2); }
html[data-theme="dark"] .page-link { background-color: var(--d-surface); border-color: var(--d-line); color: var(--d-blue); }
html[data-theme="dark"] .page-item.disabled .page-link { background-color: var(--d-surface); border-color: var(--d-line); color: var(--d-text-3); }
html[data-theme="dark"] .page-item.active .page-link { background-color: var(--d-blue-strong); border-color: var(--d-blue-strong); color: #fff; }
html[data-theme="dark"] .progress { background-color: var(--d-raised-2); }
html[data-theme="dark"] .breadcrumb { background-color: var(--d-surface); }
html[data-theme="dark"] code, html[data-theme="dark"] kbd { background: var(--d-raised); color: #f08fb0; }
html[data-theme="dark"] pre { color: var(--d-text-2); }

/* ---- The switch itself -------------------------------------------------------- */
.rr-theme { display: inline-flex; border: 1px solid rgba(128, 128, 128, .35); border-radius: 999px; padding: 2px; gap: 2px; vertical-align: middle; }
.rr-theme button {
    display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: inherit;
    font-size: .78rem; line-height: 1; padding: 6px 10px; border-radius: 999px; cursor: pointer; opacity: .75;
}
.rr-theme button:hover { opacity: 1; }
.rr-theme button[aria-pressed="true"] { background: rgba(128, 128, 128, .28); opacity: 1; font-weight: 700; }
.po-footer { text-align: center; padding: 1.5rem 1rem 2rem; color: #6c757d; }

/* ---- PO app (po_app/layout.html, status-colors.css) ---------------------------------- */
html[data-theme="dark"] .po-bar { background: #0b0d11; border-bottom: 1px solid var(--d-line); }
html[data-theme="dark"] .po-tabs { background: var(--d-surface); border-color: var(--d-line); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .po-tab { color: var(--d-text-2); }
html[data-theme="dark"] .po-tab:hover { background: var(--d-raised); color: #fff; }
html[data-theme="dark"] .po-tab.active { background: var(--d-blue-tint); color: #8ec0f5; border-bottom-color: var(--d-blue); }
html[data-theme="dark"] .po-tab__hint { color: var(--d-text-3); }
html[data-theme="dark"] .route-head td { background: #0b0d11; }
html[data-theme="dark"] .po-billing-note { background: #2f2712; border-left-color: #c99a00; color: #f3dc9b; }
html[data-theme="dark"] .st-key { color: var(--d-text-3); }
html[data-theme="dark"] .btn-view { background-color: transparent !important; border-color: var(--d-blue) !important; color: #8ec0f5 !important; }
html[data-theme="dark"] .btn-view:hover, html[data-theme="dark"] .btn-view:focus { background-color: var(--d-blue-strong) !important; color: #fff !important; }
html[data-theme="dark"] .badge-urg-extreme { background: #f2f4f7; color: #101828; }
html[data-theme="dark"] .badge-urg-urgent { background: transparent; color: var(--d-text); border-color: var(--d-text); }
html[data-theme="dark"] .badge-urg-soon { background: transparent; color: var(--d-text-2); border-color: #8d97a6; }
html[data-theme="dark"] .badge-urg-normal { color: var(--d-text-3); border-color: var(--d-line-2); }
html[data-theme="dark"] .badge-urg-no-route { color: #6f7a89; border-color: var(--d-line-2); }
html[data-theme="dark"] .st-text-counted { color: #5ea2ff !important; }
html[data-theme="dark"] .st-text-loaded { color: #a3acb9 !important; }
html[data-theme="dark"] .po-footer { color: var(--d-text-3); }

/* ---- PO app pages with their own colours ------------------------------------------- */
/* Hammering, one blade set (hammer_tablet.html) */
html[data-theme="dark"] .ht-head, html[data-theme="dark"] .ht-manual { background: var(--d-surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .ht-fact { background: var(--d-raised); }
html[data-theme="dark"] .ht-fact__label, html[data-theme="dark"] .ht-subtitle { color: var(--d-text-3); }
html[data-theme="dark"] .ht-fact--due .ht-fact__value { color: #8ec0f5; }
html[data-theme="dark"] .ht-fact--soon .ht-fact__value { color: var(--d-red); }
html[data-theme="dark"] .ht-done { color: var(--d-green); }
html[data-theme="dark"] .ht-delete { border-color: var(--d-line); }
/* Companies (view_companies.html) */
html[data-theme="dark"] .co-chips a { background: var(--d-raised); border-color: var(--d-line-2); color: var(--d-text-2); }
html[data-theme="dark"] .co-chips a:hover { border-color: var(--d-blue); color: #8ec0f5; }
html[data-theme="dark"] .co-chips a.is-active { background: var(--d-blue-strong); border-color: var(--d-blue-strong); color: #fff; }
html[data-theme="dark"] .co-table th, html[data-theme="dark"] table th[class*="co-"] { background: var(--d-raised); color: var(--d-text-3); }
html[data-theme="dark"] .co-name { color: var(--d-text); }
html[data-theme="dark"] .co-name:hover { color: #8ec0f5; }
html[data-theme="dark"] .co-sub, html[data-theme="dark"] .co-meta, html[data-theme="dark"] .co-due small, html[data-theme="dark"] .co-empty { color: var(--d-text-3); }
html[data-theme="dark"] .co-pill--warn { background: #3a2a12; color: #f6b65a; }
html[data-theme="dark"] .co-pill--ok { background: #12301f; color: #6fd99b; }
html[data-theme="dark"] .co-pill--info { background: var(--d-blue-tint); color: #8ec0f5; }
html[data-theme="dark"] .co-pill--idle { background: var(--d-raised-2); color: var(--d-text-3); }
html[data-theme="dark"] .co-due--soon { color: var(--d-red); }
/* Deliveries (delivery_tracking.html) */
html[data-theme="dark"] .dl-sum span, html[data-theme="dark"] .dl-route, html[data-theme="dark"] .dl-stop { border-color: var(--d-line); }
html[data-theme="dark"] .dl-route .dl-count { background: rgba(255, 255, 255, .1); }
html[data-theme="dark"] .dl-stop-head, html[data-theme="dark"] .dl-blade { border-color: var(--d-line); }
html[data-theme="dark"] .dl-blade.dl-on { background: rgba(62, 207, 142, .1); }
html[data-theme="dark"] .dl-bar { background: #0b0d11; border-top: 1px solid var(--d-line); }
/* QuickBooks list and company page */
html[data-theme="dark"] .qb-row:hover { background: var(--d-raised); }
html[data-theme="dark"] .qb-list-note { background: #2f2712; color: #f3dc9b; }
html[data-theme="dark"] .qb-heading--enter td { background: #3a2a12; color: #f6b65a; }
html[data-theme="dark"] .qb-heading--send td { background: var(--d-blue-tint); color: #8ec0f5; }
html[data-theme="dark"] .qb-heading--sent td { background: #12301f; color: #6fd99b; }
html[data-theme="dark"] .qb-age--warn { color: #f6b65a; }
html[data-theme="dark"] .qb-age--late { color: var(--d-red); }
html[data-theme="dark"] .qb-who, html[data-theme="dark"] .qb-copyline .qb-k { color: var(--d-text-3); }
html[data-theme="dark"] .qb-link, html[data-theme="dark"] .qb-copyline { border-color: var(--d-line); }
html[data-theme="dark"] .qb-link--missing, html[data-theme="dark"] .qb-line.qb-missing { background: #33161a; }
html[data-theme="dark"] .qb-group td { background: var(--d-raised); }
html[data-theme="dark"] .qb-group.qb-entered td { background: #12301f; }
html[data-theme="dark"] .qb-top-line td { background: var(--d-blue-tint); }
/* Add blades form (products/_po_form_body.html) */
html[data-theme="dark"] .po-advanced-toggle, html[data-theme="dark"] .advanced-summary-arrow { color: var(--d-text-3); }
/* Route order (route_order.html) */
html[data-theme="dark"] .ro-tab { background: var(--d-raised); border-color: var(--d-line-2); color: var(--d-text-2); }
html[data-theme="dark"] .ro-tab:hover { border-color: var(--d-blue); color: #8ec0f5; }
html[data-theme="dark"] .ro-tab.is-active { background: var(--d-blue-strong); border-color: var(--d-blue-strong); color: #fff; }
html[data-theme="dark"] .ro-card { background: var(--d-surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .ro-hint, html[data-theme="dark"] .ro-desc, html[data-theme="dark"] .ro-upcoming li strong { color: var(--d-text-3); }
html[data-theme="dark"] .ro-badge--due { background: #3a2a12; color: #f6b65a; }
html[data-theme="dark"] .ro-badge--overdue { background: #3a1716; color: #ff8a7a; }
html[data-theme="dark"] .ro-badge--later { background: var(--d-raised-2); color: var(--d-text-3); }
html[data-theme="dark"] .ro-next { color: #8ec0f5; }
html[data-theme="dark"] .ro-upcoming li { background: var(--d-raised); }
/* Routes and loading */
html[data-theme="dark"] .route-group-label { color: var(--d-text-3); }
html[data-theme="dark"] .flex-placed { color: var(--d-green); }

/* ---- Public site ------------------------------------------------------------------ */
/* Picture frames stay light on purpose: product photos and drawings have white
   backgrounds, so a soft light mat looks intended instead of a white hole. */
html[data-theme="dark"] .rr-gallery, html[data-theme="dark"] .p-product-img-wrap,
html[data-theme="dark"] .rr-order-item img, html[data-theme="dark"] .rr-order-thumb,
html[data-theme="dark"] .rr-line img, html[data-theme="dark"] .rr-serve-item__icon-wrap,
html[data-theme="dark"] .ct-pic { background: #d6dce3 !important; }
/* Pictures on those mats: white in a photo (or a drawing) takes the mat's
   softer grey, the part itself keeps its colours, so nothing glows white. */
html[data-theme="dark"] .rr-gallery img, html[data-theme="dark"] .p-product-img-wrap img,
html[data-theme="dark"] .ct-pic img { mix-blend-mode: multiply; }
html[data-theme="dark"] .ct-pic__none { color: #8d97a6; }
html[data-theme="dark"] .ct-remove { color: #ff6b7d; }
html[data-theme="dark"] .ct-remove:hover, html[data-theme="dark"] .ct-remove:focus { background: rgba(255, 77, 99, .12); border-color: rgba(255, 77, 99, .35); }

/* Home page (home.css) */
html[data-theme="dark"] .rr-service-card, html[data-theme="dark"] .rr-roy,
html[data-theme="dark"] .rr-process-teaser, html[data-theme="dark"] .rr-match { background: var(--d-surface); }
html[data-theme="dark"] .rr-serve-item:hover { background: var(--d-raised); }
html[data-theme="dark"] .rr-section-sub-01 { color: var(--d-text-2); }
html[data-theme="dark"] .rr-search-inner { background: var(--d-surface); }

/* Shop and product pages (store.css, pages.css) */
html[data-theme="dark"] .rr-tile, html[data-theme="dark"] .rr-pcard, html[data-theme="dark"] .rr-sticky,
html[data-theme="dark"] .rr-track, html[data-theme="dark"] .p-card, html[data-theme="dark"] .p-hero,
html[data-theme="dark"] .p-table, html[data-theme="dark"] .product-card, html[data-theme="dark"] .product-card-virtual,
html[data-theme="dark"] .shop-empty, html[data-theme="dark"] .filter-bar, html[data-theme="dark"] .filter-bar-content,
html[data-theme="dark"] .p-stat-card, html[data-theme="dark"] .p-back, html[data-theme="dark"] .p-nav-card { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .rr-tile:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
html[data-theme="dark"] .rr-btn-ghost { background: transparent; }
html[data-theme="dark"] .rr-badge-grey, html[data-theme="dark"] .p-badge-grey { background: var(--d-raised-2); color: var(--d-text-2); }
html[data-theme="dark"] .rr-badge-red, html[data-theme="dark"] .p-badge-red { background: #3a1519; color: #ff8a98; }
html[data-theme="dark"] .rr-input, html[data-theme="dark"] .rr-select,
html[data-theme="dark"] .p-input, html[data-theme="dark"] .p-textarea, html[data-theme="dark"] .p-select { background: var(--d-raised); color: var(--d-text); border-color: var(--d-line-2); }
html[data-theme="dark"] .rr-keyspecs li { background: var(--d-raised); }
html[data-theme="dark"] .rr-specs > div:nth-child(odd), html[data-theme="dark"] .rr-specs > div:nth-child(4n+1),
html[data-theme="dark"] .rr-specs > div:nth-child(4n+2), html[data-theme="dark"] .rr-specs.rr-one > div:nth-child(even) { background: var(--d-raised); }
html[data-theme="dark"] .rr-table tr:hover td { background: var(--d-raised); }
html[data-theme="dark"] .page-btn, html[data-theme="dark"] .filter-toggle-btn, html[data-theme="dark"] .filter-bar-sort,
html[data-theme="dark"] .filter-chip { background: var(--d-raised); color: var(--d-text); border-color: var(--d-line-2); }
html[data-theme="dark"] .filter-toggle-btn:hover, html[data-theme="dark"] .filter-bar-sort:hover { background: var(--d-raised-2); }
html[data-theme="dark"] .filter-bar-title, html[data-theme="dark"] .filter-group-title,
html[data-theme="dark"] .filter-toggle span:last-child, html[data-theme="dark"] .btn-reset:hover { color: var(--d-text); }
html[data-theme="dark"] .p-alert-danger { background: #33161a; color: #f6bcc3; }
html[data-theme="dark"] .toggle-slider { background: var(--d-line-2); }
html[data-theme="dark"] .dropdown-submenu .dropdown-menu { background: var(--d-surface); }
html[data-theme="dark"] .color-black-style { color: var(--d-text) !important; }
/* The cart dropdown in the desktop header (style.css) */
html[data-theme="dark"] .cart-dropdown { background: var(--d-surface); border-color: var(--d-line); color: var(--d-text); }
html[data-theme="dark"] .cart-dropdown .cart-summary { border-color: var(--d-line); }
html[data-theme="dark"] .cart-dropdown .product-widget .product-name a { color: var(--d-text); }
html[data-theme="dark"] .input, html[data-theme="dark"] .input-select { background: var(--d-raised); color: var(--d-text); border-color: var(--d-line-2); }

/* Account pages (account.css) */
html[data-theme="dark"] .rr-acct, html[data-theme="dark"] .rr-acct label, html[data-theme="dark"] .rr-acct .col-form-label { color: var(--d-text); }
html[data-theme="dark"] .rr-card, html[data-theme="dark"] .rr-tile { background: var(--d-surface); color: var(--d-text); border-color: var(--d-line); }
html[data-theme="dark"] .rr-help { background: var(--d-raised); color: var(--d-text-2); }
html[data-theme="dark"] .rr-errors, html[data-theme="dark"] .rr-notice--no { background: #33161a; color: #f6bcc3; }
html[data-theme="dark"] .rr-notice { background: var(--d-blue-tint); color: #c5dbf3; }
html[data-theme="dark"] .rr-notice--wait { background: #2f2712; color: #f3dc9b; }
html[data-theme="dark"] .rr-notice--ok { background: #12301f; color: #b5ecce; }
html[data-theme="dark"] .rr-btn--ghost { background: transparent; color: #8ec0f5; border-color: var(--d-blue); }
html[data-theme="dark"] .rr-btn--ghost:hover, html[data-theme="dark"] .rr-btn--ghost:focus { background: var(--d-blue-tint); }
html[data-theme="dark"] .rr-btn--danger { background: transparent; color: var(--d-red); border-color: var(--d-red); }
html[data-theme="dark"] .rr-btn--danger:hover, html[data-theme="dark"] .rr-btn--danger:focus { background: #33161a; }
html[data-theme="dark"] .rr-status { background: var(--d-raised); color: var(--d-text-2); }
html[data-theme="dark"] .rr-status--ready { background: #12301f; color: #6fd99b; }
html[data-theme="dark"] .rr-status--out { background: var(--d-blue-tint); color: #8ec0f5; }
html[data-theme="dark"] .rr-status--wait { background: #2f2712; color: #f3dc9b; }
html[data-theme="dark"] .rr-status--no { background: #33161a; color: #ff8a98; }
html[data-theme="dark"] .rr-badge-icon--red { background: #3a1519; }
html[data-theme="dark"] .rr-steps__bar { background: var(--d-raised-2); }

/* Legal pages (legal.css) */
html[data-theme="dark"] .lg, html[data-theme="dark"] .lg-doc, html[data-theme="dark"] .lg-nav,
html[data-theme="dark"] .lg-card { background: var(--d-surface); color: var(--d-text); border-color: var(--d-line); }
html[data-theme="dark"] .lg-note, html[data-theme="dark"] .lg-short { background: var(--d-raised); color: var(--d-text-2); }

/* ---- Staff pages with their own colours ------------------------------------------- */
/* Shipping dashboard (staff/shipping_dashboard.html) */
html[data-theme="dark"] .sd { color: var(--d-text); }
html[data-theme="dark"] .sd-head { border-color: var(--d-blue); }
html[data-theme="dark"] .sd-head h1, html[data-theme="dark"] .sd-section h2 { color: #8ec0f5; }
html[data-theme="dark"] .sd-tile, html[data-theme="dark"] .sd-item { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .sd-item { border-left-color: #2f4a6e; }
html[data-theme="dark"] .sd-item--late { border-left-color: #d92d20; }
html[data-theme="dark"] .sd-tile:hover { border-color: var(--d-blue); }
html[data-theme="dark"] .sd-tile--hot { background: #2a1517; border-color: #d92d20; }
html[data-theme="dark"] .sd-tile--done, html[data-theme="dark"] .sd-clear { background: #0f2419; border-color: #079455; }
html[data-theme="dark"] .sd-clear { color: #6fd99b; }
html[data-theme="dark"] .sd-tile__sub, html[data-theme="dark"] .sd-section__why, html[data-theme="dark"] .sd-item__sub,
html[data-theme="dark"] .sd-none { color: var(--d-text-3); }
html[data-theme="dark"] .sd-badge--late { background: #3a1716; color: #ff8a7a; }
html[data-theme="dark"] .sd-badge--together { background: var(--d-blue-tint); color: #8ec0f5; }
html[data-theme="dark"] .sd h3 { color: var(--d-text); }
/* Developer pages (main/dev_*.html) */
html[data-theme="dark"] .dv-card, html[data-theme="dark"] .dv-tile { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .dv-tile--warn { border-color: #d92d20; }
html[data-theme="dark"] .dv-tile--live { border-color: #079455; }
html[data-theme="dark"] .dv-tile__num { color: var(--d-text); }
html[data-theme="dark"] .dv-tile__label, html[data-theme="dark"] .dv-tile__sub, html[data-theme="dark"] .dv-legend { color: var(--d-text-3); }
html[data-theme="dark"] .dv-section { color: #8ec0f5; border-color: var(--d-blue); }
html[data-theme="dark"] .dv-meter { background: var(--d-raised-2); }
html[data-theme="dark"] .dv-list li { border-color: var(--d-line); }
html[data-theme="dark"] .dv-a, html[data-theme="dark"] .dv-dot--a { fill: #2b4a74; background: #2b4a74; }
html[data-theme="dark"] .dv-b, html[data-theme="dark"] .dv-dot--b { fill: var(--d-blue); background: var(--d-blue); }
html[data-theme="dark"] .dv-axis { stroke: var(--d-line); }
html[data-theme="dark"] .dv-lbl { fill: var(--d-text-3); }
html[data-theme="dark"] .dv-who--in { background: #12301f; color: #6fd99b; }
html[data-theme="dark"] .dv-who--out { background: var(--d-raised-2); color: var(--d-text-2); }
html[data-theme="dark"] .dv-setting:hover { border-color: var(--d-blue); }
/* Site features (main/site_features.html) */
html[data-theme="dark"] .rr-banner-now { background: #2f2712; border-color: #8a6d0b; color: #f3dc9b; }
html[data-theme="dark"] .rr-toggle__track { background: #3a4250; }
html[data-theme="dark"] .rr-toggle__thumb { background: #e6e9ee; }
/* QuickBooks prefixes, roles, route order */
html[data-theme="dark"] .px-row.px-done { background: #0f2419; }
html[data-theme="dark"] .px-row.px-skip { background: var(--d-raised); color: var(--d-text-3); }
html[data-theme="dark"] .px-ex, html[data-theme="dark"] .px-ex code { color: var(--d-text-3); }
html[data-theme="dark"] .rl-roles label { border-color: var(--d-line-2); }
html[data-theme="dark"] .rl-roles label.rl-on { background: var(--d-blue-tint); border-color: var(--d-blue); }
html[data-theme="dark"] .rl-status { color: var(--d-text-3); }
html[data-theme="dark"] .ro-rem { color: var(--d-text-2); border-color: var(--d-line); }
html[data-theme="dark"] #route-order-list .is-hidden-stop strong { color: var(--d-text-3); }
html[data-theme="dark"] .rr-badge-icon { background: var(--d-raised-2); }

/* ---- Smaller pages ----------------------------------------------------------------- */
html[data-theme="dark"] .rr-process-tab:not(.rr-process-tab--active), html[data-theme="dark"] .rr-process-intro,
html[data-theme="dark"] .rr-process-step__content { background: var(--d-surface); }
html[data-theme="dark"] .rating-label, html[data-theme="dark"] .stat-item h5 { color: var(--d-text); }   /* survey */
html[data-theme="dark"] .product-price-chip { border-color: #5c2229; color: #ff8a98; }
html[data-theme="dark"] .dsar-1 { background: var(--d-surface); }
html[data-theme="dark"] .lg h3, html[data-theme="dark"] .lg-doc h3 { color: #8ec0f5; }
html[data-theme="dark"] .tx { color: var(--d-text); }
html[data-theme="dark"] .tx h1, html[data-theme="dark"] .tx h2 { color: #8ec0f5; }
html[data-theme="dark"] .tx-card { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .tx-sub { color: var(--d-text-3); }
html[data-theme="dark"] .p-badge-green { background: #12301f; color: #6fd99b; }
html[data-theme="dark"] .po-card { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .po-card h5, html[data-theme="dark"] .advanced-hint { color: var(--d-text-3); }
html[data-theme="dark"] .unit-suffix { background: var(--d-raised-2); border-color: var(--d-line-2); color: var(--d-text-2); }
html[data-theme="dark"] .btn-reset { color: var(--d-text-2); }
html[data-theme="dark"] .cl-bar { background: var(--d-bg); border-color: var(--d-line); }
/* Custom-size order form (cart/edit_product.html) */
html[data-theme="dark"] .custom-order-bg { background-color: var(--d-surface); }
html[data-theme="dark"] .spec-group-label { color: var(--d-text-3); }
html[data-theme="dark"] .spec-divider { border-color: var(--d-line); }
/* Bootstrap's bright blue headers: the brand navy, lifted */
html[data-theme="dark"] .bg-primary { background-color: var(--d-blue-strong) !important; }
/* One order's product page (cart/view_product.html) */
html[data-theme="dark"] .pv-title { color: #8ec0f5; }
html[data-theme="dark"] .pv-tag { background: var(--d-blue-tint); border-color: #24405f; }
html[data-theme="dark"] .pv-tag--rush { background: #3a1716; border-color: #7a2a22; color: #ff8a7a; }
html[data-theme="dark"] .pv-card { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .pv-img { border-color: var(--d-line); }
html[data-theme="dark"] .pv-row { border-color: var(--d-line); }
html[data-theme="dark"] .pv-empty { color: var(--d-text-3); }

/* ---- The rest of the pages with their own colours ---------------------------------- */
/* Refund review (cart/review_refund_request.html) */
html[data-theme="dark"] .rf { color: var(--d-text); }
html[data-theme="dark"] .rf h1, html[data-theme="dark"] .rf-card h2 { color: #8ec0f5; }
html[data-theme="dark"] .rf-card { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .rf-row, html[data-theme="dark"] .rf-row dt, html[data-theme="dark"] .rf-row dd { border-color: var(--d-line); }
html[data-theme="dark"] .rf-row dt { color: var(--d-text-3); }
html[data-theme="dark"] .rf-status--Pending { background: #2f2712; color: #f3dc9b; }
html[data-theme="dark"] .rf-status--Approved, html[data-theme="dark"] .rf-status--Refunded { background: #12301f; color: #6fd99b; }
html[data-theme="dark"] .rf-status--Denied { background: #3a1716; color: #ff8a7a; }
html[data-theme="dark"] .rf img { border-color: var(--d-line); }
/* Asking for a refund (cart/request_refund.html) */
html[data-theme="dark"] .modern-refund-header h2, html[data-theme="dark"] .modern-process-card h4 { color: var(--d-text); }
html[data-theme="dark"] .modern-process-card, html[data-theme="dark"] .modern-form-container { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .modern-process-card p { color: var(--d-text-3); }
html[data-theme="dark"] .modern-step-list li { background: var(--d-raised); }
html[data-theme="dark"] .modern-step-list li:hover { background: var(--d-raised-2); }
html[data-theme="dark"] .custom-file-input:hover { background: var(--d-raised); }
/* Cart on a phone (cart/cart.html) */
html[data-theme="dark"] .mobile-cart .cart-item { background: var(--d-surface); border-color: var(--d-line); }
html[data-theme="dark"] .mobile-cart .cart-info p { color: var(--d-text-3); }
html[data-theme="dark"] .mobile-cart .subtotal-box h2 { color: var(--d-text); }
/* Reviews and the survey (cart/write_review.html, users/survey.html) */
html[data-theme="dark"] .survey-container { color: var(--d-text); }
html[data-theme="dark"] .survey-header p { color: var(--d-text-3); }
html[data-theme="dark"] .survey-form { background: var(--d-surface); }
html[data-theme="dark"] .comments-section textarea { background: var(--d-raised); color: var(--d-text); }
/* The PO app shortcut on the site and the message banner */
html[data-theme="dark"] #po-shortcut { background: var(--d-surface); border-color: var(--d-line); color: var(--d-text); }
html[data-theme="dark"] #po-shortcut .po-sc-title { color: #8ec0f5; }
html[data-theme="dark"] #po-shortcut .po-sc-link:hover, html[data-theme="dark"] #po-shortcut .po-sc-x:hover { color: #fff; }
html[data-theme="dark"] .rr-site-banner { background: #2f2712; color: #f3dc9b; border-color: #6b5520; }
/* Old product list (main/products_main.html) */
html[data-theme="dark"] .container-fluid-background-style { background: var(--d-bg); }
html[data-theme="dark"] .product-title { color: var(--d-text); }
html[data-theme="dark"] .spec-label { color: var(--d-text-3); }
html[data-theme="dark"] .pagination-btn-outline { color: #8ec0f5; border-color: var(--d-blue); }
/* Route map, company picker, custom receipt, add blades, code clean-up */
html[data-theme="dark"] .mobile-calendar-btn:hover, html[data-theme="dark"] .mobile-calendar-btn:focus-visible { background: var(--d-raised); }
html[data-theme="dark"] .co-search__chosen, html[data-theme="dark"] .cr-table tr.cr-on { background: #12301f; }
html[data-theme="dark"] .po-field label { color: var(--d-text-2); }
html[data-theme="dark"] .po-create-header a.text-muted:hover { color: #fff !important; }
html[data-theme="dark"] .cl-group-head { background: var(--d-raised); }
html[data-theme="dark"] .dv-livenum--mem { color: #5ea2ff; }
/* Checkout (checkout.css): its dark panel headers stay dark, and the card fields
   (Braintree's own frames, a light page inside) are see-through instead of white. */
html[data-theme="dark"] .panel__header { background: #0b0d11; color: var(--d-text); border-color: var(--d-line); }
html[data-theme="dark"] .panel__header--warning { background: #2f2712; color: #f3dc9b; }
html[data-theme="dark"] .card-field-input iframe { color-scheme: light; }
html[data-theme="dark"] .card-field-input--braintree-focused { box-shadow: 0 0 0 3px rgba(209, 0, 36, .35); }
html[data-theme="dark"] .checkout-page__trust li { background: var(--d-surface); border-color: var(--d-line); color: var(--d-text-2); }
html[data-theme="dark"] .checkout-page__trust i { color: var(--d-green); }
html[data-theme="dark"] .modal-header:not([class*="bg-"]) { background: #0b0d11; color: var(--d-text); }
html[data-theme="dark"] .modal-header:not([class*="bg-"]) .close { color: var(--d-text); }
html[data-theme="dark"] .policy-box { border-color: #6b5520; color: var(--d-text-2); }
html[data-theme="dark"] .policy-box a { color: #ff8a98; }
/* Product pictures in listings and tiles: same soft mat and blend */
html[data-theme="dark"] .product-image-wrap, html[data-theme="dark"] .rr-tile-pic,
html[data-theme="dark"] .bundle-image-card { background: #d6dce3 !important; }
html[data-theme="dark"] .product-image-wrap img, html[data-theme="dark"] .rr-tile-pic img,
html[data-theme="dark"] .bundle-image-card img { mix-blend-mode: multiply; }
html[data-theme="dark"] .product-no-image { color: #5b6878; }
html[data-theme="dark"] img.rr-tile-pic { mix-blend-mode: multiply; border-radius: 8px; }
html[data-theme="dark"] .ct-tag { color: #6fd99b; }
html[data-theme="dark"] .ct-sum__secure-main i { color: var(--d-green); }
html[data-theme="dark"] .cart-dropdown.rr-cd { box-shadow: 0 14px 40px rgba(0, 0, 0, .6); }
html[data-theme="dark"] .rr-cd__pic { background: #d6dce3; }
html[data-theme="dark"] .rr-cd__pic img { mix-blend-mode: multiply; }
html[data-theme="dark"] .rr-cd__tag { color: #6fd99b; }
html[data-theme="dark"] .rr-cd__remove button { color: #ff6b7d; }
