/* =====================================================================
   DMEx theme: modernised look
   Loaded AFTER style.css. Overrides the shared shell pieces only;
   page-specific templates are added per module as they are converted.
   ===================================================================== */

/* ---------- Design tokens: "DMEx Sky" palette ---------- */
:root {
    --dmx-header: #1A6FD6;          /* header bar: DMEx brand blue, deep enough for white text */
    --dmx-accent: #FFB020;          /* amber: active navigation marker, avatar */
    --dmx-accent-ink: #3D2600;      /* text on the amber accent */
    --dmx-slate: #2B3640;           /* neutral dark: settings icons */
    --dmx-blue: #4F9EEE;            /* DMEx brand blue: login background */
    --dmx-blue-strong: #0F5BB5;     /* buttons, links (passes contrast with white text) */
    --dmx-blue-strong-hover: #0B4A94;
    --dmx-blue-tint: #DCEBFF;
    --dmx-focus: rgba(15, 91, 181, .25);   /* focus ring around inputs */
    --dmx-orange: var(--dmx-accent);        /* kept for older references */

    --dmx-bg: #F1F7FE;
    --dmx-surface: #FFFFFF;
    --dmx-surface-2: #F5F9FE;
    --dmx-hover: #EAF2FD;           /* row and button hover */
    --dmx-border: #D3E3F7;
    --dmx-border-strong: #B9CFEC;
    --dmx-border-soft: #E8F0FB;     /* dividers inside cards and tables */

    --dmx-text: #0F2A47;
    --dmx-text-2: #2E4766;
    --dmx-muted: #4E6380;
    --dmx-on-dark: #FFFFFF;
    --dmx-on-dark-muted: #EAF3FF;   /* navigation text on the blue header */
    --dmx-on-dark-subtle: #EAF3FF;  /* secondary text on the blue header */
    --dmx-shadow: rgba(15, 42, 71, .14);

    /* Status (tolerance and states) */
    --dmx-ok-bg: #D3F8DF;
    --dmx-ok-border: #3CCB7F;
    --dmx-ok-ink: #0B5C33;
    --dmx-ok-strong: #097A40;       /* delivery / truck series; passes contrast with white */
    --dmx-warn-bg: #FFF0C2;
    --dmx-warn-border: #F5B000;
    --dmx-bad-bg: #FFE1DD;
    --dmx-bad-border: #F7766A;
    --dmx-bad-ink: #99271B;
    --dmx-na-bg: #EEF1F5;
    --dmx-na-border: #C9D2DC;

    --dmx-danger: #B4361F;
    --dmx-success: #0B5C33;

    --dmx-radius: 12px;
    --dmx-radius-sm: 8px;
    --dmx-font: 'OpenS', 'Bai Jamjuree', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --dmx-header-h: 64px;
    --dmx-toolbar-h: 56px;
}


/* =====================================================================
   1. Shell (Default.aspx: body.dmx-shell)
   ===================================================================== */

/* --- Header bar --- */
.dmx-shell .dmexHeader {
    background-color: var(--dmx-header);
    height: calc(var(--dmx-header-h) + 22px);   /* 22px sits above the viewport (margin-top: -22px) */
    transition: margin-top ease-out .45s;
    transition-delay: .2s;
}

.dmx-shell .dmexHeaderHidden {
    margin-top: -190px;
}

/* The grey band behind the old toolbar is no longer used */
.dmx-shell .dmexHeaderToolBand {
    display: none;
}

.dmx-shell .dmexBody {
    top: var(--dmx-header-h);
    background-color: var(--dmx-bg);
}

/* --- Logos: the big white customer block and slants are retired --- */
.dmx-shell .custLogoSlant,
.dmx-shell .bigCustLogoSlant,
.dmx-shell .sponLogoSlant,
.dmx-shell .athLogo {
    display: none !important;
}

