/*
   Front-end standardization layer.
   Keep cross-screen layout, scroll and fullscreen fixes here to avoid per-view duplication.
*/

:root {
    --front-header-height: 66px;
    --front-sidebar-height: 68px;
    --front-content-gap: clamp(0.75rem, 1.4vw, 1.5rem);
    --front-scrollbar-size: 12px;
    --front-scrollbar-track: #eef2f7;
    --front-scrollbar-thumb: #9aa6b2;
    --front-scrollbar-thumb-hover: #687586;
    --front-main-table-height: clamp(320px, calc(100dvh - 280px), 680px);
    --front-main-table-height-mobile: clamp(280px, 58dvh, 520px);
}

html {
    min-width: 320px;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--front-scrollbar-thumb) var(--front-scrollbar-track);
}

body {
    min-width: 320px;
    overflow-x: clip;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--front-scrollbar-thumb) var(--front-scrollbar-track);
}

*::-webkit-scrollbar {
    width: var(--front-scrollbar-size);
    height: var(--front-scrollbar-size);
}

*::-webkit-scrollbar-track {
    background: var(--front-scrollbar-track);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--front-scrollbar-thumb);
    border: 3px solid var(--front-scrollbar-track);
    border-radius: 999px;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--front-scrollbar-thumb-hover);
}

.main-wrapper,
.page-wrapper,
.page-wrapper.content {
    max-width: 100%;
}

.page-wrapper.content.container-fluid {
    width: 100%;
    padding-right: var(--front-content-gap);
    padding-left: var(--front-content-gap);
    padding-bottom: var(--front-content-gap);
}

[data-layout-style=horizontal] .page-wrapper.content.container-fluid {
    padding-top: calc(var(--front-header-height) + var(--front-sidebar-height) + var(--front-content-gap)) !important;
}

.page-wrapper .content,
main.content,
.content {
    max-width: 100%;
}

.page-header {
    gap: 0.75rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: var(--front-content-gap);
}

.page-header .page-title {
    min-width: min(100%, 18rem);
}

.page-header .page-title h4,
.page-header .page-title h5,
.page-header .page-title h6 {
    overflow-wrap: anywhere;
}

.page-header .page-btn,
.page-header .btn-added,
.page-header .page-btn .btn,
.card-header .btn,
.card-header .form-select,
.card-header .form-control {
    flex-shrink: 0;
}

.card {
    max-width: 100%;
}

