/* =====================================================================
   LD Workflows — Dark colour theme
   ---------------------------------------------------------------------
   Loaded after ld-design-system.css on every page of the Bootstrap 3 base
   (collection/includes/css.html). Every rule is scoped to
   html[data-theme="dark"], which collection/base_template.html writes from
   ClientUser.color_theme (Profile Settings, or the switch in the user menu),
   so the file does nothing on light pages. That includes signed-out pages,
   emails, PDFs and the public customer pages, which have no data-theme.

   How it works: section 1 gives the design-system tokens their dark
   values, so everything built on the tokens follows by itself. The other
   sections cover what is still hard-coded: Bootstrap 3, the header, and
   the widgets (jQuery UI, select2, datepickers, calendar, charts).
   A page's own <style> block with hard-coded colours wins over this file.
   Fix those page by page by moving them onto the tokens.

   Contrast (WCAG AA is 4.5:1 for text), on a card (--ld-card #152730):
   text 12.8:1, muted 6.8:1, brand teal 5.8:1, danger text 5.8:1.

   Mirror any change to BOTH copies:
     - staticfiles/styles/ld-theme-dark.css   (source / dev)
     - static/styles/ld-theme-dark.css        (collected / prod)
   and bump ?v= in collection/includes/css.html.

   Contents
     0. Light-theme helpers (the theme switch label, the white wordmark)
     1. Tokens
     2. Page, type, links
     3. Bootstrap 3 components
     4. Header: top bar, top menu, user menu
     5. Design-system parts with their own colours
     6. Widgets: jQuery UI, select2, datepickers, calendar
     7. Charts (Google Charts SVG; Chart.js is set in base_template.html)
     (Print: always light — sections 1-7 are inside @media screen.)
   ===================================================================== */

/* ===================== 0. LIGHT-THEME HELPERS ====================== */
/* The user-menu switch shows the theme you would switch to. */
html:not([data-theme="dark"]) .ld-theme-to-light,
html[data-theme="dark"] .ld-theme-to-dark { display: none; }
/* Top bar wordmark: the black one is for light, the white one for dark. */
.ld-topbar-brand .ld-brand-on-dark { display: none; }


/* Sections 1-7 are for screens only, so printing always uses the light
   theme (light text on white paper would not show). */