.dmx-shell .custLogo,
.dmx-shell .bigCustLogo,
.dmx-shell .custLogoShow {
    position: absolute;
    left: 16px !important;
    top: calc(22px + (var(--dmx-header-h) - 40px) / 2) !important;
    width: 40px !important;
    height: 40px !important;
    padding: 4px;
    box-sizing: border-box;
    background-color: #FFFFFF;
    border-radius: var(--dmx-radius-sm);
    object-fit: contain;
    transition: opacity .3s ease;
    transition-delay: 0s;
    cursor: default;
}

.dmx-shell .custLogo:not([src]),
.dmx-shell .custLogo[src=""] {
    visibility: hidden;
}

/* The company logo now shows in the user avatar (top right), and the sponsor logo is retired.
   Both images stay in the page (the server still loads them); they are just not displayed. */
.dmx-shell .custLogo,
.dmx-shell .bigCustLogo,
.dmx-shell .custLogoShow,
.dmx-shell .sponLogo {
    display: none !important;
}

/* Per-application sponsor logo, to the left of the user button (no longer displayed) */
.dmx-shell .sponLogo {
    position: absolute;
    right: 272px;
    top: calc(22px + (var(--dmx-header-h) - 40px) / 2);
    width: 40px;
    height: 40px;
    padding: 4px;
    box-sizing: border-box;
    background-color: #FFFFFF;
    border-radius: var(--dmx-radius-sm);
    object-fit: contain;
    opacity: 1;
    transition: opacity .3s ease;
    transition-delay: 0s;
}

.dmx-shell .sponLogo.sponsorHidden {
    right: 272px;
    opacity: 0;
    pointer-events: none;
}

.dmx-shell .sponLogo:not([src]),
.dmx-shell .sponLogo[src=""] {
    display: none;
}

/* DMEx wordmark */
.dmx-shell .dmextitle,
.dmx-shell .dmextitlebig,
.dmx-shell .dmextitlesmall {
    position: absolute;
    left: 16px;   /* was 68px, beside the company logo tile that now lives in the avatar */
    top: 22px;
    height: var(--dmx-header-h);
    margin: 0;
    padding: 0 !important;
    display: flex;
    align-items: center;
    transition: none;
}

.dmx-shell .dmex {
    height: 32px;
    margin: 0;
    display: block;
}

.dmx-shell .dmextext {
    display: none;
}

/* --- Brand switch ---
   Default.aspx's <body data-brand="..."> picks the logos:
   "dmex" = DMEx logos; "fuelfacs" = FuelFACS Connect logos. */
body[data-brand="dmex"] .dmx-brand-fuelfacs,
body:not([data-brand="dmex"]) .dmx-brand-dmex {
    display: none !important;
}

/* --- Module navigation --- */
.dmx-nav {
    position: absolute;
    left: 200px;    /* clears the 160px-wide FuelFACS Connect logo (was 100px for the DMEx logo) */
    right: 280px;   /* was 330px: the sponsor logo is gone */
    top: 22px;
    height: var(--dmx-header-h);
    display: flex;
    align-items: stretch;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    font-family: var(--dmx-font);
}

.dmx-nav::-webkit-scrollbar {
    display: none;
}

.dmx-nav-link {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px 0;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--dmx-on-dark-muted);
    font-family: var(--dmx-font);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}

.dmx-nav-link:hover,
.dmx-nav-link:focus-visible {
    color: var(--dmx-on-dark);
    outline: none;
}

.dmx-nav-link:focus-visible {
    box-shadow: inset 0 0 0 2px var(--dmx-on-dark);
    border-radius: var(--dmx-radius-sm) var(--dmx-radius-sm) 0 0;
}

.dmx-nav-link.active {
    color: var(--dmx-on-dark);
    font-weight: 600;
    border-bottom-color: var(--dmx-accent);
}

.dmx-nav-link svg {
    width: 14px;
    height: 14px;
}

.dmx-nav-drop svg {
    transition: transform .15s ease;
}

