/*
    eCanteen portal theme, after awesome-design/apple/DESIGN.md: one blue (#0066cc) for everything clickable,
    near-black text, white cards on a light grey page, pill buttons, hairline borders, no decorative shadows.

    Loaded LAST by MasterPageXHRMS.master and Login.aspx (Error.aspx carries the same look inline, as it must
    work on its own), so it only restyles what CoreUI
    (css/style.css), css/mobile.css and the DevExpress themes draw. No markup or behaviour depends on it:
    removing its <link> lines brings the old look back.

    DevExpress controls on these pages use eight different themes (Office365, iOS, Glass, BlackGlass, ...), so
    they are matched by class prefix ([class*="dxgvHeader"]) rather than one theme's names. Only colours, fonts,
    borders and corners are changed on them, not their widths or positioning, which their scripts measure. The
    one size set here is the height of editors on DevExpress's unstyled default, the same height pages already
    give such editors in their markup.
*/

:root {
    --ec-blue: #0066cc;
    --ec-blue-hover: #0071e3;
    --ec-focus: #0071e3;
    --ec-ink: #1d1d1f;
    --ec-muted: #6e6e73;
    --ec-page: #f5f5f7;
    --ec-pearl: #fafafc;
    --ec-hover: #e8e8ed;
    --ec-line: #e0e0e0;
    --ec-line-soft: #f0f0f0;
    --ec-hair: rgba(0, 0, 0, 0.08);
    --ec-field: rgba(0, 0, 0, 0.16);
    --ec-ok-bg: #eaf6ec;  --ec-ok: #1d6b34;
    --ec-warn-bg: #fff4e5; --ec-warn: #6b3d00;
    --ec-err-bg: #fdecea;  --ec-err: #b3261e;
    --ec-info-bg: #eef5fd; --ec-info: #0b4f9e;
    /* The colours the themes in css/ecanteen-themes.css change (Account menu > Theme); these values are the default theme */
    --ec-link: var(--ec-blue);               /* blue as text and icons; the button blue is --ec-blue */
    --ec-link-hover: var(--ec-blue-hover);
    --ec-blue-active: #0058b0;
    --ec-on-accent: #ffffff;                 /* text on a blue button */
    --ec-surface: #ffffff;                   /* boxes, lists, menus */
    --ec-card: var(--ec-surface);
    --ec-text-2: #424245;
    --ec-select: #eef5fd;                    /* a selected row, a light blue hover */
    --ec-select-strong: #dceafb;
    --ec-ring: rgba(0, 113, 227, 0.22);      /* focus ring */
    --ec-second: var(--ec-blue);             /* the second button (Export to Excel, ...) */
    --ec-second-bg: var(--ec-surface);
    --ec-bar: #000000;                       /* top bar and the menu's title */
    --ec-bar-ink: #ffffff;
    --ec-bar-hover: rgba(255, 255, 255, 0.12);
    --ec-busy: #2997ff;                      /* the loading line under the top bar */
    --ec-side: var(--ec-page);               /* side menu */
    --ec-side-active: var(--ec-surface);
    --ec-scroll: rgba(0, 0, 0, 0.28);
    --ec-pop-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
    --ec-blue-soft: #8ab8e6;                 /* the lighter blue beside --ec-blue in charts */
    --ec-blue-tint: rgba(0, 102, 204, 0.12);
    --ec-blue-rgb: 0, 102, 204;              /* --ec-blue as r, g, b, for see-through blues: rgba(var(--ec-blue-rgb), 0.3) */
    --ec-font: "SF Pro Text", -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", "Helvetica Neue", Arial,
               "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Yu Gothic UI", Meiryo,
               "Leelawadee UI", "Thonburi", "Noto Sans Thai", Tahoma, sans-serif; /* the last row for Thai */

    /* CoreUI / Bootstrap */
    --cui-primary: #0066cc;
    --cui-primary-rgb: 0, 102, 204;
    --cui-link-color: #0066cc;
    --cui-link-hover-color: #0071e3;
    --cui-body-color: #1d1d1f;
    --cui-body-bg: #f5f5f7;
    --cui-border-color: #e0e0e0;
}

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--ec-font);
    color: var(--ec-ink);
    background-color: var(--ec-page);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

a { color: var(--ec-link); }
a:hover { color: var(--ec-link-hover); }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 600; letter-spacing: -0.02em; color: var(--ec-ink); }

.text-medium-emphasis { color: var(--ec-muted) !important; }
.bg-light { background-color: var(--ec-page) !important; }

:focus-visible { outline: 2px solid var(--ec-focus); outline-offset: 2px; }

/* ---------- Side menu ---------- */

#sidebar.sidebar {
    --cui-sidebar-bg: var(--ec-side);
    --cui-sidebar-color: var(--ec-ink);
    --cui-sidebar-brand-bg: var(--ec-bar);
    --cui-sidebar-brand-color: var(--ec-bar-ink);
    --cui-sidebar-nav-title-color: var(--ec-muted);
    --cui-sidebar-nav-link-color: var(--ec-ink);
    --cui-sidebar-nav-link-icon-color: var(--ec-muted);
    --cui-sidebar-nav-link-hover-color: var(--ec-ink);
    --cui-sidebar-nav-link-hover-bg: var(--ec-hover);
    --cui-sidebar-nav-link-hover-icon-color: var(--ec-ink);
    --cui-sidebar-nav-link-active-color: var(--ec-link);
    --cui-sidebar-nav-link-active-bg: var(--ec-side-active);
    --cui-sidebar-nav-link-active-icon-color: var(--ec-link);
    background: var(--ec-side);
    color: var(--ec-ink);
    border-right: 1px solid var(--ec-hair);
    box-shadow: none;
}

