/* Ansaldo reference palette. List rules do not affect form/detail grids. */
:root {
    --ansaldo-red: #e51f23;
    --ansaldo-blue: #285ff0;
    --ansaldo-line: #dfe6f1;
}

body:not(.dark-mode) { --hb-shell-topbar-height: 56px; }

body:not(.dark-mode) .hbPlus-header {
    background: var(--ansaldo-red);
    border-bottom: 0;
}

.ansaldo-greeting {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

body:not(.dark-mode) .hbPlus-header .hbplus-quick-dashboard,
body:not(.dark-mode) .hbPlus-header .hbplus-quick-navigation {
    min-width: 0;
    height: 35px;
    padding: 0 15px;
    color: #fff !important;
    background: transparent !important;
    border-color: transparent !important;
    border-radius: 6px;
    box-shadow: none;
    font-size: 12px;
}

body:not(.dark-mode) .hbPlus-header .hbplus-quick-dashboard {
    background: rgba(125, 0, 0, .16) !important;
    border-color: rgba(255, 255, 255, .25) !important;
}

body:not(.dark-mode) .hbPlus-header .hbplus-quick-dashboard:hover,
body:not(.dark-mode) .hbPlus-header .hbplus-quick-navigation:hover {
    background: rgba(125, 0, 0, .25) !important;
}

.hbPlus-header .hbplus-navigation-label { font-size: 12px; }
.hbPlus-header .ansaldo-topbar-icon { font-size: 14px; color: #fff; }
.hbPlus-header .hbplus-navigation-chevron { display: none; }

body:not(.dark-mode) .hbPlus-header .hbplus-notification-button,
body:not(.dark-mode) .hbPlus-header .hbplus-profile-button {
    color: #fff;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

body:not(.dark-mode) .hbPlus-header .hbplus-profile-button {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .35);
}

body:not(.dark-mode) #hBplus-SearchPanelList .cleanedTextClass,
body:not(.dark-mode) #hBplus-SearchPanelList .hBplus-InsertName { color: #fff; }

.hbPlus-header button:focus-visible,
.hbPlus-header a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* The title, wrapped toolbar and pager must remain reachable on short screens. */
main:has(> .ansaldo-list-header) {
    height: calc(100dvh - var(--hb-shell-topbar-height, 56px));
    overflow-y: auto;
    min-width: 0;
    align-content: start;
}

.hBplus-ListHeader.ansaldo-list-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 4px 32px 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--ansaldo-line);
    border-radius: 24px 24px 0 0;
    box-shadow: none;
    overflow: visible;
}

.hBplus-ListHeader.ansaldo-list-header::before { display: none; }

.ansaldo-list-header > h5 {
    padding: 20px 32px;
    color: #142b49;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.4;
}

.ansaldo-list-header:has(.ansaldo-list-description) > h5 { padding-bottom: 2px; }

.ansaldo-list-description {
    margin: 0;
    padding: 0 32px 16px;
    color: #869bbd;
    font-size: 14px;
    line-height: 1.5;
}

.hBplus-ListHeader.ansaldo-list-header > .ansaldo-list-toolbar {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 14px 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

body:not(.dark-mode) .ansaldo-list-toolbar {
    background: #fbfbfd;
    border-top: 1px solid var(--ansaldo-line);
}

.ansaldo-list-search {
    flex: 1 1 260px;
    max-width: 420px;
    min-width: 180px;
    margin-right: auto;
}

.ansaldo-list-search #gridSearchToolbar { width: 100%; }

body:not(.dark-mode) .ansaldo-list-search #gridSearchPanel {
    min-height: 42px;
    background: #fff;
    border: 1px solid #dedede;
    border-radius: 4px;
    box-shadow: none;
}

body:not(.dark-mode) .ansaldo-list-search #gridSearchPanel input {
    min-height: 40px;
    padding-left: 38px;
    background: transparent;
    color: #425d82;
    font-size: 13px;
}

.ansaldo-list-search #gridSearchPanel .dx-placeholder::before { padding-left: 38px; }

.ansaldo-list-search #gridSearchToolbar::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 16px;
    width: 9px;
    height: 9px;
    border: 1px solid #70839d;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.ansaldo-list-search #gridSearchToolbar::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 25px;
    width: 5px;
    border-top: 1px solid #70839d;
    transform: rotate(45deg);
    pointer-events: none;
}

.hBplus-ListHeader.ansaldo-list-header .hbPlus-itemWrapper { flex-wrap: wrap; gap: 6px; padding: 0; }
.ansaldo-list-toolbar #hBplus-crudPartialViewID { min-width: 0; }