.dmx-nav-drop[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Modules and Settings dropdowns */
.dmx-menu {
    position: fixed;
    z-index: 1100;
    min-width: 220px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 6px;
    background: var(--dmx-surface);
    border: 1px solid var(--dmx-border);
    border-radius: var(--dmx-radius-sm);
    box-shadow: 0 12px 28px rgba(15, 42, 71, .18);
    font-family: var(--dmx-font);
    display: none;
}

.dmx-menu.open {
    display: block;
}

.dmx-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--dmx-text);
    font-size: 15px;
    text-decoration: none;
}

.dmx-menu a:hover,
.dmx-menu a:focus-visible {
    background: var(--dmx-blue-tint);
    color: var(--dmx-blue-strong);
    outline: none;
}

.dmx-menu a.active {
    font-weight: 600;
    color: var(--dmx-blue-strong);
}

/* Module icon in the dropdown: no tile, just the glyph in the item's text colour */
.dmx-menu-icon {
    flex: none;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: var(--dmx-menu-icon) center / contain no-repeat;
    mask: var(--dmx-menu-icon) center / contain no-repeat;
    opacity: .85;
}

.dmx-menu a:hover .dmx-menu-icon,
.dmx-menu a.active .dmx-menu-icon {
    opacity: 1;
}

/* --- User button (sign out) --- */
.dmx-shell .userbarContainer,
.dmx-shell .userbarContainerMobile {
    position: fixed;
    top: 0;
    right: 0;
    width: 256px;
    height: var(--dmx-header-h);
    padding: 0 16px 0 0;
    box-sizing: border-box;
    overflow: hidden;
    z-index: 1000;
    pointer-events: none;
}

.dmx-shell .userbar,
.dmx-shell .userbarMinimize {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    height: 100%;
    transform: none;
    transition: transform .45s ease-out;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: none;   /* style.css gives the old userbar a 5px drop shadow: a dark strip at the right edge */
}

.dmx-shell .userbarContainerHidden > .userbar {
    transform: translateX(110%);
}

.dmx-user {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--dmx-radius-sm);
    background: transparent;
    color: var(--dmx-on-dark);
    font-family: var(--dmx-font);
    text-align: left;
    cursor: pointer;
}

.dmx-user:hover,
.dmx-user:focus-visible {
    background: rgba(255, 255, 255, .08);
    outline: none;
}

.dmx-avatar {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--dmx-radius-sm);   /* rounded square (was a circle) */
    background: var(--dmx-accent);
    color: var(--dmx-accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
}

/* Company logo in the avatar (set by Default.aspx once the logo loads; initials are the fallback) */
.dmx-avatar.dmx-avatar-logo {
    box-sizing: border-box;
    width: 38px;    /* 34px + the 2px ring on each side that used to surround it */
    height: 38px;
    margin: -2px;   /* grow into the ring's space without moving the name beside it */
    padding: 4px;
    background: #FFFFFF var(--dmx-avatar-logo) center / contain no-repeat content-box;
    color: transparent;
    font-size: 0;
}