#sidebar .sidebar-brand {
    flex: 0 0 52px;
    justify-content: flex-start;
    padding: 0 20px;
    /* the same flat black as the top bar it continues */
    background: var(--ec-bar);
    color: var(--ec-bar-ink);
}
#sidebar .sidebar-brand h4 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.2px; color: var(--ec-bar-ink); }

#sidebar .sidebar-nav { padding: 6px 10px 16px; }
/* The menu list scrolls by itself (SimpleBar's script was removed): a thin, quiet scrollbar instead of the system one */
#sidebar .sidebar-nav { scrollbar-width: thin; scrollbar-color: var(--ec-scroll) transparent; }
#sidebar .sidebar-nav::-webkit-scrollbar { width: 8px; }
#sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: var(--ec-scroll); border-radius: 4px; }
#sidebar .sidebar-nav::-webkit-scrollbar-track { background: transparent; }
/* section labels: sentence case, quiet, closer to their own items than to the section above */
#sidebar .sidebar-nav .nav-title {
    padding: 24px 10px 8px;
    margin-top: 0;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ec-muted);
}
#sidebar .sidebar-nav .nav-item { margin: 1px 0; }
#sidebar .sidebar-nav .nav-link {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    white-space: normal;
    line-height: 1.3;
    color: var(--ec-ink);
}
#sidebar .sidebar-nav .nav-link:hover { background: var(--ec-hover); color: var(--ec-ink); }
#sidebar .sidebar-nav .nav-link.active { background: var(--ec-side-active); color: var(--ec-link); font-weight: 500; box-shadow: 0 0 0 1px var(--ec-hair); }
#sidebar .sidebar-nav .nav-icon { flex: 0 0 34px; height: 18px; font-size: 18px; color: var(--ec-muted); text-align: left; }
#sidebar .sidebar-nav .nav-link:hover .nav-icon { color: var(--ec-ink); }
#sidebar .sidebar-nav .nav-link.active .nav-icon { color: var(--ec-link); }
.sidebar-backdrop.show { opacity: 0.32; }

/* ---------- Top bar and page title (each page's own <header>) ---------- */

.wrapper > .header {
    min-height: 0;
    padding: 0;
    margin-bottom: 24px !important;
    background: var(--ec-page);
    border-bottom: none;
    box-shadow: none;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
}

/* First row: the black bar (first-of-type: a few pages put a <style> or <script> in the header before it) */
.wrapper > .header > .container-fluid:first-of-type {
    position: relative;
    min-height: 52px;
    padding: 0 16px 0 12px;
    background: var(--ec-bar);
    color: var(--ec-bar-ink);
}
/* While something loads (js/busy-light.js), a short blue line runs along the bar's bottom edge: a plain loading
   indicator, one color, no glow. It moves inside a full-width line, so nothing spills out of the bar. */
.wrapper > .header > .container-fluid:first-of-type::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    pointer-events: none;
    background-image: linear-gradient(90deg, var(--ec-busy), var(--ec-busy));
    background-size: 30% 100%;
    background-repeat: no-repeat;
    animation: ec-topbar-light 1.6s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