body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header .hbPlus-itemWrapper .dx-button,
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header [id^="export"] .dx-button,
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header [id^="export"].dx-button,
body:not(.dark-mode) .ansaldo-list-header .btn {
    height: 40px !important;
    min-height: 40px;
    border-radius: 8px !important;
    border-color: #d8e2f2 !important;
    background: #fff !important;
    color: #234977 !important;
    box-shadow: 0 1px 2px rgba(25, 47, 80, .05) !important;
    font-size: 12px;
}

body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header .dx-button .dx-icon { color: #7185a0 !important; font-size: 14px !important; }
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header .dx-button .dx-button-text { color: #234977 !important; font-size: 12px !important; }
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header #hBplus-BtnCreate.dx-button {
    background: var(--ansaldo-blue) !important;
    border-color: var(--ansaldo-blue) !important;
}
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header #hBplus-BtnCreate .dx-icon,
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header #hBplus-BtnCreate .dx-button-text { color: #fff !important; }
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header .hbPlus-itemWrapper .dx-button:hover { background: #edf3fd !important; }
body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header #hBplus-BtnCreate.dx-button:hover { background: #1c4ed4 !important; }

.hbPlus-gridPanelCon.ansaldo-list-grid {
    min-width: 0;
    margin: 0 32px 24px;
    padding: 22px 32px 0;
    background: #fff;
    border: 1px solid var(--ansaldo-line);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    box-shadow: none;
}

.ansaldo-list-grid #gridContainer { width: 100%; min-width: 0; height: auto; }
.ansaldo-list-grid .dx-datagrid-rowsview .dx-datagrid-table { height: auto; }
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid { background: #fff; color: #526f94; }
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid-headers {
    background: #fff;
    color: #46678f;
    border-radius: 8px 8px 0 0;
}
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid-headers,
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid-rowsview,
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid .dx-row-lines > td { border-color: var(--ansaldo-line); }
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid .dx-header-row > td {
    height: 64px;
    padding: 16px 18px;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    word-spacing: normal;
    vertical-align: middle;
}
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid .dx-data-row > td {
    height: 60px;
    padding: 16px 18px;
    font-size: 13px;
    word-spacing: normal;
    vertical-align: middle;
}
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid .dx-data-row.dx-state-hover > td,
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid .dx-data-row.dx-selection > td { background: #f4f4f4; }
body:not(.dark-mode) .ansaldo-list-grid .dx-datagrid-pager {
    background: #fff;
    border-top: 1px solid var(--ansaldo-line);
    padding: 16px 0;
    font-size: 12px;
}
.ansaldo-list-grid .dx-page-indexes .dx-page { border-radius: 8px; }

body.dark-mode .hBplus-ListHeader.ansaldo-list-header { background: #1b2537; border-color: #35445d; }
body.dark-mode .ansaldo-list-header > h5 { color: #e5edf9; }
body.dark-mode .hbPlus-gridPanelCon.ansaldo-list-grid { background: #1b2537; border-color: #35445d; }

@media (max-width: 1100px) {
    body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header { margin-inline: 16px; }
    body:not(.dark-mode) .hbPlus-gridPanelCon.ansaldo-list-grid { margin-inline: 16px; padding-inline: 20px; }
    .hBplus-ListHeader.ansaldo-list-header > .ansaldo-list-toolbar { padding-inline: 20px; }
    body:not(.dark-mode) .ansaldo-list-header > h5, .ansaldo-list-description { padding-inline: 20px; }
}

@media (max-width: 700px) {
    .hbPlus-header .hbplus-topbar-inner { gap: 8px; padding-inline: 12px; }
    body:not(.dark-mode) .hbPlus-header .hbplus-quick-dashboard,
    body:not(.dark-mode) .hbPlus-header .hbplus-quick-navigation { padding-inline: 8px; }
    .ansaldo-list-search { flex-basis: 100%; max-width: none; }
    .ansaldo-list-toolbar #hBplus-crudPartialViewID { flex: 1 1 100%; }
    body:not(.dark-mode) .hBplus-ListHeader.ansaldo-list-header { margin-inline: 8px; border-radius: 14px 14px 0 0; }
    body:not(.dark-mode) .hbPlus-gridPanelCon.ansaldo-list-grid { margin-inline: 8px; padding-inline: 12px; }
    .hBplus-ListHeader.ansaldo-list-header > .ansaldo-list-toolbar { padding-inline: 12px; }
    body:not(.dark-mode) .ansaldo-list-header > h5, .ansaldo-list-description { padding-inline: 12px; }
}