.dmx-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.dmx-user-name,
.dmx-user-company {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dmx-user-name {
    font-size: 14px;
    font-weight: 600;
    text-transform: capitalize;
}

.dmx-user-company {
    font-size: 12px;
    color: var(--dmx-on-dark-subtle);
    text-transform: capitalize;
}

/* Narrow screens: wordmark, nav and avatar only */
@media (max-width: 760px) {
    .dmx-shell .custLogo { display: none; }
    .dmx-shell .dmextitle { left: 16px; }
    .dmx-shell .dmex { height: 22px; }      /* logo ~110px wide */
    .dmx-nav { left: 140px; right: 64px; }
    .dmx-shell .sponLogo { display: none; }
    .dmx-shell .userbarContainer { width: 64px; }
    .dmx-user-text { display: none; }
}

/* Phones: smaller logo and tighter menu so Home, Modules and Settings all fit */
@media (max-width: 450px) {
    .dmx-shell .dmex { height: 16px; }      /* logo ~80px wide */
    .dmx-nav { left: 104px; right: 60px; gap: 2px; }
    .dmx-nav-link { padding: 3px 7px 0; font-size: 14px; }
    .dmx-nav-drop svg { display: none; }
}

/* FuelFACS Connect logos are sized by width (artwork is ~6.4:1), so the header menu and
   login card keep their places whatever the artwork's proportions */
.dmx-shell .dmex.dmx-brand-fuelfacs { width: 160px; height: auto; }
#logoFuelfacs.dmx-login-logo.dmx-brand-fuelfacs { width: 280px; height: auto; }   /* inside the 400px login card */
@media (max-width: 760px) {
    .dmx-shell .dmex.dmx-brand-fuelfacs { width: 110px; }
}
@media (max-width: 450px) {
    .dmx-shell .dmex.dmx-brand-fuelfacs { width: 80px; }
    #logoFuelfacs.dmx-login-logo.dmx-brand-fuelfacs { width: 220px; }
}

/* DMEx brand: its logo is narrower (~59px at 32px high), so the menu sits closer */
body[data-brand="dmex"] .dmex { height: 32px; }
body[data-brand="dmex"] .dmx-nav { left: 100px; }
@media (max-width: 760px) {
    body[data-brand="dmex"] .dmx-nav { left: 88px; }
}


/* =====================================================================
   2. Module toolbar (inside each page: #toolbar.toolbar > .toolbtn)
   ===================================================================== */

#toolbar.toolbar {
    height: var(--dmx-toolbar-h);
    min-height: var(--dmx-toolbar-h);
    padding: 0 16px;
    box-sizing: border-box;
    align-items: center;
    gap: 4px;
    background-color: var(--dmx-surface);
    border-bottom: 1px solid var(--dmx-border);
}

#toolbar.toolbar > .toolbtn,
#toolbar.toolbar > .toolbtn.toolbtnExpanded,
#toolbar.toolbar > .toolbtn.condenseToolbtn {
    width: auto;
    height: 40px;
    padding: 0 14px 0 40px;
    border: 0;
    border-radius: var(--dmx-radius-sm);
    background-color: transparent;
    background-size: 20px 20px;
    background-position: 12px center;
    color: var(--dmx-text) !important;
    font-family: var(--dmx-font);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
}

#toolbar.toolbar > .toolbtn:hover {
    background-color: var(--dmx-hover);
    color: var(--dmx-text);
}

#toolbar.toolbar > .toolbtn.toolbtnActive {
    background-color: var(--dmx-blue-tint);
    color: var(--dmx-blue-strong) !important;
}

#toolbar.toolbar > .toolbtn:disabled,
#toolbar.toolbar > .toolbtn:disabled:hover {
    background-color: transparent;
    color: var(--dmx-muted) !important;
    opacity: .5;
}

#toolbar.toolbar > .toolbtn:focus-visible {
    outline: 2px solid var(--dmx-blue-strong);
    outline-offset: 1px;
}

/* Phones: icon-only toolbar buttons */
@media (max-width: 450px) {
    #toolbar.toolbar > .toolbtn,
    #toolbar.toolbar > .toolbtn.toolbtnExpanded,
    #toolbar.toolbar > .toolbtn.condenseToolbtn {
        width: 44px;
        padding: 0;
        background-position: center;
        color: transparent !important;
        overflow: hidden;
    }
}


/* =====================================================================
   3. Login (Default.aspx: #divLogin)
   ===================================================================== */

.dmx-shell .loginBackground {
    background-color: #d3e5fc;      /* sky colour at the top of the picture */
    background-image: url("../images/login-refinery-blue.svg?v1");
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
}

.dmx-shell #divLogin {
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.dmx-login {
    min-height: 100vh;
    box-sizing: border-box;
    padding: 48px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    font-family: var(--dmx-font);
    color: var(--dmx-text);
}