/* Hidden whenever nothing is loading or working (js/busy-light.js) */
html.ec-idle .wrapper > .header > .container-fluid:first-of-type::after { display: none; }
@keyframes ec-topbar-light {
    from { background-position: -43% 0; }   /* just off the left edge */
    to { background-position: 143% 0; }     /* just off the right edge */
}
@media (prefers-reduced-motion: reduce) {
    .wrapper > .header > .container-fluid:first-of-type::after {
        animation: none;
        background-image: linear-gradient(90deg, var(--ec-busy), var(--ec-busy));
        background-size: 100% 100%;
        opacity: 0.6;
    }
}
.wrapper > .header .header-toggler {
    color: var(--ec-bar-ink);
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
}
.wrapper > .header .header-toggler:hover { background: var(--ec-bar-hover); }
.wrapper > .header .header-toggler .icon { color: var(--ec-bar-ink); }
.wrapper > .header .header-brand,
.wrapper > .header .header-brand h4 { margin: 0; color: var(--ec-bar-ink); font-size: 17px; font-weight: 600; text-decoration: none; }
.wrapper > .header .header-nav .nav-link { color: var(--ec-bar-ink); }
.wrapper > .header .avatar-md { width: 32px; height: 32px; font-size: 13px; }
/* Pending approvals bell beside the avatar, with a red count when something waits */
.wrapper > .header .ec-bell { position: relative; display: inline-flex; align-items: center; opacity: 0.9; }
.wrapper > .header .ec-bell:hover, .wrapper > .header .ec-bell:focus { opacity: 1; }
.ec-bell-badge { position: absolute; top: -7px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
                 background: #ff3b30; color: #ffffff; font: 600 11px/18px var(--ec-font); text-align: center; box-shadow: 0 0 0 2px var(--ec-bar); }
.wrapper > .header .avatar-img { width: 32px; height: 32px; background: #ffffff; border-radius: 9999px; }

.wrapper > .header .dropdown-menu {
    border: 1px solid var(--ec-hair);
    border-radius: 12px;
    padding: 6px;
    background: var(--ec-surface);
    box-shadow: var(--ec-pop-shadow);
    overflow: hidden;
}
.wrapper > .header .dropdown-header { background: transparent !important; color: var(--ec-muted); font-size: 12px; }
.wrapper > .header .dropdown-item { border-radius: 8px; padding: 9px 12px; font-size: 14px; color: var(--ec-ink); }
.wrapper > .header .dropdown-item:hover { background: var(--ec-page); }

.wrapper > .header .header-divider { display: none; }

/* Second row: breadcrumb above a large page title */
.wrapper > .header > .container-fluid:last-of-type:not(:first-of-type) { padding: 24px 24px 0; background: transparent; }
.wrapper > .header .breadcrumb {
    flex-wrap: wrap;
    align-items: baseline;
    margin: 0 !important;
    font-size: 12px;
    color: var(--ec-muted);
}
.wrapper > .header .breadcrumb-item,
.wrapper > .header .breadcrumb-item a { color: var(--ec-muted); }
.wrapper > .header .breadcrumb-item.active {
    flex: 0 0 100%;
    padding-left: 0;
    margin-top: 2px;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.374px;
    color: var(--ec-ink);
}
.wrapper > .header .breadcrumb-item.active::before { display: none; }
/* A page opened from another one: the title starts with its parent, which goes back to it */
.wrapper > .header .breadcrumb-item.active a.ec-crumb-parent { color: var(--ec-link); text-decoration: none; border-radius: 6px; }
.wrapper > .header .breadcrumb-item.active a.ec-crumb-parent:hover { color: var(--ec-link-hover); text-decoration: underline; text-underline-offset: 4px; }
.wrapper > .header .breadcrumb-item.active a.ec-crumb-parent:focus-visible { outline: 2px solid var(--ec-link); outline-offset: 2px; }
.wrapper > .header .ec-crumb-sep { margin: 0 .3em; color: var(--ec-muted); font-weight: 400; }

/* ---------- Page body ---------- */

.wrapper { background: var(--ec-page); }
.wrapper > .body { padding-left: 24px !important; padding-right: 24px !important; }
.wrapper .container-lg { max-width: 1400px; padding-left: 0; padding-right: 0; }

/* The footer used to be fixed over the page; it now ends the page instead */
.wrapper > .footer {
    position: static;
    height: auto;
    min-height: 0;
    margin: auto 0 0;
    padding: 20px 24px;
    background: transparent;
    border-top: 1px solid var(--ec-hair);
    color: var(--ec-muted);
    font-size: 12px;
}

/* ---------- Cards ---------- */

.card {
    background: var(--ec-card);
    border: 1px solid var(--ec-hair);
    border-radius: 18px;
    box-shadow: none;
    margin-bottom: 24px;
}
.card-header {
    padding: 20px 24px 4px;
    background: transparent;
    border-bottom: none;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--ec-ink);
}
.card-header:first-child { border-radius: 18px 18px 0 0; }
.card-body { padding: 20px 24px 24px; }
.card-footer { background: transparent; border-top: 1px solid var(--ec-line-soft); }

/* ---------- Alerts ---------- */

.alert { border: none; border-radius: 11px; padding: 12px 16px; font-size: 14px; line-height: 1.45; }
.alert-danger { background: var(--ec-err-bg); color: var(--ec-err); }
.alert-success { background: var(--ec-ok-bg); color: var(--ec-ok); }
.alert-warning { background: var(--ec-warn-bg); color: var(--ec-warn); }
.alert-info { background: var(--ec-info-bg); color: var(--ec-info); }
/* An empty message box shows nothing (several pages render it empty and only hide it later) */
.alert:empty { display: none; }

/* ---------- Buttons ---------- */

.btn {
    --cui-btn-padding-y: 0.55rem;
    --cui-btn-padding-x: 1.4rem;
    border-radius: 9999px;
    font-weight: 400;
    letter-spacing: -0.01em;
    box-shadow: none;
    transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
/* CoreUI rings a button once it has focus, so a mouse click left a coloured ring (green on Login); the ring is only
   for the keyboard, as everywhere else in the theme */
.btn:focus:not(:focus-visible) { box-shadow: none; }

/* The main action (Search, Login, Add New, ...) */
.btn-warning, .btn-primary, .btn-outline-success.active {
    --cui-btn-bg: var(--ec-blue);
    --cui-btn-border-color: var(--ec-blue);
    --cui-btn-color: var(--ec-on-accent);
    --cui-btn-hover-bg: var(--ec-blue-hover);
    --cui-btn-hover-border-color: var(--ec-blue-hover);
    --cui-btn-hover-color: var(--ec-on-accent);
    --cui-btn-active-bg: var(--ec-blue-active);
    --cui-btn-active-border-color: var(--ec-blue-active);
    --cui-btn-active-color: var(--ec-on-accent);
    --cui-btn-disabled-bg: var(--ec-blue);
    --cui-btn-disabled-border-color: var(--ec-blue);
    --cui-btn-disabled-color: var(--ec-on-accent);
    --cui-btn-shadow: var(--ec-ring);   /* keyboard focus ring: the theme's blue, not CoreUI's green or purple */
    background-color: var(--ec-blue);
    border-color: var(--ec-blue);
    color: var(--ec-on-accent);
}

/* The second action (Export to Excel, ...) */
.btn-success {
    --cui-btn-bg: var(--ec-second-bg);
    --cui-btn-border-color: var(--ec-second);
    --cui-btn-color: var(--ec-second);
    --cui-btn-hover-bg: var(--ec-select);
    --cui-btn-hover-border-color: var(--ec-second);
    --cui-btn-hover-color: var(--ec-second);
    --cui-btn-active-bg: var(--ec-select-strong);
    --cui-btn-active-border-color: var(--ec-second);
    --cui-btn-active-color: var(--ec-second);
    --cui-btn-shadow: var(--ec-ring);
    background-color: var(--ec-second-bg);
    border-color: var(--ec-second);
    color: var(--ec-second);
}

.btn-danger {
    --cui-btn-bg: var(--ec-surface);
    --cui-btn-border-color: var(--ec-err);
    --cui-btn-color: var(--ec-err);
    --cui-btn-hover-bg: var(--ec-err-bg);
    --cui-btn-hover-border-color: var(--ec-err);
    --cui-btn-hover-color: var(--ec-err);
}

/* DevExpress buttons (ASPxButton in the Moderno, Glass, iOS, ... themes) */
div[class*="dxbButton"],
td[class*="dxbButton"] {
    background: var(--ec-blue) none !important;
    border: 1px solid var(--ec-blue) !important;
    border-radius: 9999px !important;
    color: var(--ec-on-accent) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-family: var(--ec-font) !important;
}
div[class*="dxbButton"] *,
td[class*="dxbButton"] * { color: var(--ec-on-accent) !important; text-shadow: none !important; }
div[class*="dxbButton"]:hover,
td[class*="dxbButton"]:hover { background-color: var(--ec-blue-hover) !important; border-color: var(--ec-blue-hover) !important; }
div[class*="dxbButton"][class*="dxbDisabled"],
td[class*="dxbButton"][class*="dxbDisabled"],
div[class*="dxbDisabled"] {
    background: var(--ec-surface) !important;
    border-color: var(--ec-line) !important;
}
div[class*="dxbDisabled"] *,
td[class*="dxbDisabled"] * { color: var(--ec-muted) !important; } /* still lighter than text, and readable (4.5:1) */

/* ---------- Form fields ---------- */

.col-form-label, .form-label { font-size: 14px; font-weight: 600; color: var(--ec-ink); }

.form-control, .form-select {
    min-height: 44px;
    border: 1px solid var(--ec-field);
    border-radius: 11px;
    background-color: var(--ec-surface);
    color: var(--ec-ink);
    font-size: 16px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--ec-focus);
    box-shadow: 0 0 0 3px var(--ec-ring);
}
.form-control.is-invalid { border-color: var(--ec-err); }
.input-group-text { background: var(--ec-pearl); border: 1px solid var(--ec-field); color: var(--ec-muted); border-radius: 11px; }
.form-check-input:checked { background-color: var(--ec-blue); border-color: var(--ec-blue); }

/* DevExpress text boxes, date and combo boxes: border colour and corners only */
table[class*="dxeTextBox"],
table[class*="dxeButtonEdit"],
table[class*="dxeMemo"],
div[class*="dxeTextBox"],
div[class*="dxeButtonEdit"] {
    border-color: var(--ec-field) !important;
    border-radius: 11px;
    background-color: var(--ec-surface);
}
table[class*="dxeFocused"],
div[class*="dxeFocused"] { border-color: var(--ec-focus) !important; box-shadow: 0 0 0 3px var(--ec-ring); }
input[class*="dxeEditArea"], .dxeEditArea, [class*="dxeEditArea_"] { font-family: var(--ec-font) !important; color: var(--ec-ink); }
td[class*="dxeButtonEditButton"],
td[class*="dxeButton_"] { background: transparent !important; border: none !important; }
/* Editors left on DevExpress's built-in style (no Theme, plain class name) are only 22px tall: same height as Backlog Sales' */
table.dxeButtonEdit, table.dxeTextBox { height: 37px; }

/* A read-only box (a figure the page works out, such as an order's Total Amount, Paid and Unpaid) is grey like the
   other read-only fields, so nobody tries to type in it */
table[class*="dxeTextBox"]:has(input[readonly]), div[class*="dxeTextBox"]:has(input[readonly]),
table[class*="dxeMemo"]:has(textarea[readonly]) {
    background-color: var(--cui-input-disabled-bg, #d8dbe0) !important;
    border-color: var(--cui-input-disabled-border-color, #b1b7c1) !important;
}
table[class*="dxeTextBox"]:has(input[readonly]) input, div[class*="dxeTextBox"]:has(input[readonly]) input,
table[class*="dxeMemo"]:has(textarea[readonly]) textarea { background: transparent !important; cursor: default; }

/* List boxes (the report filters' tick lists) */
table[class*="dxeListBox"], div[class*="dxeListBox"] { border-color: var(--ec-field) !important; border-radius: 11px; overflow: hidden; }
/* A list box with a set height: its scrolling area stays closed until DevExpress has sized it. The script first fills in
   the items (the box stretched to their full height) and only then sets the area's height, so the form under it jumped
   down and back (Lighthouse layout shift). */
table[class*="dxeListBox"][style*="height"] .dxlbd:not([style*="height"]) { height: 0; }
[class*="dxeListBoxItem"] { font-family: var(--ec-font) !important; color: var(--ec-ink) !important; background: var(--ec-surface) !important; border-color: var(--ec-line-soft) !important; }
[class*="dxeListBoxItemHover"] { background: var(--ec-page) !important; }
[class*="dxeListBoxItemSelected"] { background: var(--ec-select) !important; }
/* List search boxes stay open (opened on load); hide the arrow that would close them, as their open button does not show in this theme */
.dxeLBFEButtonSys { display: none !important; }

/* Drop-down lists and calendars that open over the page */
[class*="dxpcDropDown"], [class*="dxeCalendar"], [class*="dxpc-mainDiv"], [class*="dxpcLite"] .dxpc-mainDiv {
    font-family: var(--ec-font) !important;
}
[class*="dxeCalendarDaySelected"] { background-color: var(--ec-blue) !important; color: var(--ec-on-accent) !important; }
[class*="dxeCalendarToday"] { color: var(--ec-link) !important; }

/* Upload boxes */
[class*="dxucControl"], [class*="dxucTextBox"] { font-family: var(--ec-font) !important; }
[class*="dxucTextBox"] { border-color: var(--ec-field) !important; border-radius: 11px 0 0 11px; }
/* The clear (x) cell between the file box and Browse has the text box's class too: one box, not a second rounded piece */
td.dxCB[class*="dxucTextBox"] { border-radius: 0 !important; }
/* Room under the upload box: the Upload button that follows it on every import page touched it and looked overlapped */
table[class*="dxucControl"] { margin-bottom: 12px; }
[class*="dxucBrowseButton"], [class*="dxucButton"] {
    background: var(--ec-pearl) !important;
    color: var(--ec-ink) !important;
    border-color: var(--ec-field) !important;
}
[class*="dxucBrowseButton"] *, [class*="dxucButton"] * { color: var(--ec-ink) !important; }

/* ---------- Grids (ASPxGridView, every theme) ---------- */

table[class*="dxgvControl"],
div[class*="dxgvControl"] {
    font-family: var(--ec-font) !important;
    border-color: var(--ec-line-soft) !important;
    color: var(--ec-ink);
}
[class*="dxgvTable"] { font-family: var(--ec-font) !important; border-color: var(--ec-line-soft) !important; }
td[class*="dxgvHeader"] {
    background: var(--ec-pearl) none !important;
    color: var(--ec-muted) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-color: var(--ec-line) !important;
}
td[class*="dxgvHeader"] * { color: var(--ec-muted) !important; }
/* Text colour goes on the row, not the cells: pages colour a row by its status (inactive in red) and cells inherit it */
tr[class*="dxgvDataRow"] { color: var(--ec-ink); }
tr[class*="dxgvDataRow"] > td,
tr[class*="dxgvDataRow"] > td.dxgv { border-color: var(--ec-line-soft) !important; }
tr[class*="dxgvDataRowAlt"] > td { background: var(--ec-surface); }
tr[class*="dxgvDataRowHover"] > td,
tr[class*="dxgvDataRow"]:hover > td { background: var(--ec-pearl) !important; }
tr[class*="dxgvSelectedRow"] > td,
tr[class*="dxgvFocusedRow"] > td { background: var(--ec-select) !important; }
tr[class*="dxgvFilterRow"] > td { background: var(--ec-surface) !important; border-color: var(--ec-line-soft) !important; }
tr[class*="dxgvFooter"] > td, tr[class*="dxgvGroupFooter"] > td { background: var(--ec-pearl) !important; font-weight: 600; border-color: var(--ec-line) !important; }
tr[class*="dxgvGroupRow"] > td { background: var(--ec-page) !important; font-weight: 600; }
tr[class*="dxgvEditingErrorRow"] > td { background: var(--ec-err-bg) !important; color: var(--ec-err) !important; }
tr[class*="dxgvInlineEditRow"] > td, tr[class*="dxgvEditFormDisplayRow"] > td, [class*="dxgvEditForm"] { background: var(--ec-pearl) !important; }
td[class*="dxgvCommandColumn"] img { opacity: 0.85; }
/* The action icons (images/icons, 24px) stay on one line, a little apart */
td[class*="dxgvCommandColumn"] { white-space: nowrap; }
td[class*="dxgvCommandColumn"] img[src*="images/icons/"] { opacity: 1; margin: 0 3px; vertical-align: middle; }
[class*="dxgvEmptyDataRow"] td, tr[class*="dxgvEmptyDataRow"] > td { color: var(--ec-muted) !important; }
[class*="dxgvGroupPanel"] { color: var(--ec-muted) !important; background: transparent !important; }
/* The compact group panel DevExpress swaps in when the grid does not fit: same height as the normal one (it was 9px
   shorter, so the grid under it jumped up at the swap: Lighthouse layout shift) */
[class*="dxgvAdaptiveGroupPanel"] { padding-top: 8px !important; padding-bottom: 16px !important; }
[class*="dxgvSearchPanel"] { background: transparent !important; }
[class*="dxgvSearchPanel"] a, [class*="dxgvSearchPanel"] a span { color: var(--ec-link) !important; }
[class*="dxgvPagerBottomPanel"], [class*="dxgvPagerTopPanel"] { background: transparent !important; border-color: var(--ec-line-soft) !important; }

/* Pager */
[class*="dxpLite"], [class*="dxpControl"] { font-family: var(--ec-font) !important; color: var(--ec-muted) !important; }
[class*="dxpLite"] .dxp-num, [class*="dxpLite"] .dxp-button { border-radius: 9999px; color: var(--ec-ink) !important; }
[class*="dxpLite"] .dxp-current {
    background: var(--ec-blue) !important;
    color: var(--ec-on-accent) !important;
    border-color: var(--ec-blue) !important;
    border-radius: 9999px;
}

/* ---------- Report toolbar and viewer ---------- */

/* ---------- Bootstrap tables, progress bars ---------- */

.table { --cui-table-border-color: var(--ec-line-soft); color: var(--ec-ink); }
.table > thead th { background: var(--ec-pearl); color: var(--ec-muted); font-size: 12px; font-weight: 600; border-bottom-color: var(--ec-line); }
.progress { border-radius: 9999px; background: var(--ec-hover); }
.progress-bar { background-color: var(--ec-blue); }

/* ---------- Tablet and phone ---------- */

/* Tablet: CoreUI docks the 256px side menu from 768px, which leaves a portrait tablet ~560px for the page.
   Below 992px it slides in over the page instead, as it does on phones: these are CoreUI's own phone rules
   (style.css, max-width 767.98px), extended. --cui-is-mobile is what CoreUI's script reads to treat the menu
   as a phone menu (backdrop, close on tap). */
@media (min-width: 768px) and (max-width: 991.98px) {
    #sidebar.sidebar {
        --cui-is-mobile: true;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1031;
    }
    #sidebar.sidebar ~ * { --cui-sidebar-occupy-start: 0 !important; }
    #sidebar.sidebar:not(.show) { margin-left: calc(-1 * var(--cui-sidebar-width)); }
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1030;
        width: 100vw;
        height: 100vh;
        background-color: #000000;
        transition: opacity 0.15s linear;
    }
    .sidebar-backdrop.fade { opacity: 0; }
    .sidebar-backdrop.fade.show { opacity: 0.32; }
}

/* A grid wider than its card scrolls sideways in its own box instead of running past the card or making the whole
   page wider (which made phones zoom the page out). The grid is a <table>, which cannot scroll itself: its parent
   box scrolls instead. */
div:has(> table[class*="dxgvControl"]),
div:has(> div[class*="dxgvControl"]) {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Phone and tablet: bigger touch targets */
@media (max-width: 991.98px) {
    #sidebar .sidebar-nav .nav-link { min-height: 44px; }
    .wrapper > .header .breadcrumb-item.active { font-size: 26px; }
}

/* Phone */
@media (max-width: 767.98px) {
    .wrapper > .body { padding-left: 12px !important; padding-right: 12px !important; }
    .wrapper > .header { margin-bottom: 16px !important; }
    /* The whole header stays at the top while scrolling, so it is kept short on a phone */
    .wrapper > .header > .container-fluid:first-of-type { min-height: 48px; }
    .wrapper > .header > .container-fluid:last-of-type:not(:first-of-type) { padding: 10px 16px 8px; }
    .wrapper > .header .breadcrumb { font-size: 11px; }
    .wrapper > .header .breadcrumb-item.active { font-size: 21px; margin-top: 0; }
    .card { border-radius: 14px; margin-bottom: 16px; }
    .card-header { padding: 16px 16px 2px; font-size: 17px; }
    .card-body { padding: 14px 16px 18px; }
    .btn { --cui-btn-padding-y: 0.6rem; min-height: 44px; }
    .wrapper > .footer { padding: 16px; }
}

/* ---------- Login page (Login.aspx: body.ec-login) ---------- */

body.ec-login {
    background: #272729 url("../images/background.jpg") center / cover no-repeat fixed;
}
body.ec-login .ec-login-row { min-height: 100vh; }
body.ec-login .container { max-width: none; padding: 0; margin: 0; }
body.ec-login .container > .row { margin: 0; justify-content: flex-end; }
body.ec-login .container > .row > .col { display: none; }
body.ec-login .container > .row > .col-lg-5 { flex: 0 0 auto; width: 460px; max-width: 100%; padding: 0; }
body.ec-login .card-group, body.ec-login .card-group > .card { margin: 0; }
body.ec-login .card-group > .card {
    width: 100%;
    min-height: 100vh;
    flex: 1 1 auto;
    justify-content: center;
    padding: 48px 32px !important;
    border: none;
    border-radius: 0;
    background: var(--ec-surface);
}
body.ec-login .card-body { padding: 0; }
body.ec-login .card-body > a img { max-height: 72px; width: auto; margin: 0 0 20px !important; }
body.ec-login h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.4px; margin-bottom: 4px; }
body.ec-login .card-body > .text-medium-emphasis:first-of-type { font-size: 19px; }
body.ec-login #languageChoice { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0; margin: 18px 0 20px !important; }
body.ec-login #languageChoice a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--ec-line);
    border-radius: 9999px;
    font-size: 14px;
    color: var(--ec-ink);
    text-decoration: none;
}
body.ec-login #languageChoice a[style*="bold"] { border: 2px solid var(--ec-focus); padding: 0 13px; font-weight: 600 !important; }
body.ec-login #languageChoice a { gap: 8px; }
body.ec-login #languageChoice .lang-sep { display: none; }
/* Tablet and desktop: a slightly wider panel and tighter pills, so the four languages fit on one line (phones still wrap) */
@media (min-width: 768px) {
    body.ec-login .container > .row > .col-lg-5 { width: 520px; }
    body.ec-login #languageChoice { gap: 6px; }
    body.ec-login #languageChoice a { padding: 0 11px; gap: 6px; }
    body.ec-login #languageChoice a[style*="bold"] { padding: 0 10px; }
}

