/*
 * Shared portal geometry.
 * Enterprise is the reference density for the portal design system.
 * Keep colors, font families and other visual identity in themes/*.css.
 */

.portal-theme {
    --portal-radius-sm: 3px;
    --portal-radius: 5px;
    min-height: 100vh;
    padding-top: 84px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Use the viewport for data. Nested Bootstrap rows retain their own gutters,
   while the master page contributes only a narrow, predictable outer edge. */
.portal-theme .portal-content-shell {
    padding-right: 0.25rem;
    padding-left: 0.25rem;
}

.portal-theme h1 {
    font-size: clamp(1.65rem, 2vw, 2rem);
}

.portal-theme h2 {
    font-size: clamp(1.3rem, 1.6vw, 1.55rem);
}

.portal-theme h3 {
    font-size: 1.15rem;
}

/* Dark institutional application bar */
.portal-theme .portal-navbar {
    min-height: 68px;
    padding: 0.55rem 0.75rem;
    border-bottom-width: 3px;
    border-bottom-style: solid;
}

.portal-theme .portal-navbar > .container-fluid {
    padding: 0;
}

.portal-theme .portal-navbar .navbar-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    margin-right: 2rem;
    font-size: 0.94rem;
    white-space: normal;
}

.portal-theme .portal-navbar .portal-logo-surface {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    margin-right: 0.5rem;
}

.portal-theme .portal-navbar .portal-logo-surface img {
    display: block;
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    padding: 0;
    border: 0;
    object-fit: contain;
    filter: none;
}

.portal-theme .portal-navbar .portal-logo-surface--plate {
    width: 224px;
    max-width: 252px;
    height: 48px;
    padding: 8px 18px 8px 16px;
    border-width: 1px 1px 1px 4px;
    border-style: solid;
    border-radius: 7px;
}

.portal-theme .portal-navbar .portal-logo-surface--plate img {
    max-height: 31px;
}

.portal-theme .portal-navbar .portal-logo-surface--direct {
    max-width: 252px;
    height: 40px;
}

.portal-theme .portal-navbar .portal-logo-surface--direct img {
    max-height: 40px;
}

.portal-theme .portal-navbar .portal-brand-context {
    display: inline-flex;
    align-items: baseline;
    min-width: 0;
    padding-left: 0.9rem;
    border-left-width: 1px;
    border-left-style: solid;
    line-height: 1.25;
    white-space: nowrap;
}