/* #logo here outranks the old fixed 171x87 #logo rule in style.css */
#logo.dmx-login-logo,
#logoFuelfacs.dmx-login-logo {
    height: 66px;
    width: auto;
    max-width: 100%;
    margin: 0;
    display: block;
}

/* The logo sits at the top of the login card, centred, with a little extra room below it */
.dmx-login-card > .dmx-login-logo {
    align-self: center;
    margin: 4px 0 10px;
}

body[data-brand="dmex"] #logo.dmx-login-logo { height: 96px; }

.dmx-login-card {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    padding: 32px;
    background: var(--dmx-surface);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(15, 42, 71, .18);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* The UpdatePanel wrapping the hidden postback button should not take a slot in the layout */
.dmx-login-card > #upLogin {
    display: contents;
}

.dmx-login-head h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.dmx-login-head p {
    margin: 4px 0 0;
    font-size: 15px;
    color: var(--dmx-muted);
}

.dmx-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dmx-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dmx-text-2);
}

.dmx-field-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.dmx-input {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid var(--dmx-border-strong);
    border-radius: var(--dmx-radius-sm);
    background: var(--dmx-surface);
    color: var(--dmx-text);
    font-family: var(--dmx-font);
    font-size: 15px;
}

.dmx-input:focus {
    outline: none;
    border-color: var(--dmx-blue-strong);
    box-shadow: 0 0 0 3px var(--dmx-focus);
}

.dmx-input:disabled {
    background: var(--dmx-surface-2);
    color: var(--dmx-muted);
}

.dmx-change > .dmx-field + .dmx-field {
    margin-top: 18px;
}

.dmx-hint {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--dmx-muted);
}

.dmx-check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}

.dmx-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--dmx-blue-strong);
}

.dmx-btn {
    width: 100%;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--dmx-radius-sm);
    font-family: var(--dmx-font);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}

.dmx-btn:focus-visible {
    outline: 2px solid var(--dmx-blue-strong);
    outline-offset: 2px;
}

.dmx-btn-primary {
    border: 0;
    background: var(--dmx-blue-strong);
    color: #FFFFFF;
}

.dmx-btn-primary:hover {
    background: var(--dmx-blue-strong-hover);
}

.dmx-btn-primary:disabled {
    background: var(--dmx-border);
    color: var(--dmx-muted);
    cursor: default;
}

.dmx-btn-secondary {
    border: 1px solid var(--dmx-border-strong);
    background: var(--dmx-surface);
    color: var(--dmx-text);
    font-size: 15px;
    font-weight: 500;
}

.dmx-btn-secondary:hover {
    background: var(--dmx-surface-2);
}

.dmx-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--dmx-blue-strong);
    font-family: var(--dmx-font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.dmx-link:hover {
    color: var(--dmx-blue-strong-hover);
    text-decoration: underline;
}

.dmx-link:focus-visible {
    outline: 2px solid var(--dmx-blue-strong);
    outline-offset: 2px;
    border-radius: 2px;
}

.dmx-link-center {
    align-self: center;
    font-size: 14px;
}

.dmx-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--dmx-muted);
}

.dmx-divider::before,
.dmx-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--dmx-border);
}

.dmx-login-foot {
    margin: 0;
    font-size: 13px;
    color: var(--dmx-on-dark-muted);   /* sits on the dark road of the login picture */
}

@media (max-width: 450px) {
    .dmx-login { padding-top: 32px; gap: 20px; }
    #logo.dmx-login-logo, #logoFuelfacs.dmx-login-logo { height: 48px; }
    body[data-brand="dmex"] #logo.dmx-login-logo { height: 72px; }
    .dmx-login-card { padding: 24px; }
}


/* =====================================================================
   4. Page templates (module pages: body.dmx-page)
   ===================================================================== */