.card > .card-header {
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card > .card-body {
    min-width: 0;
}

.row {
    --bs-gutter-x: clamp(0.75rem, 1.4vw, 1.5rem);
}

.form-control,
.form-select,
.select2-container,
.multiselect {
    max-width: 100%;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.table-responsive[style*="max-height"],
.table-responsive[style*="min-height"],
.table-responsive.front-main-table--local-scroll {
    overflow-y: auto;
}

.front-main-table {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    overscroll-behavior: contain;
}

.front-main-table--local-scroll {
    max-height: var(--front-main-table-height);
    overflow-y: auto;
}

.table-responsive[style*="max-height"] > table,
.table-responsive[style*="min-height"] > table,
.front-main-table--local-scroll > table,
.front-main-table--local-scroll .dataTable {
    border-collapse: separate;
    border-spacing: 0;
}

.table-responsive[style*="max-height"] > table > thead,
.table-responsive[style*="min-height"] > table > thead,
.front-main-table--local-scroll > table > thead,
.front-main-table--local-scroll .dataTable > thead {
    position: sticky;
    top: 0;
    z-index: 9;
    background: #f8fafc;
}

.table-responsive[style*="max-height"] > table > thead > tr,
.table-responsive[style*="min-height"] > table > thead > tr,
.front-main-table--local-scroll > table > thead > tr,
.front-main-table--local-scroll .dataTable > thead > tr {
    position: relative;
    z-index: 9;
    background: #f8fafc;
}

.table-responsive[style*="max-height"] > table > thead > tr > th,
.table-responsive[style*="max-height"] > table > thead > tr > td,
.table-responsive[style*="min-height"] > table > thead > tr > th,
.table-responsive[style*="min-height"] > table > thead > tr > td,
.front-main-table--local-scroll > table > thead > tr > th,
.front-main-table--local-scroll > table > thead > tr > td,
.front-main-table--local-scroll .dataTable > thead > tr > th,
.front-main-table--local-scroll .dataTable > thead > tr > td {
    --bs-table-bg: #f8fafc !important;
    --bs-table-accent-bg: #f8fafc !important;
    --bs-table-striped-bg: #f8fafc !important;
    --bs-table-hover-bg: #f8fafc !important;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
    background-color: #f8fafc !important;
    background-clip: padding-box;
}

.table-responsive[style*="max-height"] > table > thead > tr > th,
.table-responsive[style*="max-height"] > table > thead > tr > td,
.table-responsive[style*="max-height"] > table > tbody > tr > th,
.table-responsive[style*="max-height"] > table > tbody > tr > td,
.table-responsive[style*="min-height"] > table > thead > tr > th,
.table-responsive[style*="min-height"] > table > thead > tr > td,
.table-responsive[style*="min-height"] > table > tbody > tr > th,
.table-responsive[style*="min-height"] > table > tbody > tr > td,
.front-main-table--local-scroll > table > thead > tr > th,
.front-main-table--local-scroll > table > thead > tr > td,
.front-main-table--local-scroll > table > tbody > tr > th,
.front-main-table--local-scroll > table > tbody > tr > td,
.front-main-table--local-scroll .dataTable > thead > tr > th,
.front-main-table--local-scroll .dataTable > thead > tr > td,
.front-main-table--local-scroll .dataTable > tbody > tr > th,
.front-main-table--local-scroll .dataTable > tbody > tr > td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.front-main-table--page-scroll {
    overflow-y: visible;
}

.table-responsive.card {
    display: block;
    padding: 0;
}

.table-responsive > .table,
.dataTables_wrapper,
.dataTables_scroll,
.dataTables_scrollHead,
.dataTables_scrollBody {
    max-width: 100%;
}

.table {
    margin-bottom: 0;
}

.table th,
.table td {
    vertical-align: middle;
}

.front-main-table > table > thead > tr > th,
.front-main-table > table > thead > tr > td,
.front-main-table .dataTable > thead > tr > th,
.front-main-table .dataTable > thead > tr > td {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 42px;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    border-bottom: 0;
    background: #f8fafc;
    background-clip: padding-box;
    color: #1f2937;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.25;
    vertical-align: middle;
    box-shadow: inset 0 -1px 0 #d7dde5, 0 2px 0 #f8fafc;
}

.front-main-table > table > thead > tr > th:first-child,
.front-main-table > table > thead > tr > td:first-child,
.front-main-table .dataTable > thead > tr > th:first-child,
.front-main-table .dataTable > thead > tr > td:first-child {
    border-top-left-radius: 6px;
}

.front-main-table > table > thead > tr > th:last-child,
.front-main-table > table > thead > tr > td:last-child,
.front-main-table .dataTable > thead > tr > th:last-child,
.front-main-table .dataTable > thead > tr > td:last-child {
    border-top-right-radius: 6px;
}

.front-main-table--page-scroll > table > thead > tr > th,
.front-main-table--page-scroll > table > thead > tr > td,
.front-main-table--page-scroll .dataTable > thead > tr > th,
.front-main-table--page-scroll .dataTable > thead > tr > td {
    top: var(--front-sticky-table-top, 0);
}

[data-layout-style=horizontal] .front-main-table--page-scroll {
    --front-sticky-table-top: calc(var(--front-header-height) + var(--front-sidebar-height));
}

@media (min-width: 992px) {
    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar {
        top: var(--front-header-height);
        height: var(--front-sidebar-height);
        overflow: visible;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu {
        max-width: 100%;
        overflow: visible;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        max-width: 100%;
        overflow: visible;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav > li {
        flex: 0 0 auto;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav > li > a {
        height: var(--front-sidebar-height);
        white-space: nowrap;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav > li > a span {
        white-space: nowrap;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav > li ul {
        z-index: 1050;
    }
}

html.front-menu-force-mobile[data-layout-style=horizontal] .header .mobile_btn {
    color: #0C4DA2;
    display: block !important;
    font-size: 24px;
    height: 60px;
    left: 0;
    line-height: 60px;
    padding: 0 20px;
    position: absolute;
    top: 0;
    width: 60px;
    z-index: 10;
}

html.front-menu-force-mobile[data-layout-style=horizontal] .header .header-left.active {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0 72px 0 60px;
}

html.front-menu-force-mobile[data-layout-style=horizontal] .header .header-left.active .logo {
    width: auto;
}

html.front-menu-force-mobile[data-layout-style=horizontal] .header .header-left.active .logo img {
    width: 132px;
    max-width: 132px;
}

html.front-menu-force-mobile[data-layout-style=horizontal] .posicao-empresa-header-shortcut {
    flex: 0 0 34px;
    margin-left: 0;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar {
    display: flex !important;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 340px;
    max-width: 86vw;
    height: calc(100dvh - 60px);
    margin-left: -100%;
    z-index: 1041;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #dbe0e6;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

html.front-menu-force-mobile[data-layout-style=horizontal] .main-wrapper.slide-nav #sidebar.sidebar.horizontal-sidebar {
    margin-left: 0;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu {
    width: 100%;
    padding: 12px;
    overflow-y: auto;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav {
    display: block;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
    overflow: visible;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li {
    display: block;
    width: 100%;
    margin: 0 0 4px;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li > a {
    display: flex;
    align-items: center;
    width: 100%;
    height: auto;
    padding: 12px 14px !important;
    border-radius: 8px;
    white-space: normal;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li .menu-arrow {
    margin-left: auto;
    transform: rotate(0deg);
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li > a.subdrop .menu-arrow {
    transform: rotate(90deg);
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li ul {
    position: static;
    width: 100%;
    height: auto;
    box-shadow: none;
    background: #f8fafc;
    margin: 0;
    padding: 4px 0;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li ul li a {
    padding: 9px 14px 9px 32px !important;
    white-space: normal;
}

html.front-menu-force-mobile[data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li ul li.submenu ul li a {
    padding-left: 44px !important;
}

html.front-menu-force-mobile[data-layout-style=horizontal] .page-wrapper.content.container-fluid {
    padding-top: calc(var(--front-header-height) + 0.75rem) !important;
}

html.front-menu-force-mobile[data-layout-style=horizontal] .front-main-table--page-scroll {
    --front-sticky-table-top: var(--front-header-height);
}

body.is-fullscreen .front-main-table--page-scroll,
html.is-fullscreen .front-main-table--page-scroll {
    --front-sticky-table-top: 0;
}

.table-layout-auto .table,
.table.table-responsive {
    display: table;
    width: 100%;
}

.front-split-table-shell {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: auto;
}

.front-split-table-grid {
    min-width: var(--front-split-table-min-width, 100%);
}

.front-split-table-header-scroll,
.front-split-table-body-scroll {
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.front-split-table-header-scroll {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow-y: hidden;
}

.front-split-table-body-scroll {
    max-height: var(--front-split-table-max-height, 60vh);
    min-height: var(--front-split-table-min-height, 40vh);
    overflow-y: auto;
    overflow-x: hidden;
}

.front-split-table {
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.front-split-table th,
.front-split-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.front-split-table-header-table {
    margin-bottom: 0;
}

.front-split-table-header-table th {
    line-height: 1.462;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.dataTables_wrapper {
    width: 100%;
    overflow: visible;
}

.dataTables_wrapper .row {
    row-gap: 0.75rem;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    min-width: 0;
}

.dataTables_wrapper .dataTables_filter {
    text-align: end;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0;
    max-width: 100%;
}

.dataTables_wrapper .dataTables_filter input {
    max-width: min(100%, 18rem);
}

.dataTables_wrapper .pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
}

.modal-dialog {
    max-width: min(var(--bs-modal-width), calc(100vw - 1.5rem));
    margin-right: auto;
    margin-left: auto;
}

.modal-xl {
    --bs-modal-width: min(1140px, calc(100vw - 1.5rem));
}

.modal-content {
    max-height: calc(100dvh - 1.5rem);
}

.modal-body {
    min-height: 0;
}

.modal-dialog-scrollable .modal-content {
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.card.card-fullscreen {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    border-radius: 0;
}

.card.card-fullscreen > .card-header {
    flex: 0 0 auto;
}

.card.card-fullscreen > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.card.card-fullscreen .table-responsive {
    max-height: none !important;
}

.card.card-fullscreen .front-main-table--local-scroll {
    max-height: calc(100dvh - 8rem) !important;
}

html.is-fullscreen,
html.is-fullscreen body {
    width: 100%;
    min-height: 100%;
}

html.is-fullscreen .main-wrapper {
    min-height: 100dvh;
}

html.is-fullscreen .page-wrapper.content.container-fluid {
    min-height: calc(100dvh - var(--front-header-height));
}

html.is-fullscreen .dataTables_wrapper {
    min-width: 0;
}

@media (max-width: 1199.98px) {
    .page-wrapper.content.container-fluid {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .table th,
    .table td {
        padding: 0.55rem 0.5rem;
    }

    [data-layout-style=horizontal] .front-main-table--page-scroll {
        --front-sticky-table-top: calc(var(--front-header-height) + var(--front-sidebar-height));
    }
}

@media (max-width: 991.98px) {
    .page-wrapper.content.container-fluid {
        padding-top: calc(var(--front-header-height) + 0.75rem) !important;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar {
        display: flex !important;
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 340px;
        max-width: 86vw;
        height: calc(100dvh - 60px);
        margin-left: -100%;
        z-index: 1041;
        overflow-x: hidden;
        overflow-y: auto;
        background: #fff;
        border-right: 1px solid #dbe0e6;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    }

    [data-layout-style=horizontal] .main-wrapper.slide-nav #sidebar.sidebar.horizontal-sidebar {
        margin-left: 0;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu {
        width: 100%;
        padding: 12px;
        overflow-y: auto;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul.nav {
        display: block;
        flex-wrap: nowrap;
        margin: 0;
        padding: 0;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li {
        display: block;
        width: 100%;
        margin: 0 0 4px;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li > a {
        display: flex;
        align-items: center;
        width: 100%;
        height: auto;
        padding: 12px 14px !important;
        border-radius: 8px;
        white-space: normal;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li .menu-arrow {
        margin-left: auto;
        transform: rotate(0deg);
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li > a.subdrop .menu-arrow {
        transform: rotate(90deg);
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li ul {
        position: static;
        width: 100%;
        height: auto;
        box-shadow: none;
        background: #f8fafc;
        margin: 0;
        padding: 4px 0;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li ul li a {
        padding: 9px 14px 9px 32px !important;
        white-space: normal;
    }

    [data-layout-style=horizontal] #sidebar.sidebar.horizontal-sidebar .sidebar-menu > ul > li ul li.submenu ul li a {
        padding-left: 44px !important;
    }

    [data-layout-style=horizontal] .front-main-table--page-scroll {
        --front-sticky-table-top: var(--front-header-height);
    }

    .card.p-4,
    .card-body {
        padding: 1rem !important;
    }

    .card-header.d-flex,
    .page-header {
        align-items: stretch;
    }

    .card-header [class*="col-"],
    .page-header [class*="col-"] {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .page-wrapper.content.container-fluid {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .page-header,
    .card > .card-header {
        flex-direction: column;
    }

    .btn,
    .form-control,
    .form-select {
        min-height: 38px;
    }

    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: start;
    }

    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_length label,
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
    }

    .front-main-table--local-scroll {
        max-height: var(--front-main-table-height-mobile);
    }

    .modal-dialog {
        max-width: calc(100vw - 0.75rem);
        margin-top: 0.375rem;
        margin-bottom: 0.375rem;
    }

    .modal-content {
        max-height: calc(100dvh - 0.75rem);
    }
}

@media (min-width: 1600px) {
    .page-wrapper.content.container-fluid {
        padding-right: clamp(1.5rem, 2vw, 2.25rem);
        padding-left: clamp(1.5rem, 2vw, 2.25rem);
    }
}