.portal-theme .portal-navbar .portal-customer-name {
    display: inline-block;
    max-width: clamp(10rem, 18vw, 25rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.portal-theme .portal-navbar .navbar-toggler {
    padding: 0.4rem 0.55rem;
    border-width: 1px;
    border-style: solid;
    border-radius: var(--portal-radius-sm);
}

.portal-theme .portal-navbar .top-menu > .navbar-nav {
    align-items: center;
    gap: 0;
}

.portal-theme .portal-navbar .top-menu > .navbar-nav > .navbarMenuItem > a {
    position: relative;
    padding: 0.75rem 0.7rem;
    font-size: 0.875rem;
    border-radius: 0;
}

.portal-theme .portal-navbar .top-menu > .navbar-nav > .navbarMenuItem > a.active::after {
    position: absolute;
    right: 0.7rem;
    bottom: -0.58rem;
    left: 0.7rem;
    height: 3px;
    content: "";
}

.portal-theme .portal-navbar .extra-space-menu {
    margin-right: 0.15rem;
    margin-left: 0.5rem;
    padding-left: 0.35rem;
    border-left-width: 1px;
    border-left-style: solid;
}

/* Work surfaces: crisp hierarchy, minimal decoration */
.portal-theme .card {
    border-width: 1px;
    border-style: solid;
    border-radius: var(--portal-radius);
}

.portal-theme .card > .card-header:first-child {
    border-top-left-radius: calc(var(--portal-radius) - 1px);
    border-top-right-radius: calc(var(--portal-radius) - 1px);
}

.portal-theme .card-header {
    min-height: 3rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.portal-theme hr {
    margin-top: 2rem;
}

.portal-theme footer {
    padding: 0.2rem 0 0.75rem;
}

.portal-theme .alert {
    border-width: 1px 1px 1px 4px;
    border-radius: var(--portal-radius-sm);
}

.portal-theme .badge {
    border-radius: 2px;
}

/* Organization tree */
.portal-theme .dxbs-tree .nav-link {
    margin-bottom: 1px;
    padding: 0.42rem 0.55rem;
    border-left-width: 3px;
    border-left-style: solid;
    border-radius: 0;
}

/* Controls and actions */
.portal-theme .form-label,
.portal-theme .dxbs-fl-cpt {
    font-size: 0.875rem;
}

.portal-theme .form-control,
.portal-theme .form-select,
.portal-theme .dxbs-edit,
.portal-theme select {
    min-height: 2.35rem;
    border-radius: var(--portal-radius-sm);
}

.portal-theme .btn {
    min-height: 2.35rem;
    padding: 0.42rem 0.85rem;
    font-size: 0.9rem;
    border-radius: var(--portal-radius-sm);
}

/* DevExpress renders link-style buttons for customer links, tree actions and
   compact grid commands. Keep them in the Enterprise palette instead of the
   brighter Bootstrap default blue. */
.portal-theme .dropdown-menu {
    padding: 0.35rem;
    border-radius: var(--portal-radius);
}

.portal-theme .dropdown-item {
    padding: 0.5rem 0.65rem;
    border-radius: 2px;
}

/* DevExpress form layouts: generous enough for data entry, but with a clearer
   section hierarchy than the default grey-on-grey cards. */
.portal-theme .dxbs-fl > .dxbs-fl-gr {
    --bs-gutter-y: 1rem;
}

.portal-theme .dxbs-fl .dxbs-fl-gd > .card {
    overflow: visible;
}

.portal-theme .dxbs-fl .dxbs-fl-gd > .card > .card-header {
    min-height: 2.65rem;
    padding: 0.58rem 0.9rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.portal-theme .dxbs-fl .dxbs-fl-gd > .card > .row {
    margin-right: 0;
    margin-left: 0;
    padding: 0.7rem 0.55rem 0.85rem;
}

.portal-theme .dxbs-fl .dxbs-form-group {
    margin-bottom: 0.7rem;
}

.portal-theme .dxbs-fl .dxbs-fl-cpt {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.825rem;
}

/* DevExpress calculates one fixed caption width per horizontal FormLayout and
   otherwise truncates longer customer-defined captions with an ellipsis. Keep
   the compact horizontal layout on desktop, but reserve a useful minimum and
   allow captions to wrap instead of hiding their meaning. Below 992px the
   DevExpress vertical layout remains unchanged. */
@media (min-width: 992px) {
    .portal-theme .dxbs-fl.form-horizontal .dxbs-form-group {
        align-items: flex-start;
    }

    .portal-theme .dxbs-fl.form-horizontal:not(.dxbs-fl-calc) .dxbs-form-group > .dxbs-fl-cpt {
        flex: 0 0 13rem !important;
        width: 13rem !important;
        min-width: 13rem;
        max-width: 13rem;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }

    .portal-theme .dxbs-fl.form-horizontal:not(.dxbs-fl-calc) .dxbs-form-group > .dxbs-fl-ctrl:not(img) {
        flex: 1 1 0 !important;
        width: auto !important;
        min-width: 0;
    }
}

.portal-theme .dxbs-fl .form-control,
.portal-theme .dxbs-fl .dxbs-edit,
.portal-theme .dxbs-fl .dxbs-dropdown-edit {
    font-size: 0.875rem;
}

.portal-theme .dxbs-fl input.form-control,
.portal-theme .dxbs-fl .dxbs-dropdown-edit input.form-control {
    min-height: 2.25rem;
    height: 2.25rem;
}

.portal-theme .dxbs-fl textarea.form-control {
    min-height: 8rem;
    padding: 0.65rem 0.75rem;
    line-height: 1.5;
    resize: vertical;
}

.portal-theme .dxbs-fl .dxbs-edit-btn.btn-secondary {
    min-width: 2.35rem;
    min-height: 2.25rem;
    height: 2.25rem;
    padding: 0.3rem 0.55rem;
}

.portal-theme .dxbs-fl .form-text {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.portal-theme .dxbs-fl .dxbs-cbl.form-control-plaintext {
    min-height: auto;
    padding: 0;
}

.portal-theme .dxbs-fl .dxbs-cbl .form-check {
    min-height: 1.55rem;
    margin-bottom: 0.18rem;
}

.portal-theme .dxbs-fl .form-check-input {
    margin-top: 0.2em;
}

.portal-theme .dxbs-fl .form-check-label {
    font-size: 0.875rem;
    line-height: 1.45;
}

.portal-theme .enterprise-form-section-help {
    margin-bottom: 0.65rem;
    font-size: 0.8125rem;
}

.portal-theme .enterprise-preview-intro {
    max-width: 62rem;
}

.portal-theme .enterprise-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top-width: 1px;
    border-top-style: solid;
}

/* Data grids are the primary enterprise work surface. DevExpress 26 uses
   .dxbs-gridview; .dxbs-grid is retained for compatibility with older output. */
.portal-theme :is(.dxbs-grid, .dxbs-gridview) {
    overflow: visible;
    border-width: 1px !important;
    border-style: solid !important;
    border-radius: var(--portal-radius);
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) > .card {
    border: 0;
    border-radius: inherit;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-search-panel {
    display: flex;
    justify-content: flex-end;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) > .card > .card-body:first-child {
    padding: 0.65rem 0.8rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-search-panel .dxbs-button-edit {
    width: min(100%, 28rem);
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-search-panel .form-control {
    min-height: 2.15rem;
    padding-right: 2.25rem;
    font-size: 0.875rem;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .table {
    margin-bottom: 0;
    border-right: 0;
    border-left: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .table > :not(caption) > * > * {
    vertical-align: middle;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .table thead th {
    font-size: 0.875rem;
    line-height: 1.3;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .table thead .btn-link {
    min-width: 1.75rem;
    min-height: 1.75rem;
    padding: 0.2rem;
}

.portal-theme .dxbs-table > thead > tr:not(:first-child):not(.dxbs-filter-row) > th .btn-link {
    min-height: auto;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-cmd-cell {
    text-align: center;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-cmd-cb {
    margin: 0;
}

/* Compact, calm pager with a clear current page. */
.portal-theme :is(.dxbs-grid, .dxbs-gridview) > .card > .card-body:last-child {
    padding: 0.65rem 0.8rem;
    border-top-width: 1px;
    border-top-style: solid;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.75rem;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-pager .summary {
    margin: 0;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-pager .form-control-plaintext {
    min-height: auto;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 2rem;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .pagination {
    gap: 0.2rem;
    margin: 0;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0.25rem 0.55rem;
    border-width: 1px;
    border-style: solid;
    font-size: 0.8125rem;
    border-radius: var(--portal-radius-sm) !important;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size {
    align-items: center;
    gap: 0.45rem;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size .col-form-label {
    padding: 0;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size .input-group {
    width: 5.25rem;
    flex-wrap: nowrap;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size .form-control,
.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size .btn {
    min-height: 2rem;
    height: 2rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    font-size: 0.8125rem;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size .form-control {
    width: 3.25rem;
    min-width: 0;
    flex: 0 0 3.25rem;
    padding-right: 0.3rem;
    padding-left: 0.5rem;
}

.portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size .btn {
    width: 2rem;
    flex: 0 0 2rem;
    padding-right: 0;
    padding-left: 0;
}

/* Grid toolbars and row actions */
.portal-theme .enterprise-grid-toolbar,
.portal-theme .card-header:has(.dxbs-toolbar-adaptive) {
    padding: 0.35rem 0.45rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.portal-theme .dxbs-toolbar-adaptive .btn {
    min-height: 2.1rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

/* TagBox selections use the same calm accent treatment as other inputs. */
.portal-theme .enterprise-grid-action {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    padding: 0.15rem 0.38rem;
    font-size: 0.8125rem;
}

/* Semantic statuses: color supports scanning, text carries the meaning. */
.portal-theme .portal-status {
    display: inline-flex;
    min-height: 1.55rem;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-width: 1px;
    border-style: solid;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
    border-radius: 999px;
}

/* Isolated preview page used to verify real DevExpress rendering. */
.portal-theme .enterprise-preview-page {
    max-width: 1760px;
    margin: 0 auto;
}

.portal-theme .enterprise-preview-kicker {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.72rem;
}

.portal-theme .enterprise-grid-shell {
    overflow: visible;
    border-width: 1px;
    border-style: solid;
    border-top-width: 3px;
    border-top-style: solid;
    border-radius: var(--portal-radius);
}

.portal-theme .enterprise-grid-titlebar {
    display: flex;
    min-height: 4rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.portal-theme .enterprise-grid-meta {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.8125rem;
}

.portal-theme .enterprise-grid-shell > :is(.dxbs-grid, .dxbs-gridview) {
    border: 0 !important;
    border-radius: 0 0 var(--portal-radius) var(--portal-radius);
}

/* File archive: separate navigation, path and document list clearly while
   preserving the same compact grid language used elsewhere in the portal. */
.portal-theme .dxbs-file-manager {
    border-width: 1px;
    border-style: solid;
    border-radius: var(--portal-radius);
}

.portal-theme .dxbs-file-manager .dxbs-fm-toolbar {
    padding: 0.4rem 0.5rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
}

.portal-theme .dxbs-file-manager .dxbs-fm-toolbar .btn {
    min-height: 2.1rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.portal-theme .dxbs-file-manager .dxbs-fm-breadcrumb {
    padding: 0.45rem 0.65rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    font-size: 0.8125rem;
}

.portal-theme .dxbs-file-manager .dxbs-folder-container {
    border-right-width: 1px;
    border-right-style: solid;
}

.portal-theme .dxbs-file-manager .dxbs-tree .nav-link {
    font-size: 0.8375rem;
}

.portal-theme .dxbs-file-manager .dxbs-file-container:not(.dxbs-details-container) {
    padding: 0.65rem;
}

.portal-theme .dxbs-file-manager .dxbs-fm-item {
    border-width: 1px;
    border-style: solid;
    border-radius: var(--portal-radius-sm);
}

.portal-theme .dxbs-file-manager .dxbs-fm-upload-panel {
    padding: 0.55rem 0.65rem;
    border-top-width: 1px;
    border-top-style: solid;
}

.portal-theme .dxbs-uc .progress {
    height: 0.5rem;
    border-radius: 2px;
}

.portal-theme .popover,
.portal-theme .modal-content,
.portal-theme .dxbs-popup {
    border-radius: var(--portal-radius);
}

/* Dialogs */
/* Public front page: a graphic, ownable surface without stock-image dependency */
.portal-theme .jumbotron {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 420px;
    padding: clamp(5rem, 10vw, 8rem) clamp(2rem, 6vw, 6rem);
    border-width: 1px;
    border-style: solid;
    border-radius: var(--portal-radius);
}

.portal-theme .jumbotron .container {
    max-width: 760px;
    margin-left: 0;
    padding: 0;
}

.portal-theme .jumbotron h1 {
    max-width: 720px;
    margin-bottom: 1rem;
    font-size: clamp(2.25rem, 4.2vw, 3.75rem);
}

.portal-theme .jumbotron p {
    max-width: 650px;
    margin-bottom: 0;
    font-size: clamp(1rem, 1.45vw, 1.2rem);
    line-height: 1.65;
}

.portal-theme .jumbotron::before {
    position: absolute;
    z-index: -1;
    top: -45%;
    right: -8%;
    width: 48%;
    aspect-ratio: 1;
    content: "";
    border-width: 1px;
    border-style: solid;
    border-radius: 50%;
}

.portal-theme .jumbotron::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 9rem;
    height: 5px;
    content: "";
}

@media (min-width: 992px) and (max-width: 1399.98px) {
    .portal-theme .portal-navbar .portal-customer-name {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .portal-theme {
        padding-top: 76px;
    }

    .portal-theme .portal-navbar {
        min-height: 62px;
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }

    .portal-theme .portal-navbar .navbar-brand {
        max-width: calc(100% - 3.5rem);
        font-size: 0.9rem;
    }

    .portal-theme .portal-navbar .navbar-toggler {
        display: block !important;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .portal-theme .portal-navbar .navbar-brand .portal-logo-surface.d-none {
        display: inline-flex !important;
    }

    .portal-theme .portal-navbar .portal-logo-surface {
        max-width: min(58vw, 210px);
    }

    .portal-theme .portal-navbar .portal-logo-surface--plate {
        width: 210px;
        height: 42px;
        padding: 6px 12px 6px 10px;
    }

    .portal-theme .portal-navbar .portal-logo-surface--plate img {
        max-height: 28px;
    }

    .portal-theme .portal-navbar .portal-logo-surface--direct,
    .portal-theme .portal-navbar .portal-logo-surface--direct img {
        max-height: 32px;
    }

    .portal-theme .portal-navbar .portal-brand-context {
        display: none;
    }

    .portal-theme .portal-navbar .navbar-collapse {
        margin-top: 0.55rem;
        padding: 0.4rem;
        border-width: 1px;
        border-style: solid;
        border-radius: var(--portal-radius);
    }

    .portal-theme .portal-navbar .top-menu {
        position: static;
        width: 100%;
        margin: 0 !important;
    }

    .portal-theme .portal-navbar .top-menu > .navbar-nav {
        align-items: stretch;
    }

    .portal-theme .portal-navbar .top-menu > .navbar-nav > .navbarMenuItem > a {
        display: flex;
        width: 100%;
        padding: 0.7rem 0.75rem;
    }

    .portal-theme .portal-navbar .extra-space-menu {
        margin: 0.25rem 0 0;
        padding-top: 0.25rem;
        padding-left: 0;
        border-top-width: 1px;
        border-top-style: solid;
        border-left: 0;
    }

    .portal-theme .portal-navbar .top-menu > .navbar-nav > .navbarMenuItem > a.active::after {
        top: 0.4rem;
        right: auto;
        bottom: 0.4rem;
        left: 0;
        width: 3px;
        height: auto;
    }

}

@media (max-width: 767.98px) {
    .portal-theme .jumbotron {
        min-height: 360px;
        padding: 4rem 1.5rem;
    }

    .portal-theme .jumbotron h1 {
        font-size: clamp(2rem, 10vw, 2.75rem);
    }

    .portal-theme :is(.dxbs-grid, .dxbs-gridview) .dxbs-pager {
        align-items: flex-start;
    }

    .portal-theme :is(.dxbs-grid, .dxbs-gridview) .page-size {
        width: 100%;
        margin-left: 0 !important;
    }

}

@media (prefers-reduced-motion: reduce) {
    .portal-theme *,
    .portal-theme *::before,
    .portal-theme *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

}