body.dmx-page {
    background-color: var(--dmx-bg);
    color: var(--dmx-text);
    font-family: var(--dmx-font);
    font-size: 14px;
}

/* Scrolling area under the module toolbar */
.dmx-page-scroll {
    width: 100%;
    height: calc(100% - var(--dmx-toolbar-h));
    overflow-x: hidden;
    overflow-y: auto;
}

.dmx-page-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Two-up row that stacks on narrow screens */
.dmx-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
}

/* UpdatePanels and other wrappers that should not take a slot in a flex layout */
.dmx-contents {
    display: contents;
}

.dmx-section-title {
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dmx-muted);
}

/* --- Cards --- */
.dmx-card {
    background: var(--dmx-surface);
    border: 1px solid var(--dmx-border);
    border-radius: var(--dmx-radius);
    min-width: 0;
    box-sizing: border-box;
}

.dmx-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--dmx-border-soft);
}

.dmx-card-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--dmx-text);
}

.dmx-card-body {
    padding: 20px;
}

.dmx-count {
    font-weight: 500;
    color: var(--dmx-muted);
}

/* --- Search box --- */
.dmx-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    min-width: 240px;
    flex: 0 1 320px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid var(--dmx-border-strong);
    border-radius: var(--dmx-radius-sm);
    background: var(--dmx-surface);
    color: var(--dmx-muted);
}

.dmx-search:focus-within {
    border-color: var(--dmx-blue-strong);
    box-shadow: 0 0 0 3px var(--dmx-focus);
}

.dmx-search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--dmx-text);
    font-family: var(--dmx-font);
    font-size: 15px;
}

.dmx-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --- Tables (ASP.NET GridView with class="grid") --- */
.dmx-table-scroll {
    max-height: 420px;
    overflow: auto;
}

.dmx-page table.grid {
    width: 100%;
    min-width: 0;
    border: 0;
    border-collapse: collapse;
    font-family: var(--dmx-font);
    font-size: 14px;
    text-transform: none;
}

.dmx-page table.grid tr th {
    position: sticky;
    top: 0;
    z-index: 1;
    height: auto;
    min-height: 0;
    padding: 10px 12px;
    background: var(--dmx-surface-2);
    border: 0;
    border-bottom: 1px solid var(--dmx-border-soft);
    color: var(--dmx-muted);
    font-family: var(--dmx-font);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

.dmx-page table.grid tr td {
    max-width: none;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--dmx-border-soft);
    color: var(--dmx-text);
    font-family: var(--dmx-font);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background-color .1s linear;
}

.dmx-page table.grid tr:hover > td {
    background-color: var(--dmx-hover);
}

.dmx-page table.grid tr th:first-child,
.dmx-page table.grid tr td:first-child {
    padding-left: 20px;
}

.dmx-page table.grid tr th:last-child,
.dmx-page table.grid tr td:last-child {
    padding-right: 20px;
}

/* --- Forms --- */
.dmx-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dmx-form-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.dmx-form input[type="text"],
.dmx-form input[type="email"],
.dmx-form input[type="password"],
.dmx-form select {
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
    border: 1px solid var(--dmx-border-strong);
    border-radius: var(--dmx-radius-sm);
    background: var(--dmx-surface);
    color: var(--dmx-text);
    font-family: var(--dmx-font);
    font-size: 15px;
}

.dmx-form input:focus,
.dmx-form select:focus {
    outline: none;
    border-color: var(--dmx-blue-strong);
    box-shadow: 0 0 0 3px var(--dmx-focus);
}

.dmx-form input:disabled,
.dmx-form select:disabled {
    background: var(--dmx-surface-2);
    border-color: var(--dmx-border);
    color: var(--dmx-text-2);
    opacity: 1;
}

.dmx-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.dmx-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dmx-actions .dmx-btn {
    width: auto;
    height: 44px;
    padding: 0 18px;
    font-size: 15px;
}