@media screen {

/* ============================= 1. TOKENS ============================ */
html[data-theme="dark"] {
    color-scheme: dark;   /* native controls, scrollbars, date pickers */

    --ld-page:          #0f1d24;   /* page background */
    --ld-card:          #152730;   /* cards, panels, tables, inputs */
    --ld-raised:        #1c323c;   /* menus, dialogs, popovers */
    --ld-hover:         #24404b;   /* hover and selected rows in menus */
    --ld-input:         #10222a;   /* form fields: a step darker than the card */
    --ld-bg-soft:       #1a2e37;   /* soft fills: striped rows, action bars */
    --ld-surface:       #12232b;
    --ld-border:        #2b434e;

    --ld-text:          #e4ebee;   /* 12.8:1 on a card */
    --ld-text-muted:    #9db0b8;   /* 6.8:1 */
    --ld-text-secondary:#a9bac1;
    --ld-heading:       #eaf2f4;
    --ld-heading-accent:#7fd1cb;   /* teal titles (.ld-list-title) */
    --ld-on-primary:    #0f1d24;   /* text on the brand teal: 6.5:1 (white is 2.6:1) */

    --ld-primary-soft:  #23404a;   /* table row hover */
    --ld-primary-active:#7fd1cb;   /* link hover */
    --ld-hard:          #24505e;   /* navy fills: .btn-primary, table headers */
    --ld-hard-dark:     #1d4350;

    --ld-danger-text:   #f07c7a;   /* 5.8:1 */
    --ld-success-text:  #6fcf9f;
    --ld-chart-mark:    #59ADA8;
    --ld-chart-mark-hover: #7fd1cb;
    --ld-chart-track:   #1f3a42;

    --ld-shadow-sm:     0 1px 3px rgba(0, 0, 0, .5);
    --ld-shadow:        0 2px 10px rgba(0, 0, 0, .35);

    /* Side menu: a step darker than the page. */
    --ld-sidenav-bg:    #0b171d;
    --ld-sidenav-line:  rgba(255, 255, 255, .07);
}


/* ========================= 2. PAGE, TYPE, LINKS ===================== */
html[data-theme="dark"] body {
    background-color: var(--ld-page);
    color: var(--ld-text);
}
html[data-theme="dark"] hr { border-top-color: var(--ld-border); }
html[data-theme="dark"] small,
html[data-theme="dark"] .small,
html[data-theme="dark"] .help-block,
html[data-theme="dark"] .muted { color: var(--ld-text-muted); }
html[data-theme="dark"] legend {
    color: var(--ld-heading);
    border-bottom-color: var(--ld-border);
}
html[data-theme="dark"] blockquote { border-left-color: var(--ld-border); }
html[data-theme="dark"] code { background-color: #3a2430; color: #f3b3c0; }
html[data-theme="dark"] pre {
    background-color: var(--ld-raised);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .text-danger,
html[data-theme="dark"] .text-error { color: var(--ld-danger-text); }
html[data-theme="dark"] .text-success { color: var(--ld-success-text); }
html[data-theme="dark"] .text-warning { color: #f5c97a; }
html[data-theme="dark"] .text-info { color: #8fd3ea; }
html[data-theme="dark"] .text-primary { color: var(--ld-primary); }
html[data-theme="dark"] mark,
html[data-theme="dark"] .mark { background-color: #5c4b14; color: var(--ld-text); }
html[data-theme="dark"] .bg-success { background-color: rgba(101, 187, 153, .15); }
html[data-theme="dark"] .bg-info    { background-color: rgba(91, 192, 222, .15); }
html[data-theme="dark"] .bg-warning { background-color: rgba(246, 168, 33, .15); }
html[data-theme="dark"] .bg-danger  { background-color: rgba(225, 90, 88, .15); }


/* ===================== 3. BOOTSTRAP 3 COMPONENTS =================== */
/* --- Panels, wells ---------------------------------------------------- */
html[data-theme="dark"] .panel {
    background-color: var(--ld-card);
    border-color: var(--ld-border);
}
html[data-theme="dark"] .panel-default { border-color: var(--ld-border); }
html[data-theme="dark"] .panel-default > .panel-heading,
html[data-theme="dark"] .panel-footer {
    background-color: var(--ld-bg-soft);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .panel-danger { border-color: #6b3436; }
html[data-theme="dark"] .panel-danger > .panel-heading {
    background-color: rgba(225, 90, 88, .16);
    border-color: #6b3436;
    color: #f3a4a3;
}
html[data-theme="dark"] .panel-success > .panel-heading { background-color: rgba(101, 187, 153, .16); color: #9fdcbf; }
html[data-theme="dark"] .panel-info > .panel-heading    { background-color: rgba(91, 192, 222, .16);  color: #9fd8ec; }
html[data-theme="dark"] .panel-warning > .panel-heading { background-color: rgba(246, 168, 33, .16);  color: #f5c97a; }
html[data-theme="dark"] .panel-group .panel-heading + .panel-collapse > .panel-body,
html[data-theme="dark"] .panel > .table + .panel-body,
html[data-theme="dark"] .panel > .panel-body + .table { border-top-color: var(--ld-border); }
html[data-theme="dark"] .well {
    background-color: var(--ld-bg-soft);
    border-color: var(--ld-border);
    box-shadow: none;
}
html[data-theme="dark"] .thumbnail {
    background-color: var(--ld-card);
    border-color: var(--ld-border);
}
html[data-theme="dark"] .jumbotron { background-color: var(--ld-bg-soft); }

/* --- Tables ------------------------------------------------------------ */
html[data-theme="dark"] .table > thead > tr > th,
html[data-theme="dark"] .table > thead > tr > td,
html[data-theme="dark"] .table > tbody > tr > th,
html[data-theme="dark"] .table > tbody > tr > td,
html[data-theme="dark"] .table > tfoot > tr > th,
html[data-theme="dark"] .table > tfoot > tr > td,
html[data-theme="dark"] .table > tbody + tbody,
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered > thead > tr > th,
html[data-theme="dark"] .table-bordered > tbody > tr > td,
html[data-theme="dark"] .table-bordered > tfoot > tr > td { border-color: var(--ld-border); }
html[data-theme="dark"] .table > tbody > tr.active > td,    html[data-theme="dark"] .table > tbody > tr > td.active    { background-color: var(--ld-hover); }
html[data-theme="dark"] .table > tbody > tr.success > td,   html[data-theme="dark"] .table > tbody > tr > td.success   { background-color: rgba(101, 187, 153, .14); }
html[data-theme="dark"] .table > tbody > tr.info > td,      html[data-theme="dark"] .table > tbody > tr > td.info      { background-color: rgba(91, 192, 222, .14); }
html[data-theme="dark"] .table > tbody > tr.warning > td,   html[data-theme="dark"] .table > tbody > tr > td.warning   { background-color: rgba(246, 168, 33, .14); }
html[data-theme="dark"] .table > tbody > tr.danger > td,    html[data-theme="dark"] .table > tbody > tr > td.danger,
html[data-theme="dark"] .table > tbody > tr.error > td      { background-color: rgba(225, 90, 88, .14); }

/* --- Forms ------------------------------------------------------------- */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"],
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="search"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] .input-block-level,
html[data-theme="dark"] .Input_widthsamll,
html[data-theme="dark"] .Select_widthsamll {
    background-color: var(--ld-input);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #7d9199; }
html[data-theme="dark"] .form-control[disabled],
html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] fieldset[disabled] .form-control,
html[data-theme="dark"] input[disabled],
html[data-theme="dark"] select[disabled],
html[data-theme="dark"] textarea[disabled] {
    background-color: var(--ld-bg-soft);
    color: var(--ld-text-muted);
}
html[data-theme="dark"] option,
html[data-theme="dark"] optgroup { background-color: var(--ld-raised); color: var(--ld-text); }
html[data-theme="dark"] .input-group-addon {
    background-color: var(--ld-raised);
    border-color: var(--ld-border);
    color: var(--ld-text-muted);
}
html[data-theme="dark"] .form-actions {
    background-color: var(--ld-bg-soft);
    border-top-color: var(--ld-border);
}
html[data-theme="dark"] .has-error .help-block,
html[data-theme="dark"] .has-error .control-label { color: var(--ld-danger-text); }

/* --- Buttons ------------------------------------------------------------ */
html[data-theme="dark"] .btn-default,
html[data-theme="dark"] .btn-white {
    background-color: var(--ld-raised);
    border-color: #36525e;
    color: var(--ld-text);
}
html[data-theme="dark"] .btn-default:hover,
html[data-theme="dark"] .btn-default:focus,
html[data-theme="dark"] .btn-default:active,
html[data-theme="dark"] .btn-default.active,
html[data-theme="dark"] .open > .dropdown-toggle.btn-default,
html[data-theme="dark"] .btn-white:hover,
html[data-theme="dark"] .btn-white:focus {
    background-color: var(--ld-hover);
    border-color: #44646f;
    color: #fff;
}
html[data-theme="dark"] .btn-default[disabled],
html[data-theme="dark"] .btn-default.disabled { background-color: var(--ld-bg-soft); color: var(--ld-text-muted); }
html[data-theme="dark"] .btn-link { color: var(--ld-primary); }

/* --- Dropdowns ---------------------------------------------------------- */
html[data-theme="dark"] .dropdown-menu {
    background-color: var(--ld-raised);
    border-color: var(--ld-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
html[data-theme="dark"] .dropdown-menu > li > a,
html[data-theme="dark"] .dropdown-menu > li > button { color: var(--ld-text); }
html[data-theme="dark"] .dropdown-menu > li > a:hover,
html[data-theme="dark"] .dropdown-menu > li > a:focus,
html[data-theme="dark"] .dropdown-menu > li > button:hover,
html[data-theme="dark"] .dropdown-menu > li > button:focus {
    background-color: var(--ld-hover);
    color: #fff;
}
html[data-theme="dark"] .dropdown-menu .divider { background-color: var(--ld-border); }
html[data-theme="dark"] .dropdown-header { color: var(--ld-text-muted); }

/* --- Dialogs, popovers -------------------------------------------------- */
html[data-theme="dark"] .modal-content {
    background-color: var(--ld-raised);
    border-color: var(--ld-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer { border-color: var(--ld-border); }
html[data-theme="dark"] .modal-backdrop.in { opacity: .7; }
html[data-theme="dark"] .close {
    color: #fff;
    text-shadow: none;
    opacity: .6;
}
html[data-theme="dark"] .close:hover,
html[data-theme="dark"] .close:focus { color: #fff; opacity: .9; }
html[data-theme="dark"] .popover {
    background-color: var(--ld-raised);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .popover-title {
    background-color: var(--ld-bg-soft);
    border-bottom-color: var(--ld-border);
}
html[data-theme="dark"] .popover.top > .arrow:after    { border-top-color: var(--ld-raised); }
html[data-theme="dark"] .popover.bottom > .arrow:after { border-bottom-color: var(--ld-raised); }
html[data-theme="dark"] .popover.left > .arrow:after   { border-left-color: var(--ld-raised); }
html[data-theme="dark"] .popover.right > .arrow:after  { border-right-color: var(--ld-raised); }

/* --- Tabs, pills, pagination, breadcrumbs, lists ------------------------ */
html[data-theme="dark"] .nav-tabs { border-bottom-color: var(--ld-border); }
html[data-theme="dark"] .nav > li > a:hover,
html[data-theme="dark"] .nav > li > a:focus,
html[data-theme="dark"] .nav .open > a,
html[data-theme="dark"] .nav .open > a:hover,
html[data-theme="dark"] .nav .open > a:focus { background-color: var(--ld-raised); border-color: var(--ld-border); }
html[data-theme="dark"] .nav-tabs > li > a:hover { border-color: var(--ld-border) var(--ld-border) transparent; }
html[data-theme="dark"] .nav-tabs > li.active > a,
html[data-theme="dark"] .nav-tabs > li.active > a:hover,
html[data-theme="dark"] .nav-tabs > li.active > a:focus {
    background-color: var(--ld-page);
    border-color: var(--ld-border) var(--ld-border) transparent;
    color: var(--ld-text);
}
html[data-theme="dark"] .pagination > li > a,
html[data-theme="dark"] .pagination > li > span,
html[data-theme="dark"] .pager li > a,
html[data-theme="dark"] .pager li > span {
    background-color: var(--ld-card);
    border-color: var(--ld-border);
}
html[data-theme="dark"] .pagination > li > a:hover,
html[data-theme="dark"] .pagination > li > a:focus,
html[data-theme="dark"] .pager li > a:hover { background-color: var(--ld-hover); border-color: var(--ld-border); }
html[data-theme="dark"] .pagination > .disabled > span,
html[data-theme="dark"] .pagination > .disabled > a { background-color: var(--ld-card); color: var(--ld-text-muted); }
html[data-theme="dark"] .breadcrumb { background-color: var(--ld-bg-soft); }
html[data-theme="dark"] .list-group-item {
    background-color: var(--ld-card);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] a.list-group-item:hover,
html[data-theme="dark"] a.list-group-item:focus { background-color: var(--ld-hover); color: #fff; }

/* --- Alerts, labels, badges, progress ----------------------------------- */
html[data-theme="dark"] .alert-success { background-color: rgba(101, 187, 153, .14); border-color: rgba(101, 187, 153, .35); color: #9fdcbf; }
html[data-theme="dark"] .alert-info    { background-color: rgba(91, 192, 222, .14);  border-color: rgba(91, 192, 222, .35);  color: #9fd8ec; }
html[data-theme="dark"] .alert-warning { background-color: rgba(246, 168, 33, .14);  border-color: rgba(246, 168, 33, .35);  color: #f5c97a; }
html[data-theme="dark"] .alert-danger,
html[data-theme="dark"] .alert-error   { background-color: rgba(225, 90, 88, .14);   border-color: rgba(225, 90, 88, .38);   color: #f3a4a3; }
html[data-theme="dark"] .alert .alert-link,
html[data-theme="dark"] .alert-error .alert-link { color: inherit; }
html[data-theme="dark"] .alert-error hr { border-top-color: rgba(225, 90, 88, .38); }
html[data-theme="dark"] .label-default,
html[data-theme="dark"] .badge { background-color: #4a5f68; }
html[data-theme="dark"] .progress { background-color: var(--ld-raised); box-shadow: none; }


/* ================ 4. HEADER: TOP BAR, TOP MENU, USER MENU =========== */
/* The rules they override live in collection/includes/navigation.html. */
html[data-theme="dark"] .ld-topbar,
html[data-theme="dark"] body.ld-shell .navbar-fixed-top {
    background-color: #12232b;
    border-bottom: 1px solid var(--ld-border);
}
html[data-theme="dark"] .ld-topbar-brand .ld-brand-full { display: none; }
html[data-theme="dark"] .ld-topbar-brand .ld-brand-on-dark { display: block; }
@media (max-width: 767px) {
    html[data-theme="dark"] .ld-topbar-brand .ld-brand-on-dark { display: none; }   /* the round mark shows instead */
}
/* Client logos are drawn for a light background: give them one. */
html[data-theme="dark"] .ld-topbar-client-logo {
    background-color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
}
html[data-theme="dark"] .ld-topbar-client-sep { background-color: var(--ld-border); }
html[data-theme="dark"] .ld-topbar-link,
html[data-theme="dark"] .ld-topbar-menu { color: #c6d3d7 !important; }
html[data-theme="dark"] .ld-topbar-link:hover,
html[data-theme="dark"] .ld-topbar-link:focus,
html[data-theme="dark"] .ld-topbar-menu:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, .08);
}
html[data-theme="dark"] .ld-topbar-user-name { color: var(--ld-text); }
html[data-theme="dark"] .ld-topbar-user-role { color: var(--ld-text-muted); }
html[data-theme="dark"] .ld-topbar-timer > a { background: var(--ld-hover); color: #b8e6e2; }
html[data-theme="dark"] .ld-topbar-search .select2-selection,
html[data-theme="dark"] .ld-topbar-search .select2-selection--single {
    background-color: var(--ld-input) !important;
    border-color: var(--ld-border) !important;
}
html[data-theme="dark"] .ld-topbar-search .select2-selection__rendered,
html[data-theme="dark"] .ld-topbar-search-icon { color: var(--ld-text-muted) !important; }

/* Top menu (module row). The brand navy, a step darker. */
html[data-theme="dark"] .navbar-inverse { background-color: #16313b; }
/* Its module menus (not the side menu, which styles the same lists itself). */
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu { border-color: var(--ld-border); }
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu > li > a { color: #8fd8d2 !important; }
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu > li > a:hover,
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu > li > a:focus { background-color: var(--ld-hover); color: #fff !important; }
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu > li.active > a { color: #fff !important; }
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu .dropdown-header { color: var(--ld-text-muted) !important; }
html[data-theme="dark"] body:not(.ld-shell) .accounting-dropdown-menu .divider { background-color: var(--ld-border); border-top-color: var(--ld-border); }

/* User menu */
html[data-theme="dark"] .dropdownmenu_ul { border-color: var(--ld-border) !important; }
html[data-theme="dark"] .ProfilePic { background: var(--ld-hover); border-color: var(--ld-border); }
html[data-theme="dark"] .name_title { color: var(--ld-text); }
html[data-theme="dark"] .name_title2 { color: var(--ld-text-muted); }
html[data-theme="dark"] .profile_setting,
html[data-theme="dark"] .profile_setting:hover,
html[data-theme="dark"] .Help_text,
html[data-theme="dark"] .logout_text { color: #7fd1cb !important; }
html[data-theme="dark"] .pf_sLine { border-bottom-color: var(--ld-border); }
html[data-theme="dark"] .dropdownmenu_ul.dropdown-menu > li > a:hover,
html[data-theme="dark"] .dropdownmenu_ul.dropdown-menu > li > a:focus { background-color: var(--ld-hover); }


/* ===== 4b. TEAL FILLS: DARK TEXT ===== */
/* White on the brand teal is 2.1-2.6:1. With the dark theme the teal fills
   carry dark navy text instead (6.5:1): the call-to-action pills, info and
   success buttons, and the current item in the top menu. !important: pages
   and navigation.html set white with !important or long selectors. */
html[data-theme="dark"] .call-to-action,
html[data-theme="dark"] .call-to-action:hover,
html[data-theme="dark"] .call-to-action:focus,
html[data-theme="dark"] .btn-info,
html[data-theme="dark"] .btn-info:hover,
html[data-theme="dark"] .btn-info:focus,
html[data-theme="dark"] .btn-success,
html[data-theme="dark"] .btn-success:hover,
html[data-theme="dark"] .btn-success:focus,
html[data-theme="dark"] .label-success,
html[data-theme="dark"] .label-info,
html[data-theme="dark"] .label-warning,
html[data-theme="dark"] .navbar-inverse .nav > li.active > a,
html[data-theme="dark"] .navbar-inverse .nav > li.active > a:hover,
html[data-theme="dark"] .navbar-inverse .nav > li.active > a:focus,
html[data-theme="dark"] .navbar-inverse .nav li.dropdown.active > .dropdown-toggle,
html[data-theme="dark"] .navbar-inverse .nav li.dropdown.open.active > .dropdown-toggle { color: #0f1d24 !important; }

/* The peach toolbar button (e.g. "Contact Log" on a contact) keeps its fill, so
   its text stays dark too (12:1). */
html[data-theme="dark"] .ld-actions .btn.btn-ld-warning,
html[data-theme="dark"] .ld-actions .btn.btn-ld-warning:hover,
html[data-theme="dark"] .ld-actions .btn.btn-ld-warning:focus { color: #0f1d24; }

/* The active tab: routstyle.css sets #555 with !important. */
html[data-theme="dark"] .nav-tabs > li.active > a,
html[data-theme="dark"] .nav-tabs > li.active > a:hover,
html[data-theme="dark"] .nav-tabs > li.active > a:focus { color: var(--ld-text) !important; }


/* ========= 5. DESIGN-SYSTEM PARTS WITH THEIR OWN COLOURS ============ */
html[data-theme="dark"] .ld-badge         { background: #2a3f48; color: #c9d5da; }
html[data-theme="dark"] .ld-badge--success { background: rgba(101, 187, 153, .18); color: #9fdcbf; }
html[data-theme="dark"] .ld-badge--info    { background: rgba(91, 192, 222, .18);  color: #9fd8ec; }
html[data-theme="dark"] .ld-badge--warning { background: rgba(246, 168, 33, .18);  color: #f5c97a; }
html[data-theme="dark"] .ld-badge--danger  { background: rgba(225, 90, 88, .18);   color: #f3a4a3; }
html[data-theme="dark"] .ld-badge--muted   { background: #2a3f48; color: #b3c1c7; }
html[data-theme="dark"] .ld-status--warn { color: #f5c97a; }
html[data-theme="dark"] .ld-dash-table > tbody > tr > td { border-top-color: var(--ld-border); }
html[data-theme="dark"] .ld-dash-table > tbody > tr:hover > td { background: var(--ld-bg-soft); }
html[data-theme="dark"] .ld-colchart-plot { border-bottom-color: var(--ld-border); }
html[data-theme="dark"] .ld-colchart-col:focus-visible .ld-colchart-bar { box-shadow: 0 0 0 2px var(--ld-card), 0 0 0 4px var(--ld-chart-mark); }
html[data-theme="dark"] .ld-topbar-timer > a:hover { color: #fff; }
/* Bright status fills keep dark text, whatever the theme. */
html[data-theme="dark"] .ld-compliance-row.is-expired > td,
html[data-theme="dark"] .ld-compliance-row.is-due-soon > td,
html[data-theme="dark"] .ld-compliance-row.is-valid > td,
html[data-theme="dark"] .ld-compliance-row.is-unvalidated > td,
html[data-theme="dark"] .ld-compliance-stage { color: #1d2a30; }
html[data-theme="dark"] .ld-compliance-row > td a,
html[data-theme="dark"] .ld-compliance-stage a { color: #0f4f4b; }
/* v2/css/opportunity-lead.css (the opportunity lists, reports and form) sets
   light colours on .table, tr.table-footer and .text-danger (!important). */
html[data-theme="dark"] .table { color: var(--ld-text); }
html[data-theme="dark"] .table > tbody > tr.table-footer { background-color: var(--ld-bg-soft); }
html[data-theme="dark"] .text-danger { color: var(--ld-danger-text) !important; }
/* Opportunities tab strip (opportunities/tab_navigation.django.html). */
html[data-theme="dark"] .op_conty_tab { border-bottom-color: var(--ld-border); }
html[data-theme="dark"] .op_conty_tab li a { color: var(--ld-text); }


/* ============ 6. WIDGETS: JQUERY UI, SELECT2, DATEPICKERS ============ */
/* jQuery UI (date picker, autocomplete) */
html[data-theme="dark"] .ui-widget-content {
    background: var(--ld-raised);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .ui-widget-header {
    background: var(--ld-hover);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .ui-state-default,
html[data-theme="dark"] .ui-widget-content .ui-state-default,
html[data-theme="dark"] .ui-widget-header .ui-state-default {
    background: var(--ld-card);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .ui-state-hover,
html[data-theme="dark"] .ui-widget-content .ui-state-hover,
html[data-theme="dark"] .ui-state-focus,
html[data-theme="dark"] .ui-widget-content .ui-state-focus,
html[data-theme="dark"] .ui-menu .ui-menu-item a.ui-state-focus {
    background: var(--ld-hover);
    border-color: #44646f;
    color: #fff;
}
html[data-theme="dark"] .ui-state-active,
html[data-theme="dark"] .ui-widget-content .ui-state-active {
    background: var(--ld-primary);
    border-color: var(--ld-primary);
    color: #0f1d24;
}
html[data-theme="dark"] .ui-state-highlight,
html[data-theme="dark"] .ui-widget-content .ui-state-highlight {
    background: #3d5560;
    border-color: #58737d;
    color: #fff;
}
html[data-theme="dark"] .ui-datepicker .ui-datepicker-prev span,
html[data-theme="dark"] .ui-datepicker .ui-datepicker-next span { filter: invert(1); }

/* select2 (the "bootstrap" theme and the default one) */
html[data-theme="dark"] .select2-container--bootstrap .select2-selection,
html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: var(--ld-input);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .select2-container--bootstrap .select2-selection--single .select2-selection__rendered,
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--ld-text); }
html[data-theme="dark"] .select2-container .select2-selection__placeholder { color: #7d9199; }
html[data-theme="dark"] .select2-dropdown,
html[data-theme="dark"] .select2-container--bootstrap .select2-dropdown {
    background-color: var(--ld-raised);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .select2-search--dropdown .select2-search__field,
html[data-theme="dark"] .select2-container--bootstrap .select2-search--dropdown .select2-search__field {
    background-color: var(--ld-input);
    border-color: var(--ld-border);
    color: var(--ld-text);
}
html[data-theme="dark"] .select2-results__option[aria-selected="true"],
html[data-theme="dark"] .select2-container--bootstrap .select2-results__option[aria-selected="true"] { background-color: var(--ld-hover); color: var(--ld-text); }
html[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected],
html[data-theme="dark"] .select2-container--bootstrap .select2-results__option--highlighted[aria-selected] { background-color: var(--ld-primary); color: #0f1d24; }
html[data-theme="dark"] .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--ld-hover);
    border-color: #44646f;
    color: var(--ld-text);
}

/* bootstrap-datepicker */
html[data-theme="dark"] .datepicker.dropdown-menu { background-color: var(--ld-raised); color: var(--ld-text); }
html[data-theme="dark"] .datepicker-dropdown.datepicker-orient-top:after { border-top-color: var(--ld-raised); }
html[data-theme="dark"] .datepicker-dropdown.datepicker-orient-bottom:after { border-bottom-color: var(--ld-raised); }
html[data-theme="dark"] .datepicker table tr td.day:hover,
html[data-theme="dark"] .datepicker table tr td.focused,
html[data-theme="dark"] .datepicker .datepicker-switch:hover,
html[data-theme="dark"] .datepicker .prev:hover,
html[data-theme="dark"] .datepicker .next:hover,
html[data-theme="dark"] .datepicker table tr td span:hover { background: var(--ld-hover); }
html[data-theme="dark"] .datepicker table tr td.old,
html[data-theme="dark"] .datepicker table tr td.new,
html[data-theme="dark"] .datepicker table tr td.disabled { color: #627882; }
html[data-theme="dark"] .datepicker table tr td.today { background: #5c4b14; color: var(--ld-text); }

/* Calendar (fullcalendar) */
html[data-theme="dark"] .fc-unthemed th,
html[data-theme="dark"] .fc-unthemed td,
html[data-theme="dark"] .fc-unthemed thead,
html[data-theme="dark"] .fc-unthemed tbody,
html[data-theme="dark"] .fc-unthemed .fc-divider,
html[data-theme="dark"] .fc-unthemed .fc-row,
html[data-theme="dark"] .fc-unthemed .fc-popover { border-color: var(--ld-border); }
html[data-theme="dark"] .fc-unthemed .fc-today { background: rgba(246, 168, 33, .12); }
html[data-theme="dark"] .fc-unthemed .fc-popover,
html[data-theme="dark"] .fc-unthemed .fc-divider,
html[data-theme="dark"] .fc-unthemed .fc-popover .fc-header { background: var(--ld-raised); }


/* ============================ 7. CHARTS ============================= */
/* Google Charts draw an SVG with presentation attributes, which CSS can
   override: a transparent background, light text, dark grid lines. Its
   tooltips are HTML. */
html[data-theme="dark"] svg[aria-label="A chart."] rect[fill="#ffffff"] { fill: transparent; }
html[data-theme="dark"] svg[aria-label="A chart."] text[fill="#222222"],
html[data-theme="dark"] svg[aria-label="A chart."] text[fill="#444444"],
html[data-theme="dark"] svg[aria-label="A chart."] text[fill="#000000"] { fill: var(--ld-text); }
html[data-theme="dark"] svg[aria-label="A chart."] text[fill="#9e9e9e"],
html[data-theme="dark"] svg[aria-label="A chart."] text[fill="#757575"] { fill: var(--ld-text-muted); }
html[data-theme="dark"] svg[aria-label="A chart."] rect[fill="#cccccc"],
html[data-theme="dark"] svg[aria-label="A chart."] rect[fill="#ebebeb"] { fill: var(--ld-border); }
html[data-theme="dark"] svg[aria-label="A chart."] path[stroke="#ffffff"] { stroke: var(--ld-card); }
html[data-theme="dark"] .google-visualization-tooltip {
    background-color: var(--ld-raised) !important;
    border-color: var(--ld-border) !important;
    color: var(--ld-text);
}
html[data-theme="dark"] .google-chart-report { background-color: var(--ld-card); }


/* ===== JOBS AND TASKS PAGES: RED BUTTONS ===== */
/* White on Bootstrap's danger red is 4.0:1. On the Jobs and Tasks pages (every one
   has the Jobs strip wrapper, .ld-jobs-strip) the red buttons - Delete Task, the
   Cancel Job dialog's Cancel - take a deeper red so the white label reads at 5:1+. */
html[data-theme="dark"] body:has(.ld-jobs-strip) .btn-danger { background-color: #c9302c; border-color: #ac2925; }
html[data-theme="dark"] body:has(.ld-jobs-strip) .btn-danger:hover,
html[data-theme="dark"] body:has(.ld-jobs-strip) .btn-danger:focus { background-color: #ac2925; border-color: #8b211e; }

}   /* @media screen */