/* Country flags beside the language names (login page and the Account menu); the hairline keeps Japan's white flag visible */
.lang-flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14); flex: 0 0 auto; vertical-align: middle; }
.lang-tick { flex: 0 0 12px; text-align: center; }
body.ec-login .input-group { flex-wrap: nowrap; }
body.ec-login .input-group .form-control { min-height: 46px; }
body.ec-login #btLogin { min-width: 160px; min-height: 46px; font-size: 17px; }

@media (max-width: 767.98px) {
    /* phone: photo is a short band at the top, the white panel follows straight after it (no gap, form above the fold) */
    body.ec-login { background: var(--ec-surface); }
    body.ec-login::before {
        content: "";
        position: absolute;
        top: 0; left: 0; right: 0;
        height: 30vh; height: 30svh;
        background: #272729 url("../images/background.jpg") center / cover no-repeat;
    }
    body.ec-login .ec-login-row { position: relative; z-index: 1; min-height: 0 !important; align-items: flex-start !important; }
    body.ec-login .container > .row > .col-lg-5 { width: 100%; }
    body.ec-login .card-group > .card {
        min-height: 0;
        margin-top: calc(30vh - 18px) !important;
        margin-top: calc(30svh - 18px) !important;
        padding: 24px 20px 32px !important;
        border-radius: 18px 18px 0 0;
    }
    body.ec-login .card-body > a img { max-height: 48px; margin-bottom: 12px !important; }
    body.ec-login h1 { font-size: 32px; }
    body.ec-login .card-body > .text-medium-emphasis:first-of-type { font-size: 17px; }
    body.ec-login #languageChoice { margin: 14px 0 16px !important; }
}