.dmx-actions .dmx-btn-primary {
    flex: 1 1 auto;
}

@media (max-width: 600px) {
    .dmx-page-inner { padding: 16px; gap: 16px; }
    .dmx-form-2col { grid-template-columns: minmax(0, 1fr); }
    .dmx-search { flex: 1 1 100%; min-width: 0; }
}


/* =====================================================================
   5. Slide-down panels under the module toolbar
      (#slidebarContainer > .slidebar: search, filter, export, options...)
   ===================================================================== */

#slidebarContainer {
    position: relative;
    z-index: 5;
    background: var(--dmx-surface);
    border-bottom: 1px solid var(--dmx-border);
    box-shadow: 0 8px 20px rgba(15, 42, 71, .08);
}

#slidebarContainer > .slidebar {
    box-sizing: border-box;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 12px 16px;
    background: transparent;
    border-top: 0;
    font-family: var(--dmx-font);
    color: var(--dmx-text);
}

#slidebarContainer > .slidebar table {
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0 6px;
}

#slidebarContainer > .slidebar td {
    padding: 0 6px;
    font-family: var(--dmx-font);
}

#slidebarContainer > .slidebar span {
    width: auto !important;
    font-family: var(--dmx-font);
    font-size: 13px;
    font-weight: 600;
    color: var(--dmx-text-2);
}

#slidebarContainer > .slidebar select,
#slidebarContainer > .slidebar input[type="text"],
#slidebarContainer > .slidebar input[type="number"],
#slidebarContainer > .slidebar input[type="date"],
#slidebarContainer > .slidebar input[type="search"] {
    height: 36px;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
    border: 1px solid var(--dmx-border-strong);
    border-radius: var(--dmx-radius-sm);
    background-color: var(--dmx-surface);
    color: var(--dmx-text);
    font-family: var(--dmx-font);
    font-size: 14px;
}

#slidebarContainer > .slidebar select:focus,
#slidebarContainer > .slidebar input:focus {
    outline: none;
    border-color: var(--dmx-blue-strong);
    box-shadow: 0 0 0 3px var(--dmx-focus);
}

/* Panel action buttons (Find, Apply, Reset, Excel, PDF...) */
#slidebarContainer > .slidebar .toolbtn {
    width: auto;
    height: 40px;
    margin: 0;
    padding: 0 14px 0 38px;
    border: 1px solid var(--dmx-border-strong);
    border-radius: var(--dmx-radius-sm);
    background-color: var(--dmx-surface);
    background-size: 18px 18px;
    background-position: 12px center;
    color: var(--dmx-text) !important;
    font-family: var(--dmx-font);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transform: none;
}

#slidebarContainer > .slidebar .toolbtn:hover,
#slidebarContainer > .slidebar .toolbtn.slidebarButtonActive {
    background-color: var(--dmx-surface-2);
    transform: none;
}

#slidebarContainer > .slidebar .toolbtn:focus-visible {
    outline: 2px solid var(--dmx-blue-strong);
    outline-offset: 1px;
}

#slidebarContainer > .slidebar a {
    color: var(--dmx-blue-strong);
}

/* =====================================================================
   Image buttons (.imgButton and all its variants)
   Every icon button in the app is a soft blue tile with an outline icon
   that fills with the brand blue on hover. Icon-only buttons are 40x40;
   document buttons (Document, FAN, BOL, DN) are taller tiles with the
   document code under the icon. Replaces the per-variant coloured SVG
   images (hexagons, circles) set in style.css and the page styles.
   ===================================================================== */
button.imgButton {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E");
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 2px;
    padding: 0;
    border: 1px solid var(--dmx-border);
    border-radius: 10px;
    background: var(--dmx-blue-tint) none !important;
    color: var(--dmx-blue-strong);
    font-family: var(--dmx-font);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .04em;
    text-shadow: none;
    opacity: 1;
    box-shadow: 0 1px 2px var(--dmx-shadow);
    cursor: pointer !important;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

/* The icon, drawn in the button's text colour */
button.imgButton::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    background-color: currentColor;
    -webkit-mask: var(--ib-icon) center / contain no-repeat;
    mask: var(--ib-icon) center / contain no-repeat;
}