/* Page and section descriptions behind an (i) icon (js/page-info.js) */
/* margin -5px top and bottom: the 28px icon does not make its heading's line taller (the page moved down when it was added) */
.ec-info { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -5px 0 -5px 6px; padding: 0;
           border: 0; border-radius: 50%; background: transparent; color: var(--ec-link); vertical-align: middle; cursor: pointer;
           font-size: 0; line-height: 0; letter-spacing: 0; }
.ec-info svg { width: 20px; height: 20px; flex: 0 0 auto; }
.ec-info:hover, .ec-info[aria-expanded="true"] { background: var(--ec-info-bg); }
.ec-info:focus-visible { outline: 2px solid var(--ec-focus); outline-offset: 2px; }
.ec-info-pop { position: fixed; z-index: 1060; width: min(440px, calc(100vw - 16px)); max-height: min(60vh, 480px); overflow: auto;
               background: var(--ec-surface); color: var(--ec-ink); border: 1px solid var(--ec-line); border-radius: 12px;
               box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16); padding: 14px 16px; font-size: 14px; font-weight: 400; line-height: 1.5; text-align: left; }
.ec-info-pop[hidden] { display: none; }
.ec-info-pop .ec-info-title { font-weight: 600; margin-bottom: 6px; }
.ec-info-pop p { margin: 0 0 8px; color: var(--ec-text-2); font-size: 14px; }
.ec-info-pop p:last-child { margin-bottom: 0; }
/* Until js/page-info.js has run (it marks <html> ec-info-ready): what it is about to move behind the (i) icons, and the
   title bars it is about to hide, are kept out of the first paint, so the page does not jump when it does (Lighthouse
   layout shift). Separate rules: a browser without :has() drops only those that use it.
   The heading just above the page's description moves into the panel too, except on pages with several described
   sections, where every heading stays: those pages carry ec-sections on their body div. */
html:not(.ec-info-ready) .wrapper .body p.text-medium-emphasis:not(.modal p) { display: none; }
html:not(.ec-info-ready) .wrapper .body .card-header.ec-title-repeat:not(:has(a, button, input, select, img, svg)) { display: none; }
html:not(.ec-info-ready) .wrapper .body:not(.ec-sections) h6:has(+ p.text-medium-emphasis):not(p.text-medium-emphasis ~ h6):not(.modal h6) { display: none; }
/* A card title bar that only repeated the page title: its buttons stay, on the right. js/page-info.js marks its text
   ec-title-text and the whole bar ec-title-empty when nothing else is in it; the glass themes show them again. */
.card-header.ec-title-repeat.d-flex { justify-content: flex-end !important; }
.card-header .ec-title-text, .card-header.ec-title-empty { display: none !important; }   /* as the hidden attribute did, over d-flex */

/* ---------- Accessibility: text that is readable against its background (WCAG AA, 4.5:1) ---------- */

/* Help text under fields, and CoreUI's status text (Monitor Terminal's counts, warnings) */
.form-text { color: var(--ec-muted) !important; }
.text-success { color: var(--ec-ok) !important; }
.text-danger { color: var(--ec-err) !important; }
.text-warning { color: var(--ec-warn) !important; }