button.imgButton:hover {
    opacity: 1;
    background-color: var(--dmx-blue-strong) !important;
    border-color: var(--dmx-blue-strong);
    color: var(--dmx-on-dark);
    box-shadow: 0 4px 10px var(--dmx-shadow);
    transform: translateY(-1px);
}

button.imgButton:active {
    transform: none;
    box-shadow: 0 1px 2px var(--dmx-shadow);
}

button.imgButton:focus-visible {
    outline: 2px solid var(--dmx-blue-strong);
    outline-offset: 2px;
}

/* Not available */
button.imgButton:disabled,
button.imgButton.jpdisabled,
button.imgButton.jpdisabled:hover {
    opacity: 1;
    background-color: var(--dmx-na-bg) !important;
    border-color: var(--dmx-na-border);
    border-style: dashed;
    color: #8A98A8;
    box-shadow: none;
    transform: none;
    cursor: default !important;
}

/* Destructive: red on hover */
button.imgButton.imgButtonDelete:hover {
    background-color: var(--dmx-danger) !important;
    border-color: var(--dmx-danger);
}

/* ---------- document tiles: icon above the document code ---------- */
button.imgButton.imgButtonDocument,
button.imgButton.imgButtonFAN,
button.imgButton.imgButtonBOL,
button.imgButton.imgButtonDN {
    display: inline-flex;
    width: 48px;
    min-width: 48px;
    height: 50px;
    margin: 0 3px;
    padding-bottom: 6px;
}

button.imgButton.imgButtonDocument::before,
button.imgButton.imgButtonFAN::before,
button.imgButton.imgButtonBOL::before,
button.imgButton.imgButtonDN::before {
    top: 7px;
    margin-top: 0;
}

button.imgButton span {
    display: block;
    margin: 0;
    text-shadow: none;
}

/* FAN, BOL and DN buttons have no text of their own; show the code like the document tiles */
button.imgButton.imgButtonFAN::after { content: "FAN"; }
button.imgButton.imgButtonBOL::after { content: "BOL"; }
button.imgButton.imgButtonDN::after { content: "DN"; }

/* ---------- icons ---------- */
button.imgButton.imgButtonDocument,
button.imgButton.imgButtonFAN,
button.imgButton.imgButtonBOL,
button.imgButton.imgButtonDN {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 13h6M9 17h4'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonAdd {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonEdit {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonDelete {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2'/%3E%3Cpath d='M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonInfo {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 16v-5M12 8h.01'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonGPS,
button.imgButton.imgButtongps {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11a7 7 0 0 1 14 0c0 4.8-7 11-7 11z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonTicket {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h14v18l-3-2-2 2-2-2-2 2-2-2-3 2z'/%3E%3Cpath d='M9 8h6M9 12h6M9 16h3'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonFile {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M10 12l-2 2.5 2 2.5M14 12l2 2.5-2 2.5'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonEvents {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18M8 14h.01M12 14h.01M16 14h.01M8 17h.01M12 17h.01'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonCmp {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='7' width='20' height='10' rx='5'/%3E%3Cpath d='M9 7v10M15 7v10'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonMore {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 6l5 5 5-5M7 13l5 5 5-5'/%3E%3C/svg%3E");
}

button.imgButton.imgButtonHistory {
    --ib-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}


/* =====================================================================
   Search panels (.searchTable on Trip, Trip Analysis, Feedback)
   The page styles paint the whole row dark grey (rgba(169,169,169)) while
   the mouse is over it, which shows as a grey box behind the inputs.
   ===================================================================== */
table.searchTable tr:hover,
table.searchTable tr:hover > td {
    background-color: transparent;
}