/* Rows and cells the pages colour in code (ForeColor = Red / Gray): the same colours, dark enough to read */
[style*="color:Red" i], [style*="color: red" i], [style*="color:#FF0000" i] { color: var(--ec-err) !important; }
[style*="color:Gray" i], [style*="color: gray" i], [style*="color:#808080" i] { color: var(--ec-muted) !important; }

/* Hint text in empty boxes (Enter text to search..., Drop file(s) here) */
input[class*="dxeEditArea"]::placeholder, input[class*="dxucEditArea"]::placeholder, .form-control::placeholder { color: var(--ec-muted); opacity: 1; }
input[class*="dxucEditArea"] { color: var(--ec-muted) !important; }

/* Outline buttons in CoreUI's light red and green (Monitor Terminal's Block All / Unblock All) */
.btn-outline-danger { --cui-btn-color: var(--ec-err); --cui-btn-border-color: var(--ec-err); --cui-btn-hover-bg: var(--ec-err); --cui-btn-hover-border-color: var(--ec-err); --cui-btn-active-bg: var(--ec-err); --cui-btn-active-border-color: var(--ec-err); }
.btn-outline-success { --cui-btn-color: var(--ec-ok); --cui-btn-border-color: var(--ec-ok); --cui-btn-hover-bg: var(--ec-ok); --cui-btn-hover-border-color: var(--ec-ok); --cui-btn-active-bg: var(--ec-ok); --cui-btn-active-border-color: var(--ec-ok); }

/* DevExpress: hint text in empty boxes (dxh0), grid footers and the narrow-screen group panel */
input[class*="dxeEditArea"].dxh0 { color: var(--ec-muted) !important; }
[class*="dxgvFooter"] td, td.dxgRRB, [class*="dxgvAdaptiveGroupPanel"] { color: var(--ec-muted); }

/* Links inside grid cells (View, Access): the portal's blue, not the old theme's orange */
td.dxgv a:not(.btn):not([class*="dxb"]) { color: var(--ec-link); }

/* ---------- Loading states (js/page-loading.js) ---------- */

/* The next page: a shimmering outline of a card, a toolbar and table rows covers the content while it loads.
   It fades in after 120ms, so a page that comes back at once does not flash. */
.wrapper > .body.ec-leaving { position: relative; min-height: 60vh; }
.ec-skeleton {
    position: absolute;
    inset: 0;
    z-index: 1000;
    padding-left: inherit;
    padding-right: inherit;
    background: var(--ec-page);
    animation: ec-sk-in 200ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
}
.ec-skeleton .container-lg { position: sticky; top: var(--ec-sk-top, 0px); }
.ec-sk-card { background: var(--ec-card); border: 1px solid var(--ec-hair); border-radius: 18px; padding: 24px; }
.ec-sk-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.ec-sk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.ec-sk-row { display: grid; grid-template-columns: 1fr 1.6fr 2fr 1.2fr 0.8fr; gap: 24px; align-items: center; height: 44px; border-top: 1px solid var(--ec-line-soft); }
.ec-sk-row.ec-sk-th { height: 36px; border-top: 0; }

/* One light sweeps across every bar together (the gradient is fixed to the window, not to each bar) */
.ec-sk,
.wrapper > .header .breadcrumb.ec-sk-crumb::after {
    display: block;
    height: 12px;
    border-radius: 6px;
    background-color: var(--ec-hover);
    background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0) 70%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    background-attachment: fixed;
    animation: ec-shimmer 1.6s ease-in-out infinite;
}
.ec-sk-th .ec-sk { height: 8px; }
.ec-sk-title { width: 200px; height: 20px; border-radius: 8px; }
.ec-sk-pill { flex: none; width: 112px; height: 36px; border-radius: 9999px; }
.ec-sk-field { flex: 0 1 280px; height: 44px; border-radius: 11px; }
.ec-sk-field.ec-sk-narrow { flex-basis: 160px; }

/* The page title in the top bar goes the same way: its text hides after the same 120ms, a bar takes its place */
.wrapper > .header .breadcrumb.ec-sk-crumb { position: relative; }
.wrapper > .header .breadcrumb.ec-sk-crumb > * { visibility: hidden; transition: visibility 0s linear 120ms; }
.wrapper > .header .breadcrumb.ec-sk-crumb::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 6px;
    width: 240px;
    max-width: calc(100vw - 48px);
    height: 28px;
    border-radius: 8px;
    animation: ec-sk-in 200ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both, ec-shimmer 1.6s ease-in-out infinite;
}

@keyframes ec-sk-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ec-shimmer {
    from { background-position: 150% 0; }   /* the light just off the left edge */
    to { background-position: -50% 0; }     /* just off the right edge */
}

/* The button that sent the form: a spinner in its text colour instead of its text (the spinner is set by the script),
   same size as before, and no second click */
.ec-btn-busy { pointer-events: none; }
.ec-btn-busy.ec-btn-busy,
.ec-btn-busy.ec-btn-busy * { color: transparent !important; text-shadow: none !important; }
.ec-btn-busy > * { visibility: hidden; }

@media (max-width: 767.98px) {
    .ec-sk-card { border-radius: 14px; padding: 16px; }
    .ec-sk-head, .ec-sk-tools { margin-bottom: 16px; }
    .ec-sk-row { grid-template-columns: 1fr 1.6fr 1fr; gap: 16px; }
    .ec-sk-row > :nth-child(n+4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .ec-skeleton,
    .ec-sk,
    .wrapper > .header .breadcrumb.ec-sk-crumb::after { animation: none; }
    .wrapper > .header .breadcrumb.ec-sk-crumb > * { transition: none; }
}

/* ---------- Smooth corners (Apple's continuous corners) ----------
   Where the browser can draw them (CSS corner-shape), rounded boxes get a squircle corner: the curve eases into the
   straight edge instead of meeting it at a point, as on iOS and macOS. A squircle looks tighter than a circle of the
   same radius, so each radius grows by about 1.5 to keep today's softness. Pills (buttons, badges) and circles
   (avatars, dots) stay round, as Apple keeps them. Browsers without corner-shape keep the round corners above.
   Pages with their own rounded parts (Home, User Group, the tick-box picker, ...) do the same in their own styles. */
@supports (corner-shape: squircle) {
    #sidebar .sidebar-nav .nav-link,
    .wrapper > .header .header-toggler,
    .wrapper > .header .dropdown-item { border-radius: 12px; corner-shape: squircle; }
    .wrapper > .header .breadcrumb-item.active a.ec-crumb-parent { border-radius: 9px; corner-shape: squircle; }
    .wrapper > .header .dropdown-menu { border-radius: 18px; corner-shape: squircle; }

    .card { border-radius: 28px; corner-shape: squircle; }
    .card-header:first-child { border-radius: 28px 28px 0 0; corner-shape: squircle; }
    .alert { border-radius: 16px; corner-shape: squircle; }

    /* (html: Sales Backlog and Sales Staff still carry an old 5px rule for these boxes, written later in the page) */
    .form-control, .form-select, .input-group-text,
    html table[class*="dxeTextBox"], html table[class*="dxeButtonEdit"], html table[class*="dxeMemo"],
    html div[class*="dxeTextBox"], html div[class*="dxeButtonEdit"],
    table[class*="dxeListBox"], div[class*="dxeListBox"] { border-radius: 16px; corner-shape: squircle; }
    [class*="dxucTextBox"] { border-radius: 16px 0 0 16px; corner-shape: squircle; }

    .ec-info-pop { border-radius: 18px; corner-shape: squircle; }
    /* the staff photo and the camera preview (their 8px is written on the elements) */
    #staffPhotoImage, #staffPhotoVideo { border-radius: 12px !important; corner-shape: squircle; }

    .ec-sk-card { border-radius: 28px; corner-shape: squircle; }
    .ec-sk { border-radius: 9px; corner-shape: squircle; }
    .ec-sk-title, .wrapper > .header .breadcrumb.ec-sk-crumb::after { border-radius: 12px; corner-shape: squircle; }
    .ec-sk-field { border-radius: 16px; corner-shape: squircle; }

    @media (max-width: 767.98px) {
        .card, .ec-sk-card { border-radius: 22px; }
        body.ec-login .card-group > .card { border-radius: 28px 28px 0 0; corner-shape: squircle; }
    }
}
