/* ============================================================================
   GESTAO DE ESTOQUE LABS - USER STYLES CONSOLIDADO
   PHPMaker 2025 / Bootstrap 5
   Substitui integralmente o conteudo atual de User Styles
   ============================================================================ */

/* --------------------------------------------------------------------------
   1. TOKENS VISUAIS
   -------------------------------------------------------------------------- */

:root,
[data-bs-theme="light"] {
    --labs-navy: #31509f;
    --labs-blue: #2864ad;
    --labs-sky: #1388c7;
    --labs-cyan: #0795d2;
    --labs-dark: #243f84;
    --labs-hover: #1f579d;
    --labs-soft: #edf5fc;
    --labs-soft-strong: #dcecf9;
    --labs-focus: rgba(19, 136, 199, 0.18);

    --labs-sidebar: #20262c;
    --labs-sidebar-deep: #1b2127;
    --labs-sidebar-hover: #29333d;

    --labs-page-bg: #f4f6f8;
    --labs-card-bg: #ffffff;
    --labs-text: #172033;
    --labs-text-soft: #64748b;
    --labs-label: #334155;
    --labs-border: #d8e2ec;
    --labs-border-soft: #e8edf2;

    --labs-radius: 10px;
    --labs-card-radius: 14px;
    --labs-shadow: 0 2px 5px rgba(15, 23, 42, 0.03),
                   0 10px 25px rgba(15, 23, 42, 0.04);

    --bs-primary: #2864ad;
    --bs-primary-rgb: 40, 100, 173;
    --bs-link-color: #2864ad;
    --bs-link-hover-color: #243f84;
    --bs-focus-ring-color: rgba(19, 136, 199, 0.18);
}

/* --------------------------------------------------------------------------
   2. ESTRUTURA GERAL DA PAGINA
   -------------------------------------------------------------------------- */

.content-wrapper {
    background-color: var(--labs-page-bg);
}

.content {
    padding-top: 12px;
}

.content-header {
    padding-bottom: 12px;
}

.content-header h1,
.ew-page-heading h1 {
    margin: 0;
    color: var(--labs-text);
    font-size: clamp(1.55rem, 2vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.025em;
}

.content-header h1 small,
.ew-page-heading h1 small {
    color: var(--labs-text-soft);
    font-size: 0.55em;
    font-weight: 600;
    letter-spacing: 0;
}

.content-header .breadcrumb {
    color: var(--labs-text-soft);
    font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   3. BARRA SUPERIOR
   -------------------------------------------------------------------------- */

.main-header,
.main-header.navbar,
.navbar-primary,
.layout-navbar-fixed .wrapper .main-header {
    background: linear-gradient(
        105deg,
        var(--labs-navy) 0%,
        var(--labs-blue) 52%,
        var(--labs-sky) 100%
    ) !important;
    border-bottom: 0 !important;
    box-shadow: 0 2px 10px rgba(29, 66, 130, 0.20);
}

.main-header .nav-link,
.main-header .navbar-nav .nav-link,
.main-header .navbar-brand,
.main-header .dropdown-toggle,
.main-header i,
.main-header svg {
    color: rgba(255, 255, 255, 0.94) !important;
}

.main-header .nav-link:hover,
.main-header .navbar-nav .nav-link:hover,
.main-header .dropdown-toggle:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.10) !important;
    border-radius: 7px;
}

.main-header .show > .nav-link,
.main-header .nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.16) !important;
    border-radius: 7px;
}

.main-header .dropdown-menu {
    background: #fff;
    border: 1px solid var(--labs-border);
    border-radius: 9px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.main-header .dropdown-menu .dropdown-item,
.main-header .dropdown-menu .dropdown-item i {
    color: var(--labs-text) !important;
}

.main-header .dropdown-menu .dropdown-item:hover {
    color: var(--labs-dark) !important;
    background: var(--labs-soft) !important;
}

/* --------------------------------------------------------------------------
   4. MENU LATERAL
   -------------------------------------------------------------------------- */

.main-sidebar,
.main-sidebar::before {
    background-color: var(--labs-sidebar) !important;
}

.brand-link {
    background-color: var(--labs-sidebar-deep) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

/* Item comum do menu */
.nav-sidebar .nav-link {
    color: #cbd3dc !important;
    border-radius: 7px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-sidebar .nav-link:hover {
    color: #fff !important;
    background-color: var(--labs-sidebar-hover) !important;
}

.nav-sidebar > .nav-item > .nav-link.active,
.nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
    color: #fff !important;
    background: linear-gradient(100deg, var(--labs-navy), var(--labs-sky)) !important;
    box-shadow: 0 4px 12px rgba(19, 136, 199, 0.22);
}

.nav-sidebar .nav-link.active .nav-icon,
.nav-sidebar .nav-link.active i {
    color: #fff !important;
}

/* Titulo de agrupamento: discretamente maior que o item comum */
.nav-sidebar > .nav-header,
.sidebar .nav-header {
    margin: 10px 8px 4px !important;
    padding: 6px 10px !important;
    color: #aeb9c5 !important;
    font-size: 0.90rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
}

/* Item principal que abre submenu */
.nav-sidebar > .nav-item.has-treeview > .nav-link,
.nav-sidebar > .nav-item.menu-open > .nav-link {
    font-size: 0.90rem !important;
    font-weight: 600 !important;
}

.nav-sidebar .nav-treeview .nav-link {
    font-weight: 400 !important;
}

.nav-sidebar > .nav-item.has-treeview > .nav-link > .nav-icon {
    font-size: 1rem !important;
}

.nav-sidebar .nav-treeview .nav-icon {
    font-size: 0.88rem !important;
}

/* --------------------------------------------------------------------------
   5. FORMULARIOS ADD E EDIT
   -------------------------------------------------------------------------- */

.ew-add-form,
.ew-edit-form,
.ew-view-form {
    width: 100%;
    max-width: 1500px;
}

.ew-add-form .ew-add-div,
.ew-edit-form .ew-edit-div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 28px;
    row-gap: 18px;
    padding: 26px 32px;
    margin-bottom: 18px;
    background: var(--labs-card-bg);
    border: 1px solid var(--labs-border-soft);
    border-radius: var(--labs-card-radius);
    box-shadow: var(--labs-shadow);
}

.ew-add-form .ew-add-div > .row,
.ew-edit-form .ew-edit-div > .row {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.ew-add-form .ew-add-div > .row > [class*="col-"],
.ew-edit-form .ew-edit-div > .row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    padding-right: 0;
    padding-left: 0;
}

.ew-add-form .ew-label,
.ew-edit-form .ew-label {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 7px;
    padding: 0;
    color: var(--labs-label);
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.3;
}

.ew-add-form .ew-label .text-danger,
.ew-edit-form .ew-label .text-danger {
    color: #dc3545 !important;
}

.ew-add-form .form-control,
.ew-edit-form .form-control,
.ew-add-form .form-select,
.ew-edit-form .form-select {
    width: 100%;
    min-height: 44px;
    padding: 9px 13px;
    color: var(--labs-text);
    background-color: #fff;
    border: 1px solid var(--labs-border);
    border-radius: var(--labs-radius);
    font-size: 0.95rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease,
                background-color 0.16s ease;
}

.ew-add-form .form-control:hover,
.ew-edit-form .form-control:hover,
.ew-add-form .form-select:hover,
.ew-edit-form .form-select:hover {
    border-color: #b8c5d1;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--labs-sky) !important;
    box-shadow: 0 0 0 3px var(--labs-focus) !important;
    outline: 0 !important;
}

.ew-add-form .form-control::placeholder,
.ew-edit-form .form-control::placeholder {
    color: #9aa7b5;
    opacity: 1;
}

.ew-add-form .form-control:disabled,
.ew-add-form .form-control[readonly],
.ew-edit-form .form-control:disabled,
.ew-edit-form .form-control[readonly],
.ew-add-form .form-select:disabled,
.ew-edit-form .form-select:disabled {
    color: var(--labs-text-soft);
    background-color: #f3f6f8;
    border-color: #e0e6ec;
}

.ew-add-form textarea.form-control,
.ew-edit-form textarea.form-control {
    min-height: 88px;
    resize: vertical;
}

.ew-add-form .select2-container,
.ew-edit-form .select2-container {
    width: 100% !important;
}

.ew-add-form .select2-selection,
.ew-edit-form .select2-selection {
    min-height: 44px;
    border-color: var(--labs-border);
    border-radius: var(--labs-radius);
}

.select2-container--focus .select2-selection,
.select2-container--open .select2-selection,
.select2-container--bootstrap5.select2-container--focus .select2-selection,
.select2-container--bootstrap5.select2-container--open .select2-selection {
    border-color: var(--labs-sky) !important;
    box-shadow: 0 0 0 3px var(--labs-focus) !important;
}

.select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--bootstrap5 .select2-results__option--highlighted {
    color: #fff !important;
    background-color: var(--labs-blue) !important;
}

/* Campos extensos ocupam as duas colunas */
.ew-add-form .ew-add-div > .row:has(textarea),
.ew-edit-form .ew-edit-div > .row:has(textarea),
.ew-add-form .ew-add-div > .row:has(.ew-html-editor),
.ew-edit-form .ew-edit-div > .row:has(.ew-html-editor),
#r_parecer_conclusao,
#r_observacao,
#r_descricao {
    grid-column: 1 / -1;
}

/* --------------------------------------------------------------------------
   6. DATAS E INPUT GROUPS
   -------------------------------------------------------------------------- */

.ew-add-form .input-group,
.ew-edit-form .input-group {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
}

.ew-add-form .input-group > .form-control,
.ew-edit-form .input-group > .form-control,
.ew-add-form .input-group > .form-select,
.ew-edit-form .input-group > .form-select {
    width: 1%;
    min-width: 0;
    flex: 1 1 auto;
    border-radius: var(--labs-radius) 0 0 var(--labs-radius);
}

.ew-add-form .input-group > .btn,
.ew-edit-form .input-group > .btn,
.ew-add-form .input-group > .input-group-text,
.ew-edit-form .input-group > .input-group-text {
    display: inline-flex;
    flex: 0 0 46px;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    color: var(--labs-label);
    background: #f8fafc;
    border: 1px solid var(--labs-border);
    border-left: 0;
    border-radius: 0 var(--labs-radius) var(--labs-radius) 0;
}

.input-group > .btn:hover,
.input-group > .input-group-text:hover {
    color: var(--labs-dark) !important;
    background-color: var(--labs-soft) !important;
}

/* --------------------------------------------------------------------------
   7. RADIO BUTTONS E CHECKBOXES
   -------------------------------------------------------------------------- */

.form-check-input:checked {
    background-color: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.form-check-input:focus {
    border-color: var(--labs-sky) !important;
    box-shadow: 0 0 0 3px var(--labs-focus) !important;
}

.ew-add-form .ew-radio,
.ew-edit-form .ew-radio {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.ew-add-form .ew-radio .form-check,
.ew-edit-form .ew-radio .form-check {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin: 0;
    padding: 7px 13px;
    background: #fff;
    border: 1px solid var(--labs-border);
    border-radius: 20px;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.ew-add-form .ew-radio .form-check:hover,
.ew-edit-form .ew-radio .form-check:hover {
    background: #f8fafc;
    border-color: #aebdca;
}

.ew-add-form .ew-radio .form-check-input,
.ew-edit-form .ew-radio .form-check-input {
    float: none;
    flex: 0 0 auto;
    margin: 0 7px 0 0;
}

.ew-add-form .ew-radio .form-check-label,
.ew-edit-form .ew-radio .form-check-label {
    margin: 0;
    color: var(--labs-label);
    font-size: 0.84rem;
    font-weight: 500;
    white-space: nowrap;
}

.ew-radio .form-check:has(.form-check-input:checked) {
    color: var(--labs-dark) !important;
    background-color: var(--labs-soft) !important;
    border-color: rgba(40, 100, 173, 0.45) !important;
}

/* --------------------------------------------------------------------------
   8. PAGINA VIEW
   -------------------------------------------------------------------------- */

.ew-view-form .ew-view-table {
    display: block;
    width: 100%;
    padding: 24px 28px;
    background: var(--labs-card-bg);
    border: 1px solid var(--labs-border-soft);
    border-radius: var(--labs-card-radius);
    box-shadow: var(--labs-shadow);
}

.ew-view-form .ew-view-table > tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
    width: 100%;
}

.ew-view-form .ew-view-table > tbody > tr {
    display: grid;
    grid-template-columns: minmax(140px, 34%) minmax(0, 66%);
    min-height: 54px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--labs-border-soft);
    border-radius: 9px;
}

.ew-view-form .ew-view-table > tbody > tr > td {
    display: flex;
    align-items: center;
    width: auto !important;
    max-width: none !important;
    padding: 10px 13px;
    border: 0;
    overflow-wrap: anywhere;
}

.ew-view-form .ew-view-table > tbody > tr > td:first-child {
    color: var(--labs-label);
    background: #f7f9fb;
    border-right: 1px solid var(--labs-border-soft);
    font-size: 0.80rem;
    font-weight: 650;
}

.ew-view-form .ew-view-table > tbody > tr > td:last-child {
    color: var(--labs-text);
    font-size: 0.90rem;
    font-weight: 500;
}

.ew-view-form #r_parecer_conclusao,
.ew-view-form #r_observacao,
.ew-view-form #r_descricao {
    grid-column: 1 / -1;
}

/* --------------------------------------------------------------------------
   9. BOTOES E ACOES
   -------------------------------------------------------------------------- */

.ew-submit,
.ew-btn,
.ew-form .btn {
    border-radius: 8px;
}

.btn-primary,
.ew-submit {
    color: #fff !important;
    background: linear-gradient(105deg, var(--labs-navy), var(--labs-sky)) !important;
    border-color: var(--labs-blue) !important;
    box-shadow: 0 3px 8px rgba(40, 100, 173, 0.20);
}

.btn-primary:hover,
.ew-submit:hover {
    color: #fff !important;
    background: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
    box-shadow: 0 5px 12px rgba(40, 100, 173, 0.28);
}

.btn-primary:focus,
.btn-primary:active,
.ew-submit:focus,
.ew-submit:active {
    color: #fff !important;
    background: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
    box-shadow: 0 0 0 3px var(--labs-focus) !important;
}

.btn-outline-primary {
    color: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.btn-outline-primary:hover {
    color: #fff !important;
    background-color: var(--labs-blue) !important;
}

/* PHPMaker pode usar btn-success em acoes primarias e pesquisa. */
button.btn-success:not(.ew-workflow-success),
input.btn-success[type="submit"],
a.btn-success:not(.ew-workflow-success) {
    color: #fff !important;
    background-color: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

button.btn-success:not(.ew-workflow-success):hover,
input.btn-success[type="submit"]:hover,
a.btn-success:not(.ew-workflow-success):hover {
    background-color: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
}

/* --------------------------------------------------------------------------
   10. PESQUISA
   -------------------------------------------------------------------------- */

.ew-search-panel,
.ew-basic-search,
.ew-advanced-search {
    width: fit-content;
    max-width: 100%;
    margin-bottom: 14px;
}

.ew-search-panel .card,
.ew-basic-search .card,
.ew-advanced-search .card {
    width: fit-content;
    max-width: 100%;
    margin-bottom: 0;
    border: 1px solid var(--labs-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05) !important;
}

.ew-search-panel .card-body,
.ew-basic-search .card-body,
.ew-advanced-search .card-body {
    padding: 16px 18px !important;
}

.ew-search-panel .row,
.ew-basic-search .row,
.ew-advanced-search .row {
    align-items: center;
    row-gap: 10px;
}

.ew-search-panel .input-group,
.ew-basic-search .input-group {
    flex-wrap: nowrap;
    min-width: 320px;
    max-width: 460px;
}

.ew-search-panel .btn,
.ew-basic-search .btn {
    min-height: 44px;
    padding: 8px 18px;
    white-space: nowrap;
}

.ew-search-panel .btn-primary,
.ew-search-panel .btn-success,
.ew-search-panel button[type="submit"],
.ew-basic-search .btn-primary,
.ew-basic-search .btn-success,
.ew-basic-search button[type="submit"],
.ew-advanced-search .btn-primary,
.ew-advanced-search .btn-success,
.ew-advanced-search button[type="submit"],
form[id$="srch"] button[type="submit"],
form[name$="srch"] button[type="submit"] {
    color: #fff !important;
    background: linear-gradient(105deg, var(--labs-navy), var(--labs-sky)) !important;
    border-color: var(--labs-blue) !important;
    border-radius: 8px !important;
    box-shadow: 0 3px 8px rgba(40, 100, 173, 0.20) !important;
}

.ew-search-panel button[type="submit"]:hover,
.ew-basic-search button[type="submit"]:hover,
.ew-advanced-search button[type="submit"]:hover,
form[id$="srch"] button[type="submit"]:hover,
form[name$="srch"] button[type="submit"]:hover {
    color: #fff !important;
    background: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
}

/* --------------------------------------------------------------------------
   11. LISTAGENS, TABELAS, LINKS, PAGINACAO E ABAS
   -------------------------------------------------------------------------- */

a {
    color: var(--labs-blue);
}

a:hover {
    color: var(--labs-dark);
}

/* Card externo exclusivo das paginas List */
.ew-list-form .ew-grid {
    overflow: visible;
    background: var(--labs-card-bg);
    border: 1px solid var(--labs-border-soft) !important;
    border-radius: 12px !important;
    box-shadow: var(--labs-shadow);
}

/* A rolagem fica apenas na regiao da tabela quando realmente necessaria */
.ew-list-form .ew-grid-middle-panel,
.ew-list-form .table-responsive {
    overflow-x: auto;
    border-radius: 12px;
}

.ew-list-form .ew-table {
    width: 100%;
    margin-bottom: 0 !important;
    color: var(--labs-text);
    background: #fff;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 0.88rem;
}

/* Remove a grade pesada do PHPMaker */
.ew-list-form .ew-table > :not(caption) > * > * {
    border-right: 0 !important;
    border-left: 0 !important;
}

/* Cabecalho moderno e compacto */
.ew-list-form .ew-table thead th,
.ew-list-form .ew-table thead td {
    position: relative;
    padding: 11px 12px !important;
    color: #3b4b60 !important;
    background: #eef4f9 !important;
    border-top: 0 !important;
    border-bottom: 1px solid #cedbe7 !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    line-height: 1.25;
    letter-spacing: 0.015em;
    text-transform: none;
    vertical-align: middle !important;
    white-space: nowrap;
}

.ew-list-form .ew-table thead th:first-child,
.ew-list-form .ew-table thead td:first-child {
    border-top-left-radius: 11px;
}

.ew-list-form .ew-table thead th:last-child,
.ew-list-form .ew-table thead td:last-child {
    border-top-right-radius: 11px;
}

/* Linhas e celulas */
.ew-list-form .ew-table tbody tr {
    background-color: #fff;
    transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.ew-list-form .ew-table tbody tr:nth-child(even) {
    background-color: #fbfcfd;
}

.ew-list-form .ew-table tbody tr:hover {
    background-color: var(--labs-soft) !important;
    box-shadow: inset 3px 0 0 var(--labs-sky);
}

.ew-list-form .ew-table tbody td {
    padding: 10px 12px !important;
    color: var(--labs-text);
    background: transparent !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--labs-border-soft) !important;
    font-size: 0.88rem;
    line-height: 1.35;
    vertical-align: middle !important;
}

.ew-list-form .ew-table tbody tr:last-child td {
    border-bottom: 0 !important;
}

/* Links de ordenacao do cabecalho */
.ew-list-form .ew-table thead a {
    color: #3b4b60 !important;
    text-decoration: none !important;
}

.ew-list-form .ew-table thead a:hover {
    color: var(--labs-blue) !important;
}

/* Colunas de opcoes e acoes */
.ew-list-form .ew-list-option-header,
.ew-list-form .ew-list-option-body {
    width: 42px;
    min-width: 42px;
    padding: 5px !important;
    text-align: center !important;
    white-space: nowrap;
}

.ew-list-form .ew-list-option-body > a,
.ew-list-form .ew-list-option-body > .btn,
.ew-list-form .ew-list-option-body .dropdown-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px;
    height: 32px;
    padding: 0 !important;
    margin: 1px !important;
    color: var(--labs-blue) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 7px !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.ew-list-form .ew-list-option-body > a:hover,
.ew-list-form .ew-list-option-body > .btn:hover,
.ew-list-form .ew-list-option-body .dropdown-toggle:hover {
    color: var(--labs-dark) !important;
    background: var(--labs-soft-strong) !important;
}

/* Exclusao continua visualmente distinta */
.ew-list-form .ew-list-option-body a.ew-delete,
.ew-list-form .ew-list-option-body a[data-caption="Delete"] {
    color: #c2414b !important;
}

.ew-list-form .ew-list-option-body a.ew-delete:hover,
.ew-list-form .ew-list-option-body a[data-caption="Delete"]:hover {
    color: #a61f2b !important;
    background: #fdecee !important;
}

/* Checkboxes das listagens */
.ew-list-form .ew-table .form-check-input,
.ew-list-form .ew-table input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    vertical-align: middle;
}

/* Barra superior e inferior da listagem */
.ew-list-form .ew-grid-upper-panel,
.ew-list-form .ew-grid-lower-panel {
    padding: 10px 12px !important;
    background: #fff;
    border-color: var(--labs-border-soft) !important;
}

.ew-list-form .ew-grid-upper-panel {
    border-radius: 12px 12px 0 0;
}

.ew-list-form .ew-grid-lower-panel {
    border-radius: 0 0 12px 12px;
}

/* Compatibilidade com tabelas fora de List, sem impor a grade completa */
.table thead th {
    color: var(--labs-label);
    background-color: #f1f6fa;
    border-bottom-color: #ccd9e5;
}

.table-hover tbody tr:hover {
    background-color: #f4f9fd;
}

.page-item.active .page-link {
    color: #fff !important;
    background-color: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.page-link {
    color: var(--labs-blue);
}

.page-link:hover {
    color: var(--labs-dark);
    background-color: var(--labs-soft);
}

.nav-tabs .nav-link.active {
    color: var(--labs-dark) !important;
    border-top-color: var(--labs-blue) !important;
}

.nav-pills .nav-link.active {
    color: #fff !important;
    background-color: var(--labs-blue) !important;
}

/* Fornecedor -> Produto: acao de detalhe compacta */
.ew-table .ew-list-option-body[data-name="detail_tb_produto"] a.ew-detail {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #5f7390 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    font-size: 0 !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.ew-table .ew-list-option-body[data-name="detail_tb_produto"] a.ew-detail::before {
    content: "\f1b3";
    color: #5f7390 !important;
    font-family: "Font Awesome 6 Free" !important;
    font-size: 15px !important;
    font-weight: 900 !important;
}

.ew-table .ew-list-option-body[data-name="detail_tb_produto"] a.ew-detail:hover {
    color: var(--labs-blue) !important;
    background: var(--labs-soft) !important;
}

.ew-table .ew-list-option-body[data-name="detail_tb_produto"] a.ew-detail:hover::before {
    color: var(--labs-blue) !important;
}

/* --------------------------------------------------------------------------
   12. DASHBOARD
   Suporta os prefixos utilizados nas diferentes versoes do projeto.
   -------------------------------------------------------------------------- */

.dashboard-container,
.dashboard-wrapper,
.erp-dashboard,
.ge-dashboard,
.labs-dashboard {
    width: 100%;
    max-width: 1600px;
}

/* Grade dos indicadores */
.dashboard-grid,
.dashboard-cards,
.dashboard-kpis,
.dash-grid,
.kpi-grid,
.kpi-cards,
.kpi-wrapper,
.metrics-grid,
.stats-grid,
.erp-dashboard-grid,
.erp-kpis,
.erp-kpi-grid,
.ge-dashboard-grid,
.ge-kpi-grid,
.labs-dashboard-grid,
.labs-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    margin: 0 0 22px;
}

/* Card de indicador */
.dashboard-card,
.dashboard-kpi,
.dash-card,
.kpi-card,
.metric-card,
.stat-card,
.erp-kpi,
.erp-dashboard-card,
.erp-kpi-card,
.ge-dashboard-card,
.ge-kpi-card,
.labs-dashboard-card,
.labs-kpi-card {
    position: relative;
    display: grid !important;
    grid-template-columns: 50px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 14px;
    align-items: center;
    min-width: 0;
    min-height: 126px;
    padding: 18px;
    overflow: hidden;
    color: var(--labs-text);
    background: var(--labs-card-bg);
    border: 1px solid var(--labs-border-soft);
    border-radius: var(--labs-card-radius);
    box-shadow: var(--labs-shadow);
    transition: transform 0.16s ease, box-shadow 0.16s ease,
                border-color 0.16s ease;
}

.dashboard-card::after,
.dashboard-kpi::after,
.dash-card::after,
.kpi-card::after,
.metric-card::after,
.stat-card::after,
.erp-kpi::after,
.erp-dashboard-card::after,
.erp-kpi-card::after,
.ge-dashboard-card::after,
.ge-kpi-card::after,
.labs-dashboard-card::after,
.labs-kpi-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 72px;
    height: 72px;
    pointer-events: none;
    background: radial-gradient(circle at top right,
                rgba(19, 136, 199, 0.10), transparent 68%);
}

.dashboard-card:hover,
.dashboard-kpi:hover,
.dash-card:hover,
.kpi-card:hover,
.metric-card:hover,
.stat-card:hover,
.erp-kpi:hover,
.erp-dashboard-card:hover,
.erp-kpi-card:hover,
.ge-dashboard-card:hover,
.ge-kpi-card:hover,
.labs-dashboard-card:hover,
.labs-kpi-card:hover {
    transform: translateY(-2px);
    border-color: #caddeb;
    box-shadow: 0 10px 26px rgba(36, 63, 132, 0.10);
}

/* Icone */
.dashboard-icon,
.dash-icon,
.kpi-icon,
.metric-icon,
.stat-icon,
.erp-kpi-icon,
.ge-kpi-icon,
.labs-kpi-icon {
    grid-column: 1;
    grid-row: 1 / 4;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    color: var(--labs-blue);
    background: linear-gradient(135deg, var(--labs-soft), var(--labs-soft-strong));
    border: 1px solid rgba(40, 100, 173, 0.12);
    border-radius: 13px;
    font-size: 1.25rem;
}

/* Titulo do indicador */
.dashboard-card-title,
.dashboard-kpi-title,
.dash-title,
.dash-label,
.kpi-title,
.kpi-label,
.metric-title,
.metric-label,
.stat-title,
.stat-label,
.erp-kpi-title,
.erp-kpi-label,
.ge-kpi-title,
.labs-kpi-title {
    grid-column: 2;
    margin: 0 0 3px;
    color: var(--labs-text-soft);
    font-size: 0.78rem !important;
    font-weight: 650 !important;
    line-height: 1.25;
}

/* Valor principal */
.dashboard-card-value,
.dashboard-kpi-value,
.dash-value,
.kpi-value,
.metric-value,
.stat-value,
.erp-kpi-value,
.ge-kpi-value,
.labs-kpi-value {
    grid-column: 2;
    margin: 0;
    color: var(--labs-text);
    font-size: clamp(1.28rem, 1.6vw, 1.65rem) !important;
    font-weight: 750 !important;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* Texto auxiliar */
.dashboard-card-subtitle,
.dashboard-card-description,
.dashboard-kpi-subtitle,
.dash-subtitle,
.dash-description,
.dash-note,
.kpi-subtitle,
.kpi-description,
.kpi-note,
.metric-subtitle,
.metric-description,
.metric-note,
.stat-subtitle,
.stat-description,
.stat-note,
.erp-kpi-subtitle,
.erp-kpi-note,
.ge-kpi-subtitle,
.labs-kpi-subtitle {
    grid-column: 2;
    margin: 4px 0 0;
    color: #8491a2;
    font-size: 0.72rem !important;
    line-height: 1.3;
}

/* Variacoes semanticas dos cards */
.dashboard-card.is-warning .dashboard-icon,
.dashboard-card.warning .dashboard-icon,
.kpi-card.is-warning .kpi-icon,
.kpi-card.warning .kpi-icon,
.ge-kpi-card.is-warning .ge-kpi-icon,
.ge-kpi-card.warning .ge-kpi-icon {
    color: #9a6700;
    background: #fff7df;
    border-color: #f3df9f;
}

.dashboard-card.is-danger .dashboard-icon,
.dashboard-card.danger .dashboard-icon,
.kpi-card.is-danger .kpi-icon,
.kpi-card.danger .kpi-icon,
.ge-kpi-card.is-danger .ge-kpi-icon,
.ge-kpi-card.danger .ge-kpi-icon {
    color: #b4232f;
    background: #fdecee;
    border-color: #f4cbd0;
}

.dashboard-card.is-success .dashboard-icon,
.dashboard-card.success .dashboard-icon,
.kpi-card.is-success .kpi-icon,
.kpi-card.success .kpi-icon,
.ge-kpi-card.is-success .ge-kpi-icon,
.ge-kpi-card.success .ge-kpi-icon {
    color: #16704c;
    background: #eaf7f1;
    border-color: #c8eadc;
}

/* Paineis inferiores, graficos e tabelas do Dashboard */
.dashboard-content-grid,
.dashboard-panels,
.erp-dashboard-panels,
.ge-dashboard-panels,
.labs-dashboard-panels {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
}

.dashboard-panel,
.dashboard-chart,
.erp-dashboard-panel,
.ge-dashboard-panel,
.labs-dashboard-panel {
    min-width: 0;
    padding: 20px;
    background: var(--labs-card-bg);
    border: 1px solid var(--labs-border-soft);
    border-radius: var(--labs-card-radius);
    box-shadow: var(--labs-shadow);
}

.dashboard-panel-title,
.dashboard-section-title,
.erp-dashboard-title,
.ge-dashboard-title,
.labs-dashboard-title {
    margin: 0 0 16px;
    color: var(--labs-text);
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

/* Estrutura exata do Dashboard principal (vw_dashboard) */
.erp-dashboard-page {
    width: 100%;
    max-width: 1600px;
    margin: 0 0 24px;
}

.erp-dashboard-page .erp-dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
    margin: 0;
}

.erp-dashboard-page .erp-dashboard-card {
    display: flex !important;
    align-items: center;
    gap: 16px;
    min-width: 0;
    min-height: 132px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--labs-border-soft);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.erp-dashboard-page .erp-dashboard-icon {
    display: inline-flex !important;
    flex: 0 0 54px;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: 1.28rem;
}

.erp-dashboard-page .erp-dashboard-icon.green {
    color: var(--labs-blue);
    background: linear-gradient(135deg, var(--labs-soft), var(--labs-soft-strong));
    border-color: rgba(40, 100, 173, 0.14);
}

.erp-dashboard-page .erp-dashboard-icon.blue {
    color: #176fb0;
    background: #e9f5fc;
    border-color: #cce8f7;
}

.erp-dashboard-page .erp-dashboard-icon.yellow {
    color: #9a6700;
    background: #fff7df;
    border-color: #f3df9f;
}

.erp-dashboard-page .erp-dashboard-icon.red {
    color: #b4232f;
    background: #fdecee;
    border-color: #f4cbd0;
}

.erp-dashboard-page .erp-dashboard-icon.purple {
    color: #6845a5;
    background: #f2edfb;
    border-color: #dfd3f5;
}

.erp-dashboard-page .erp-dashboard-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.erp-dashboard-page .erp-dashboard-label {
    margin: 0 0 5px;
    color: var(--labs-text-soft);
    font-size: 0.78rem !important;
    font-weight: 650 !important;
    line-height: 1.25;
}

.erp-dashboard-page .erp-dashboard-value {
    margin: 0;
    color: var(--labs-text);
    font-size: clamp(1.38rem, 1.65vw, 1.75rem) !important;
    font-weight: 750 !important;
    line-height: 1.12;
    letter-spacing: -0.025em;
}

.erp-dashboard-page .erp-dashboard-value-money {
    font-size: clamp(1.15rem, 1.35vw, 1.48rem) !important;
    white-space: nowrap;
}

.erp-dashboard-page .erp-dashboard-note {
    margin: 6px 0 0;
    color: #8491a2;
    font-size: 0.72rem !important;
    line-height: 1.3;
}

/* --------------------------------------------------------------------------
   13. CARDS, INDICADORES E CORES SEMANTICAS
   -------------------------------------------------------------------------- */

.card-primary:not(.card-outline) > .card-header {
    color: #fff;
    background: linear-gradient(105deg, var(--labs-navy), var(--labs-sky));
}

.card-primary.card-outline {
    border-top-color: var(--labs-blue);
}

.info-box-icon.bg-primary,
.small-box.bg-primary {
    background: linear-gradient(135deg, var(--labs-navy), var(--labs-sky)) !important;
}

.badge-primary,
.bg-primary {
    color: #fff !important;
    background-color: var(--labs-blue) !important;
}

.badge-info,
.bg-info {
    color: #fff !important;
    background-color: var(--labs-sky) !important;
}

/* Cores com significado funcional permanecem inalteradas. */
.badge-success,
.bg-success {
    color: #fff !important;
    background-color: #198754 !important;
}

.badge-warning,
.bg-warning {
    color: #3f3200 !important;
    background-color: #ffc107 !important;
}

.badge-danger,
.bg-danger {
    color: #fff !important;
    background-color: #dc3545 !important;
}

/* --------------------------------------------------------------------------
   14. COMPONENTES FUNCIONAIS RECUPERADOS DA BASELINE DE 30/08
   -------------------------------------------------------------------------- */

/* Aliases estruturais usados por paginas personalizadas antigas */
.ew-list,
.ew-grid,
.main-content,
.ew-content-wrapper {
    max-width: 100% !important;
    min-width: 0 !important;
}

.box,
.panel {
    background: var(--labs-card-bg);
    border: 1px solid var(--labs-border-soft);
    border-radius: var(--labs-card-radius);
    box-shadow: var(--labs-shadow);
}

.search-container,
.filter-container,
.table-filter,
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content !important;
    max-width: 680px !important;
    padding: 8px 10px !important;
    margin: 0 0 18px !important;
    background: #fff;
    border: 1px solid var(--labs-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
}

.ew-quick-search {
    max-width: 620px !important;
}

.ew-quick-search .form-control,
.ew-quick-search .form-select {
    min-height: 38px !important;
    height: 38px !important;
    border-radius: 8px !important;
}

.btn-default,
.btn-secondary {
    color: #344054;
    background: #fff;
    border: 1px solid #d0d5dd;
}

.btn-default:hover,
.btn-secondary:hover {
    color: #243f84;
    background: var(--labs-soft);
    border-color: #bfc5cd;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--labs-text-soft);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
}

.btn-icon:hover {
    color: var(--labs-blue);
    background: var(--labs-soft);
}

/* Validade e bloqueio de lotes */
.erp-validade-vencido,
.erp-validade-critico {
    color: #b42318 !important;
    background: #fdecec !important;
    border-color: #f4c7c3 !important;
}

.erp-validade-alerta {
    color: #b25f00 !important;
    background: #fff3e0 !important;
    border-color: #f4d0a0 !important;
}

.erp-validade-atencao {
    color: #946200 !important;
    background: #fff8dc !important;
    border-color: #efdf9b !important;
}

.erp-validade-ok {
    color: #087443 !important;
    background: #e8f5ee !important;
    border-color: #c6e6d5 !important;
}

.erp-lote-bloqueado {
    position: relative !important;
    color: #c92a2a !important;
    font-weight: 700 !important;
}

.erp-lote-bloqueado::before {
    content: "\f023";
    margin-right: 6px !important;
    color: #c92a2a !important;
    font-family: "Font Awesome 6 Free" !important;
    font-size: 11px !important;
    font-weight: 900 !important;
}

/* KPIs operacionais usados em Entradas e outras listagens */
.erp-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 14px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 8px 0 18px !important;
}

.erp-kpi-card {
    width: auto !important;
    min-width: 0 !important;
    min-height: 132px !important;
    padding: 16px !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 1px solid var(--labs-border-soft) !important;
    border-radius: 12px !important;
    box-shadow: var(--labs-shadow) !important;
}

.erp-kpi-content {
    width: 100%;
    min-width: 0;
}

.erp-kpi-top {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0;
}

.erp-kpi-top > div:last-child {
    min-width: 0;
}

.erp-kpi-title {
    margin-bottom: 4px !important;
    overflow: hidden;
    color: var(--labs-text-soft) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-kpi-value {
    color: var(--labs-text) !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
}

.erp-kpi-bottom {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-width: 0;
    margin-top: 20px !important;
}

.erp-kpi-description {
    overflow: hidden;
    color: #98a2b3 !important;
    font-size: 11px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-kpi-icon {
    display: inline-flex !important;
    flex: 0 0 42px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    font-size: 17px !important;
}

.erp-kpi-icon.green {
    color: var(--labs-blue) !important;
    background: var(--labs-soft-strong) !important;
}

.erp-kpi-icon.yellow {
    color: #b77900 !important;
    background: #fff3cd !important;
}

.erp-kpi-icon.red {
    color: #d92d20 !important;
    background: #fde8e8 !important;
}

.erp-kpi-trend {
    flex: 0 0 76px !important;
    width: 76px !important;
    height: 23px !important;
}

.erp-kpi-trend svg {
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
}

.erp-kpi-trend polyline {
    fill: none !important;
    stroke-width: 1.8 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    vector-effect: non-scaling-stroke !important;
}

.erp-kpi-trend.green polyline { stroke: var(--labs-blue) !important; }
.erp-kpi-trend.yellow polyline { stroke: #f5b700 !important; }
.erp-kpi-trend.red polyline { stroke: #e5484d !important; }

/* Acoes padrao do PHPMaker: recupera largura compacta da baseline */
.ew-list-form .ew-table td.ew-list-option-body,
.ew-list-form .ew-table th.ew-list-option-header {
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: nowrap !important;
}

.ew-list-form .ew-table td[data-name="view"],
.ew-list-form .ew-table th[data-name="view"],
.ew-list-form .ew-table td[data-name="edit"],
.ew-list-form .ew-table th[data-name="edit"],
.ew-list-form .ew-table td[data-name="copy"],
.ew-list-form .ew-table th[data-name="copy"],
.ew-list-form .ew-table td[data-name="delete"],
.ew-list-form .ew-table th[data-name="delete"] {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    padding-right: 1px !important;
    padding-left: 1px !important;
    text-align: center !important;
}

.ew-list-form .ew-table td[data-name="view"] a,
.ew-list-form .ew-table td[data-name="edit"] a,
.ew-list-form .ew-table td[data-name="copy"] a,
.ew-list-form .ew-table td[data-name="delete"] a,
.ew-list-form .ew-table td[data-name="view"] .btn,
.ew-list-form .ew-table td[data-name="edit"] .btn,
.ew-list-form .ew-table td[data-name="copy"] .btn,
.ew-list-form .ew-table td[data-name="delete"] .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #667085 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}

.ew-list-form .ew-table td[data-name="view"] a:hover,
.ew-list-form .ew-table td[data-name="edit"] a:hover,
.ew-list-form .ew-table td[data-name="copy"] a:hover {
    color: var(--labs-blue) !important;
    background: var(--labs-soft) !important;
}

.ew-list-form .ew-table td[data-name="delete"] a:hover,
.ew-list-form .ew-table a.ew-delete:hover {
    color: #d92d20 !important;
    background: #fef3f2 !important;
}

/* Master/detail global */
.ew-list-form th[data-name^="detail_"],
.ew-list-form td[data-name^="detail_"] {
    width: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    padding-right: 4px !important;
    padding-left: 4px !important;
    overflow: visible !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.ew-list-form td[data-name^="detail_"] .ew-btn-group {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    width: auto !important;
}

.ew-list-form td[data-name^="detail_"] a.ew-detail {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    color: var(--labs-blue) !important;
    background: var(--labs-soft) !important;
    border: 1px solid #c9deef !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    font-size: 0 !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Identificacao visual de fallback para links master/detail sem icone nativo. */
.ew-list-form td[data-name^="detail_"] a.ew-detail::before {
    content: "\f03a";
    display: inline-block !important;
    flex: 0 0 auto !important;
    color: currentColor !important;
    font-family: "Font Awesome 6 Free" !important;
    font-size: 0.86rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

/* Quando houver contador, ele ocupa o botao no lugar do icone. */
.ew-list-form td[data-name^="detail_"] a.ew-detail:has(.badge)::before,
.ew-list-form td[data-name^="detail_"] a.ew-detail:has(.ew-detail-count-badge)::before {
    display: none !important;
}

.ew-list-form td[data-name^="detail_"] a.ew-detail:hover {
    color: var(--labs-dark) !important;
    background: var(--labs-soft-strong) !important;
    border-color: #9fc4df !important;
}

.ew-list-form td[data-name^="detail_"] .ew-detail-count-badge,
.ew-list-form td[data-name^="detail_"] a.ew-detail .badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 24px !important;
    height: 24px !important;
    padding: 0 6px !important;
    margin: 0 !important;
    color: var(--labs-blue) !important;
    background: var(--labs-soft) !important;
    border: 1px solid #c9deef !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* Cabecalho das colunas de tabelas relacionadas, quando vier vazio. */
.ew-list-form th[data-name^="detail_"]:not(:has(*))::after {
    content: "Itens";
    display: inline-block !important;
    color: #3b4b60 !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
}

.ew-list-form td[data-name^="detail_"] button.ew-detail.dropdown-toggle,
.ew-list-form td[data-name^="detail_"] .dropdown-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    min-width: 24px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    margin: 0 0 0 2px !important;
    color: #667085 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}

.ew-list-form td[data-name^="detail_"] .dropdown-menu {
    z-index: 1080 !important;
}

/* Detalhe Fornecedor -> Produto sem contador */
.ew-list-form .ew-list-option-body[data-name="detail_tb_produto"] a.ew-detail {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 28px !important;
    padding: 0 !important;
    color: var(--labs-blue) !important;
    background: var(--labs-soft) !important;
    border: 1px solid #c9deef !important;
    border-radius: 999px !important;
    font-size: 0 !important;
    font-weight: 700 !important;
}

/* Evita duplicar o icone na excecao historica Fornecedor -> Produto. */
.ew-list-form .ew-list-option-body[data-name="detail_tb_produto"] a.ew-detail::before {
    content: "\f1b3" !important;
}

/* Workflow e colunas operacionais */
.ew-list-form th[data-name="workflow_actions"],
.ew-list-form td[data-name="workflow_actions"] {
    width: 155px !important;
    min-width: 145px !important;
    max-width: 175px !important;
    overflow: visible !important;
    text-align: left !important;
    white-space: nowrap !important;
}

.ew-list-form td[data-name="workflow_actions"] a,
.ew-list-form td[data-name="workflow_actions"] button,
.ew-list-form td[data-name="workflow_actions"] .btn {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 27px !important;
    padding: 5px 9px !important;
    overflow: visible !important;
}

.ew-list-form :is(th, td)[data-name="data_entrada"],
.ew-list-form :is(th, td)[data-name="data_saida"] {
    width: 120px !important;
    min-width: 110px !important;
    white-space: nowrap !important;
}

.ew-list-form :is(th, td)[data-name="numero_nf"] {
    width: 105px !important;
    min-width: 90px !important;
    white-space: nowrap !important;
}

.ew-list-form :is(th, td)[data-name="status_movimentacao"] {
    min-width: 145px !important;
    white-space: nowrap !important;
}

.ew-list-form :is(th, td)[data-name="id_cliente"] { min-width: 180px !important; }
.ew-list-form :is(th, td)[data-name="id_fornecedor"] { min-width: 130px !important; }
.ew-list-form :is(th, td)[data-name="razao_social"] { min-width: 190px !important; }
.ew-list-form :is(th, td)[data-name="nome_fantasia"] { min-width: 180px !important; }
.ew-list-form :is(th, td)[data-name="cnpj"] { min-width: 155px !important; white-space: nowrap !important; }
.ew-list-form :is(th, td)[data-name="email"] { min-width: 210px !important; }
.ew-list-form :is(th, td)[data-name="nome"] { min-width: 220px !important; }
.ew-list-form :is(th, td)[data-name="fabricante"] { min-width: 220px !important; }

/* Extended Search e filtros */
.ew-extended-search {
    max-width: 100% !important;
    padding: 16px 18px !important;
    margin: 12px 0 20px !important;
    background: #fff !important;
    border: 1px solid var(--labs-border) !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05) !important;
}

.ew-extended-search .row {
    --bs-gutter-x: 14px !important;
    --bs-gutter-y: 12px !important;
    align-items: end !important;
}

.ew-extended-search label,
.ew-extended-search .ew-search-label {
    display: block !important;
    margin-bottom: 6px !important;
    color: var(--labs-label) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.ew-search-panel .ew-search-operator,
.ew-extended-search .ew-search-operator,
.ew-search-panel select[name^="z_"],
.ew-extended-search select[name^="z_"] {
    min-width: 86px !important;
    max-width: 120px !important;
}

.ew-extended-search .form-control,
.ew-extended-search .form-select,
.ew-extended-search .select2-selection,
.ew-extended-search .ts-control {
    min-height: 38px !important;
    height: 38px !important;
    padding: 7px 10px !important;
    color: var(--labs-text) !important;
    background: #fff !important;
    border: 1px solid #d0d5dd !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    box-shadow: none !important;
}

.ew-extended-search .form-control:focus,
.ew-extended-search .form-select:focus,
.ew-extended-search .select2-container--focus .select2-selection {
    border-color: var(--labs-sky) !important;
    box-shadow: 0 0 0 3px var(--labs-focus) !important;
}

/* Paginacao e rodape */
.ew-list-form .ew-grid .card-footer,
.ew-list-form .ew-grid .ew-grid-lower-panel {
    min-height: 54px;
    padding: 9px 12px !important;
    background: #fff;
    border: 0 !important;
    border-top: 1px solid var(--labs-border-soft) !important;
}

.pagination > li > a,
.pagination > li > span,
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    color: #475467;
    background: #fff;
    border: 1px solid var(--labs-border);
}

.page-size select {
    min-width: 74px;
    min-height: 36px;
}

.table-responsive::-webkit-scrollbar,
.ew-grid-middle-panel::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.ew-grid-middle-panel::-webkit-scrollbar-track {
    background: #f2f4f7;
}

.table-responsive::-webkit-scrollbar-thumb,
.ew-grid-middle-panel::-webkit-scrollbar-thumb {
    background: #cbd1d8;
    border-radius: 10px;
}

/* Dashboard executivo: medidas originais da baseline com paleta Labs */
.erp-dashboard-page {
    width: 100% !important;
    max-width: 100% !important;
}

.erp-dashboard-page .erp-dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 16px !important;
    margin: 8px 0 18px !important;
}

.erp-dashboard-page .erp-dashboard-card {
    min-height: 126px !important;
    padding: 18px !important;
    border-radius: 14px !important;
}

.erp-dashboard-page .erp-dashboard-icon {
    flex: 0 0 48px !important;
    width: 48px !important;
    height: 48px !important;
    margin-right: 15px !important;
    border-radius: 13px !important;
    font-size: 19px !important;
}

.erp-dashboard-page .erp-dashboard-content {
    min-width: 0 !important;
}

.erp-dashboard-page .erp-dashboard-label {
    margin-bottom: 5px !important;
    color: var(--labs-text-soft) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

.erp-dashboard-page .erp-dashboard-value {
    color: var(--labs-text) !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
}

.erp-dashboard-page .erp-dashboard-value-money {
    font-size: 22px !important;
}

.erp-dashboard-page .erp-dashboard-note {
    margin-top: 6px !important;
    color: #98a2b3 !important;
    font-size: 10.5px !important;
    line-height: 1.25 !important;
}

/* --------------------------------------------------------------------------
   15. RESPONSIVIDADE
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
    .erp-kpi-grid,
    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .dashboard-cards,
    .dashboard-kpis,
    .dash-grid,
    .kpi-grid,
    .kpi-cards,
    .kpi-wrapper,
    .metrics-grid,
    .stats-grid,
    .erp-dashboard-grid,
    .erp-kpis,
    .erp-kpi-grid,
    .ge-dashboard-grid,
    .ge-kpi-grid,
    .labs-dashboard-grid,
    .labs-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ew-add-form .ew-add-div,
    .ew-edit-form .ew-edit-div,
    .ew-view-form .ew-view-table > tbody {
        grid-template-columns: 1fr;
    }

    #r_parecer_conclusao,
    #r_observacao,
    #r_descricao {
        grid-column: auto;
    }
}

@media (max-width: 576px) {
    .erp-kpi-grid,
    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .erp-dashboard-page .erp-dashboard-card {
        min-height: 108px;
        padding: 15px;
    }

    .erp-dashboard-page .erp-dashboard-icon {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
        border-radius: 12px;
        font-size: 1.1rem;
    }

    .dashboard-grid,
    .dashboard-cards,
    .dashboard-kpis,
    .dash-grid,
    .kpi-grid,
    .kpi-cards,
    .kpi-wrapper,
    .metrics-grid,
    .stats-grid,
    .erp-dashboard-grid,
    .erp-kpis,
    .erp-kpi-grid,
    .ge-dashboard-grid,
    .ge-kpi-grid,
    .labs-dashboard-grid,
    .labs-kpi-grid,
    .dashboard-content-grid,
    .dashboard-panels,
    .erp-dashboard-panels,
    .ge-dashboard-panels,
    .labs-dashboard-panels {
        grid-template-columns: 1fr;
    }

    .dashboard-card,
    .dashboard-kpi,
    .dash-card,
    .kpi-card,
    .metric-card,
    .stat-card,
    .erp-kpi,
    .erp-dashboard-card,
    .erp-kpi-card,
    .ge-dashboard-card,
    .ge-kpi-card,
    .labs-dashboard-card,
    .labs-kpi-card {
        min-height: 112px;
        padding: 15px;
    }

    .content-header h1,
    .ew-page-heading h1 {
        font-size: 1.5rem;
    }

    .ew-add-form .ew-add-div,
    .ew-edit-form .ew-edit-div {
        grid-template-columns: 1fr;
        row-gap: 16px;
        padding: 18px 15px;
        border-radius: 10px;
    }

    .ew-view-form .ew-view-table {
        padding: 14px;
        border-radius: 10px;
    }

    .ew-view-form .ew-view-table > tbody {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ew-view-form .ew-view-table > tbody > tr {
        display: block;
    }

    .ew-view-form .ew-view-table > tbody > tr > td {
        display: block;
        padding: 9px 11px;
    }

    .ew-view-form .ew-view-table > tbody > tr > td:first-child {
        border-right: 0;
        border-bottom: 1px solid var(--labs-border-soft);
    }

    .ew-add-form .ew-radio,
    .ew-edit-form .ew-radio {
        align-items: stretch;
    }

    .ew-add-form .ew-radio .form-check,
    .ew-edit-form .ew-radio .form-check {
        flex: 1 1 calc(50% - 8px);
        justify-content: flex-start;
    }

    .ew-search-panel,
    .ew-basic-search,
    .ew-advanced-search,
    .ew-search-panel .card,
    .ew-basic-search .card,
    .ew-advanced-search .card {
        width: 100%;
    }

    .ew-search-panel .input-group,
    .ew-basic-search .input-group {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .ew-search-panel button[type="submit"],
    .ew-basic-search button[type="submit"],
    .ew-advanced-search button[type="submit"] {
        width: 100%;
    }

    .ew-list-form .ew-table {
        font-size: 0.82rem;
    }

    .ew-list-form .ew-table thead th,
    .ew-list-form .ew-table thead td,
    .ew-list-form .ew-table tbody td {
        padding: 8px 9px !important;
    }
}

/* --------------------------------------------------------------------------
   16. ESCALA TIPOGRAFICA COMPACTA E SEGURA
   Nao usa zoom: preserva os calculos nativos de layout do PHPMaker/AdminLTE.
   -------------------------------------------------------------------------- */

html {
    font-size: 80% !important;
}

body {
    font-size: 1rem;
    overflow-x: auto;
}

.content-header h1,
.ew-page-heading h1,
.page-title {
    font-size: clamp(1.55rem, 1.6vw, 2.1rem) !important;
}

/* Mantem cada tabela inteira e permite rolagem sem separar cabecalho e corpo. */
.ew-list-form,
.ew-list-form .ew-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.ew-list-form .ew-grid-middle-panel,
.ew-list-form .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scrollbar-width: thin;
    scrollbar-color: #9aa9b8 #edf1f5;
}

/* Componentes da dashboard que usam pixels nao acompanham a fonte raiz. */
.erp-dashboard-page .erp-dashboard-icon {
    font-size: 15px !important;
}

.erp-dashboard-page .erp-dashboard-label {
    font-size: 10px !important;
}

.erp-dashboard-page .erp-dashboard-value {
    font-size: 22px !important;
}

.erp-dashboard-page .erp-dashboard-value-money {
    font-size: 18px !important;
}

.erp-dashboard-page .erp-dashboard-note {
    font-size: 9px !important;
}

@media (max-width: 767.98px) {
    html {
        font-size: 87.5% !important;
    }

    .content-header h1,
    .ew-page-heading h1,
    .page-title {
        font-size: 1.45rem !important;
    }
}

/* --------------------------------------------------------------------------
   17. DASHBOARD FINAL - REFERENCIA DO PROTOTIPO
   Esta camada prevalece sobre as compatibilidades historicas das secoes 12/14.
   -------------------------------------------------------------------------- */

@media (min-width: 1101px) {
    body:not(.sidebar-collapse) .erp-dashboard-page {
        width: calc(100vw - 24rem) !important;
        max-width: calc(100vw - 24rem) !important;
    }

    body.sidebar-collapse .erp-dashboard-page {
        width: calc(100vw - 7rem) !important;
        max-width: calc(100vw - 7rem) !important;
    }

    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

.erp-dashboard-page {
    min-width: 0 !important;
    margin: 8px 0 22px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.erp-dashboard-page .erp-dashboard-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 16px !important;
    box-sizing: border-box !important;
}

.erp-dashboard-page .erp-dashboard-card {
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 126px !important;
    padding: 18px !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   DASHBOARD - SOMENTE CARDS
   --------------------------------------------------------------------------
   A VwDashboardList continua sendo a pagina hospedeira dos indicadores,
   mas a listagem nativa do PHPMaker fica oculta.
   ========================================================================== */

body:has(.erp-dashboard-page) .ew-list-form {
    display: none !important;
}

/* Evita espacos residuais da grade/listagem do dashboard. */
body:has(.erp-dashboard-page) .ew-list-form .ew-grid,
body:has(.erp-dashboard-page) form[id*="vw_dashboard"] .ew-grid,
body:has(.erp-dashboard-page) form[id*="VwDashboard"] .ew-grid,
.ew-content:has(.erp-dashboard-page) .ew-list-form {
    display: none !important;
}

@media (min-width: 768px) and (max-width: 1100px) {
    .erp-dashboard-page {
        width: 100% !important;
        max-width: 100% !important;
    }

    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767.98px) {
    .erp-dashboard-page {
        width: 100% !important;
        max-width: 100% !important;
    }

    .erp-dashboard-page .erp-dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}
/* ==========================================================================
   DASHBOARD - COMPACTAÇÃO DOS CARDS E VALORES MONETÁRIOS
   ========================================================================== */

/* Menor distância entre ícone e conteúdo */
.erp-dashboard-card {
    gap: 16px !important;
}

/* Ícone mantém o tamanho visual, mas sem reservar espaço excessivo */
.erp-dashboard-icon {
    flex: 0 0 auto !important;
    margin-right: 0 !important;
}

/* Permite que o conteúdo aproveite toda a largura restante */
.erp-dashboard-content {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* Valores comuns permanecem em uma linha */
.erp-dashboard-value {
    white-space: nowrap !important;
    line-height: 1.05 !important;
}

/* Valores monetários precisam comportar números maiores */
.erp-dashboard-value-money {
    font-size: clamp(1.25rem, 1.45vw, 1.80rem) !important;
    letter-spacing: -0.03em !important;
    white-space: nowrap !important;
}

/* --------------------------------------------------------------------------
   18. KPIs OPERACIONAIS DA PAGINA ENTRADAS
   Recupera o modelo anterior: quatro cards, icone circular e minigrafico.
   -------------------------------------------------------------------------- */

#entrada-kpis.erp-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 18px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 14px 0 22px !important;
}

#entrada-kpis .erp-kpi-card {
    min-width: 0 !important;
    min-height: 158px !important;
    padding: 20px !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 1px solid var(--labs-border-soft) !important;
    border-radius: 14px !important;
    box-shadow: var(--labs-shadow) !important;
}

#entrada-kpis .erp-kpi-content {
    display: flex !important;
    height: 100% !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

#entrada-kpis .erp-kpi-top {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

#entrada-kpis .erp-kpi-icon {
    flex: 0 0 52px !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    font-size: 20px !important;
}

#entrada-kpis .erp-kpi-title {
    margin-bottom: 5px !important;
    overflow: visible !important;
    color: var(--labs-text-soft) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.25 !important;
    text-overflow: clip !important;
    white-space: normal !important;
}

#entrada-kpis .erp-kpi-value {
    color: var(--labs-text) !important;
    font-size: 30px !important;
    font-weight: 750 !important;
    line-height: 1 !important;
}

#entrada-kpis .erp-kpi-bottom {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 12px !important;
    margin-top: 24px !important;
}

#entrada-kpis .erp-kpi-description {
    overflow: visible !important;
    color: #8b98aa !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    text-overflow: clip !important;
    white-space: normal !important;
}

#entrada-kpis .erp-kpi-trend {
    flex: 0 0 96px !important;
    width: 96px !important;
    height: 28px !important;
}

@media (min-width: 768px) and (max-width: 1100px) {
    #entrada-kpis.erp-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767.98px) {
    #entrada-kpis.erp-kpi-grid {
        grid-template-columns: 1fr !important;
    }

    #entrada-kpis .erp-kpi-card {
        min-height: 145px !important;
    }
}

/* ==========================================================================
   19. WORKFLOW E STATUS - PADRAO UNICO DO ERP
   Referencia visual: Inventario
   --------------------------------------------------------------------------
   Objetivo:
   - acao disponivel = botao compacto e solido
   - status atual = badge
   - classes antigas continuam aceitas durante a migracao
   ========================================================================== */

/* Container das acoes */
.erp-row-actions,
.erp-approval-actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    white-space: nowrap !important;
}

/* Botao padrao
   Suporta:
   - novo: .erp-action-btn
   - transicao: .erp-row-action
   - legado: .erp-workflow-btn / .erp-approval-btn
*/
.erp-action-btn,
.erp-row-action,
.erp-workflow-btn,
.erp-approval-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 30px !important;
    height: auto !important;

    padding: 6px 11px !important;

    border: 1px solid transparent !important;
    border-radius: 8px !important;

    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1 !important;

    text-decoration: none !important;
    white-space: nowrap !important;

    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.08) !important;

    transition:
        transform 0.15s ease,
        filter 0.15s ease,
        background-color 0.15s ease,
        border-color 0.15s ease !important;
}

.erp-action-btn i,
.erp-row-action i,
.erp-workflow-btn i,
.erp-approval-btn i {
    margin: 0 !important;
    font-size: 11px !important;
}

.erp-action-btn:hover,
.erp-row-action:hover,
.erp-workflow-btn:hover,
.erp-approval-btn:hover {
    transform: translateY(-1px);
    text-decoration: none !important;
}

/* Acao primaria */
.erp-action-primary,
.erp-row-action-primary,
.erp-approval-btn.is-approve {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.erp-action-primary:hover,
.erp-row-action-primary:hover,
.erp-approval-btn.is-approve:hover {
    color: #fff !important;
    background: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
}

/* Sucesso */
.erp-action-success,
.erp-row-action-success,
.erp-workflow-btn-success {
    color: #fff !important;
    background: #198754 !important;
    border-color: #198754 !important;
}

.erp-action-success:hover,
.erp-row-action-success:hover,
.erp-workflow-btn-success:hover {
    color: #fff !important;
    background: #146c43 !important;
    border-color: #146c43 !important;
}

/* Rejeitar / destrutivo */
.erp-action-danger,
.erp-row-action-danger,
.erp-row-action-danger-soft,
.erp-workflow-btn-danger,
.erp-approval-btn.is-reject {
    color: #fff !important;
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.erp-action-danger:hover,
.erp-row-action-danger:hover,
.erp-row-action-danger-soft:hover,
.erp-workflow-btn-danger:hover,
.erp-approval-btn.is-reject:hover {
    color: #fff !important;
    background: #bb2d3b !important;
    border-color: #b02a37 !important;
}

/* Reabrir / atencao */
.erp-action-warning,
.erp-row-action-warning,
.erp-workflow-btn-warning {
    color: #fff !important;
    background: #c58b00 !important;
    border-color: #c58b00 !important;
}

.erp-action-warning:hover,
.erp-row-action-warning:hover,
.erp-workflow-btn-warning:hover {
    color: #fff !important;
    background: #a67600 !important;
    border-color: #a67600 !important;
}

/* --------------------------------------------------------------------------
   Status: sempre badge, nunca botao
   -------------------------------------------------------------------------- */

.erp-status-badge,
.erp-row-state,
.erp-workflow-badge,
.erp-validade-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;

    min-height: 22px !important;
    height: auto !important;

    padding: 4px 9px !important;

    border: 1px solid transparent !important;
    border-radius: 999px !important;

    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;

    white-space: nowrap !important;

    box-shadow: none !important;
    text-shadow: none !important;
}

.erp-status-badge i,
.erp-row-state i,
.erp-workflow-badge i {
    margin: 0 !important;
    font-size: 10px !important;
}

/* Rascunho */
.erp-status-draft {
    color: #596576 !important;
    background: #eef1f5 !important;
    border-color: #dde3ea !important;
}

/* Pendente / aguardando */
.erp-status-pending,
.erp-row-state-info,
.erp-workflow-badge-info {
    color: #255fb5 !important;
    background: #eef5ff !important;
    border-color: #c9dcff !important;
}

/* Em contagem / processamento operacional */
.erp-status-counting {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

/* Aprovado */
.erp-status-approved,
.erp-row-state-success,
.erp-workflow-badge-success {
    color: #087443 !important;
    background: #eaf8f2 !important;
    border-color: #bde8d7 !important;
}

/* Confirmado */
.erp-status-confirmed {
    color: #087443 !important;
    background: #eaf8f2 !important;
    border-color: #bde8d7 !important;
}

/* Rejeitado */
.erp-status-rejected,
.erp-workflow-badge-danger {
    color: #b4232f !important;
    background: #fdecee !important;
    border-color: #f4cbd0 !important;
}

/* Cancelado / neutro */
.erp-status-cancelled,
.erp-status-default,
.erp-row-state-muted,
.erp-workflow-badge-muted {
    color: #667085 !important;
    background: #f2f4f7 !important;
    border-color: #e4e7ec !important;
}

/* Badge legado de alerta */
.erp-workflow-badge-warning {
    color: #7a5900 !important;
    background: #fff3d6 !important;
    border-color: #efd58a !important;
}

/* --------------------------------------------------------------------------
   Coluna workflow_actions
   -------------------------------------------------------------------------- */

.ew-list-form th[data-name="workflow_actions"],
.ew-list-form td[data-name="workflow_actions"] {
    width: auto !important;
    min-width: 130px !important;
    max-width: none !important;

    overflow: visible !important;

    text-align: left !important;
    white-space: nowrap !important;
}

/* Impede a regra generica das ListOptions de transformar workflow em icone 32x32 */
.ew-list-form td[data-name="workflow_actions"] > a,
.ew-list-form td[data-name="workflow_actions"] > .btn,
.ew-list-form td[data-name="workflow_actions"] a.erp-action-btn,
.ew-list-form td[data-name="workflow_actions"] a.erp-row-action,
.ew-list-form td[data-name="workflow_actions"] a.erp-workflow-btn,
.ew-list-form td[data-name="workflow_actions"] a.erp-approval-btn {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    height: auto !important;
    min-height: 30px !important;

    padding: 6px 11px !important;
}

/* --------------------------------------------------------------------------
   Acao da prontidao regulatoria
   -------------------------------------------------------------------------- */

.rdc-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-height: 30px;
    min-width: 88px;

    padding: 6px 11px;

    color: #fff !important;
    background: var(--labs-blue);

    border: 1px solid var(--labs-blue);
    border-radius: 8px;

    font-size: 11px;
    font-weight: 600;

    text-decoration: none !important;

    transition:
        transform .15s ease,
        background-color .15s ease,
        border-color .15s ease;
}

.rdc-action-link:hover {
    color: #fff !important;
    background: var(--labs-dark);
    border-color: var(--labs-dark);

    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Prontidao regulatoria: sem paginacao visual
   -------------------------------------------------------------------------- */

.vw-prontidao-regulatoria
.card-footer.ew-grid-lower-panel,
.vw-prontidao-regulatoria
.ew-pager {
    display: none !important;
}


/* ==========================================================================
   20. VALIDADE E BLOQUEIO DE LOTES
   Mantidos como semantica independente do workflow
   ========================================================================== */

.erp-validade-vencido,
.erp-validade-critico {
    color: #b42318 !important;
    background: #fdecec !important;
    border-color: #f4c7c3 !important;
}

.erp-validade-alerta {
    color: #b25f00 !important;
    background: #fff3e0 !important;
    border-color: #f4d0a0 !important;
}

.erp-validade-atencao {
    color: #946200 !important;
    background: #fff8dc !important;
    border-color: #efdf9b !important;
}

.erp-validade-ok {
    color: #087443 !important;
    background: #e8f5ee !important;
    border-color: #c6e6d5 !important;
}

.erp-lote-bloqueado {
    position: relative !important;
    color: #c92a2a !important;
    font-weight: 700 !important;
}

.erp-lote-bloqueado::before {
    content: "\\f023";
    margin-right: 6px !important;
    color: #c92a2a !important;
    font-family: "Font Awesome 6 Free" !important;
    font-size: 11px !important;
    font-weight: 900 !important;
}

/* ==========================================================
   WORKFLOW - PESO TIPOGRAFICO IGUAL AO INVENTARIO
   ========================================================== */

.ew-list-form
td[data-name="workflow_actions"]
.erp-action-btn,

.ew-list-form
td[data-name="workflow_actions"]
.erp-action-btn span {

    font-family:
        var(--bs-body-font-family),
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif !important;

    font-size: 10.5px !important;

    font-weight: 400 !important;

    font-style: normal !important;

    letter-spacing: 0 !important;

    text-transform: none !important;
}

/* ==========================================================================
   21. LINK PARA TABELA RELACIONADA - SOMENTE ICONE
   Atua exclusivamente em URLs master/detail, sem alcançar outras acoes.
   ========================================================================== */

.ew-list-form a[href*="showmaster="] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    color: var(--labs-blue) !important;
    background: var(--labs-soft) !important;
    border: 1px solid #c9deef !important;
    border-radius: 8px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    white-space: nowrap !important;
    text-decoration: none !important;
}

/* Remove somente a legenda interna do link relacionado. */
.ew-list-form a[href*="showmaster="] span {
    display: none !important;
}

/* Oculta o desenho nativo para evitar dois icones sobrepostos. */
.ew-list-form a[href*="showmaster="] i,
.ew-list-form a[href*="showmaster="] svg {
    display: none !important;
}

/* Desenha um unico icone para o link relacionado. */
body .ew-list-form a[href*="showmaster="]::before,
body .ew-list-form td[data-name^="detail_"] a[href*="showmaster="]::before {
    content: "\f03a" !important;
    display: inline-block !important;
    color: currentColor !important;
    font-family: "Font Awesome 6 Free" !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

.ew-list-form a[href*="showmaster="]:hover {
    color: var(--labs-dark) !important;
    background: var(--labs-soft-strong) !important;
    border-color: #9fc4df !important;
}


/* ==========================================================================
   22. WORKFLOW COMPACTO - PADRAO VISUAL COTACAO DE COMPRAS
   --------------------------------------------------------------------------
   Camada final de compatibilidade para paginas que utilizam:
   - .erp-workflow-btn
   - .erp-workflow-primary
   - .erp-workflow-success
   - .erp-workflow-danger
   - .erp-workflow-warning

   Esta camada prevalece sobre a secao 19 e iguala proporcao, tipografia,
   bordas e ausencia de relevo ao padrao visual das acoes de Cotacao.
   ========================================================================== */

/* Botao compacto de workflow */
.erp-workflow-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    height: 32px !important;
    min-height: 32px !important;

    padding: 4px 10px !important;
    margin-top: 1px !important;
    margin-bottom: 1px !important;

    border: 1px solid #cfd8e3 !important;
    border-radius: 8px !important;

    background: #fff !important;

    font-family:
        var(--bs-body-font-family),
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif !important;

    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;

    text-decoration: none !important;
    white-space: nowrap !important;

    box-shadow: none !important;
    transform: none !important;

    transition:
        color .15s ease,
        background-color .15s ease,
        border-color .15s ease !important;
}

/* Texto do botao */
.erp-workflow-btn span {
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* Icone do botao */
.erp-workflow-btn i,
.erp-workflow-btn .ew-icon {
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1 !important;
}

/* Remove efeitos antigos */
.erp-workflow-btn:hover,
.erp-workflow-btn:focus,
.erp-workflow-btn:active {
    box-shadow: none !important;
    transform: none !important;
    text-decoration: none !important;
}

/* Primario em contorno - mesmo papel visual de "Ver Cotacao" */
.erp-workflow-primary {
    color: var(--labs-blue) !important;
    background: #fff !important;
    border-color: var(--labs-blue) !important;
}

.erp-workflow-primary:hover,
.erp-workflow-primary:focus {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

/* Sucesso/açao principal - mesmo peso visual das acoes destacadas da Cotacao */
.erp-workflow-success {
    color: #fff !important;
    background: #1388c7 !important;
    border-color: #1388c7 !important;
}

.erp-workflow-success:hover,
.erp-workflow-success:focus {
    color: #fff !important;
    background: #1177ae !important;
    border-color: #1177ae !important;
}

/* Cancelar/destrutivo: contorno neutro, sem botao vermelho preenchido */
.erp-workflow-danger {
    color: #344054 !important;
    background: #fff !important;
    border-color: #cfd8e3 !important;
}

.erp-workflow-danger:hover,
.erp-workflow-danger:focus {
    color: #b4232f !important;
    background: #fff6f6 !important;
    border-color: #d9a4aa !important;
}

/* Atencao */
.erp-workflow-warning {
    color: #7a5900 !important;
    background: #fff8e6 !important;
    border-color: #e7cf8a !important;
}

.erp-workflow-warning:hover,
.erp-workflow-warning:focus {
    color: #684a00 !important;
    background: #fff1c9 !important;
    border-color: #d9bc64 !important;
}

/* Compatibilidade com nomes legados ainda usados em alguns eventos */
.erp-workflow-btn-success {
    color: #fff !important;
    background: #1388c7 !important;
    border-color: #1388c7 !important;
}

.erp-workflow-btn-danger {
    color: #344054 !important;
    background: #fff !important;
    border-color: #cfd8e3 !important;
}

.erp-workflow-btn-warning {
    color: #7a5900 !important;
    background: #fff8e6 !important;
    border-color: #e7cf8a !important;
}

/* Coluna de workflow: nao limitar a largura nem transformar em botao quadrado */
.ew-list-form th[data-name="workflow_actions"],
.ew-list-form td[data-name="workflow_actions"] {
    width: auto !important;
    min-width: 130px !important;
    max-width: none !important;
    overflow: visible !important;
    text-align: left !important;
    white-space: nowrap !important;
}

.ew-list-form td[data-name="workflow_actions"] > a.erp-workflow-btn,
.ew-list-form td[data-name="workflow_actions"] a.erp-workflow-btn,
.ew-list-form td[data-name="workflow_actions"] button.erp-workflow-btn,
.ew-list-form td[data-name="workflow_actions"] .erp-workflow-btn {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 4px 10px !important;
    margin: 1px 4px 1px 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

/* Badge informativo do workflow permanece compacto e sem aparencia clicavel */
.erp-workflow-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-height: 24px !important;
    padding: 4px 8px !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    box-shadow: none !important;
}

.erp-workflow-badge span {
    font-weight: 500 !important;
}


/* ==========================================================================
   23. DASHBOARD - AJUSTE FINAL DE ESPACAMENTO E VALOR MONETARIO
   --------------------------------------------------------------------------
   Corrige regras anteriores de maior especificidade que mantinham:
   - margin-right: 15px no icone;
   - gap: 16px no card;
   - font-size fixo maior no valor monetario.
   ========================================================================== */

.erp-dashboard-page .erp-dashboard-card {
    gap: 9px !important;
    padding: 16px !important;
}

.erp-dashboard-page .erp-dashboard-icon {
    flex: 0 0 48px !important;
    width: 48px !important;
    height: 48px !important;
    margin-right: 0 !important;
}

.erp-dashboard-page .erp-dashboard-content {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.erp-dashboard-page .erp-dashboard-value {
    max-width: 100% !important;
    white-space: nowrap !important;
    line-height: 1.05 !important;
}

.erp-dashboard-page .erp-dashboard-value-money {
    max-width: 100% !important;
    font-size: 16px !important;
    letter-spacing: -0.035em !important;
    white-space: nowrap !important;
}

@media (max-width: 1400px) and (min-width: 1101px) {
    .erp-dashboard-page .erp-dashboard-card {
        gap: 7px !important;
        padding: 14px !important;
    }

    .erp-dashboard-page .erp-dashboard-icon {
        flex-basis: 44px !important;
        width: 44px !important;
        height: 44px !important;
    }

    .erp-dashboard-page .erp-dashboard-value-money {
        font-size: 15px !important;
    }
}

/* ==========================================================================
   24. LAYOUT UNIFICADO - SEARCH, CARDS, LISTAGEM E ACOES
   --------------------------------------------------------------------------
   Camada final para todas as paginas List do PHPMaker 2025.
   Objetivos:
   - usar a mesma largura util no search, nos KPIs e na listagem;
   - impedir que fit-content ou larguras historicas fragmentem a pagina;
   - padronizar todas as familias de botoes de workflow ja existentes;
   - preservar a rolagem horizontal dentro da grade em tabelas extensas.
   ========================================================================== */

/* Todos os blocos operacionais usam exatamente o mesmo limite da pagina. */
.content-wrapper > .content,
.content-wrapper > .content > .container-fluid,
.ew-content,
.ew-content > .container-fluid,
#ew-page-header,
#ew-page-header .ew-page-header,
.ew-list,
.ew-list-form,
.ew-list-form .ew-grid,
.ew-list-form .ew-grid-middle-panel,
.ew-list-form .table-responsive,
form[id$="srch"],
form[name$="srch"],
.ew-search-panel,
.ew-basic-search,
.ew-advanced-search,
.ew-search-panel > .card,
.ew-basic-search > .card,
.ew-advanced-search > .card,
#entrada-kpis.erp-kpi-grid,
.erp-kpi-grid,
.erp-dashboard-page,
.erp-dashboard-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* Neutraliza limites historicos aplicados a wrappers genericos de filtro. */
form[id$="srch"] .ew-search-panel,
form[name$="srch"] .ew-search-panel,
form[id$="srch"] .card,
form[name$="srch"] .card,
.ew-search-panel.card,
.ew-basic-search.card,
.ew-advanced-search.card {
    width: 100% !important;
    max-width: none !important;
}

/* Ritmo vertical unico entre as tres camadas da pagina List. */
form[id$="srch"],
form[name$="srch"],
.ew-search-panel,
.ew-basic-search,
.ew-advanced-search {
    margin: 0 0 16px !important;
}

#entrada-kpis.erp-kpi-grid,
.erp-kpi-grid,
.erp-dashboard-page,
.erp-dashboard-grid {
    margin-top: 0 !important;
    margin-bottom: 16px !important;
}

.ew-list-form,
.ew-list-form .ew-grid {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Search ocupa a largura total, mas campos continuam compactos. */
.ew-search-panel .card-body,
.ew-basic-search .card-body,
.ew-advanced-search .card-body,
form[id$="srch"] .card-body,
form[name$="srch"] .card-body {
    width: 100% !important;
    padding: 14px 16px !important;
    box-sizing: border-box !important;
}

.ew-search-panel .row,
.ew-basic-search .row,
.ew-advanced-search .row,
form[id$="srch"] .row,
form[name$="srch"] .row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-items: end !important;
    column-gap: 12px !important;
    row-gap: 10px !important;
}

.ew-search-panel .input-group,
.ew-basic-search .input-group,
.ew-advanced-search .input-group,
form[id$="srch"] .input-group,
form[name$="srch"] .input-group {
    width: min(100%, 460px) !important;
    min-width: 260px !important;
    max-width: 460px !important;
}

/* A grade preenche a area util; somente o painel interno pode rolar. */
.ew-list-form .ew-grid {
    overflow: hidden !important;
}

.ew-list-form .ew-grid-middle-panel,
.ew-list-form .table-responsive {
    display: block !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.ew-list-form .ew-table,
.ew-list-form table.ew-table,
.ew-list-form .table-responsive > table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

/* Entradas deixa de ter cards superdimensionados em relacao ao search/grid. */
#entrada-kpis.erp-kpi-grid {
    gap: 14px !important;
}

#entrada-kpis .erp-kpi-card {
    min-height: 132px !important;
    padding: 16px !important;
}

#entrada-kpis .erp-kpi-top {
    gap: 12px !important;
}

#entrada-kpis .erp-kpi-icon {
    flex-basis: 44px !important;
    width: 44px !important;
    height: 44px !important;
    font-size: 17px !important;
}

#entrada-kpis .erp-kpi-title {
    margin-bottom: 3px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
}

#entrada-kpis .erp-kpi-value {
    font-size: 26px !important;
}

#entrada-kpis .erp-kpi-bottom {
    gap: 10px !important;
    margin-top: 16px !important;
}

#entrada-kpis .erp-kpi-description {
    font-size: 10.5px !important;
}

#entrada-kpis .erp-kpi-trend {
    flex-basis: 78px !important;
    width: 78px !important;
    height: 24px !important;
}

/* --------------------------------------------------------------------------
   Botoes de workflow: uma unica metrica para classes novas e legadas.
   -------------------------------------------------------------------------- */
.erp-action-group,
.erp-row-actions,
.erp-approval-actions,
.ew-list-form td[data-name="workflow_actions"] .ew-btn-group {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-wrap: wrap !important;
    white-space: nowrap !important;
}

.erp-action-btn,
.erp-row-action,
.erp-workflow-btn,
.erp-approval-btn,
.ew-list-form td[data-name="workflow_actions"] a.btn,
.ew-list-form td[data-name="workflow_actions"] button.btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 4px 10px !important;
    margin: 1px 4px 1px 0 !important;
    border-width: 1px !important;
    border-style: solid !important;
    border-radius: 8px !important;
    font-family: var(--bs-body-font-family), -apple-system, BlinkMacSystemFont,
        "Segoe UI", Arial, sans-serif !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    transform: none !important;
}

.erp-action-btn span,
.erp-row-action span,
.erp-workflow-btn span,
.erp-approval-btn span,
.ew-list-form td[data-name="workflow_actions"] a.btn span,
.ew-list-form td[data-name="workflow_actions"] button.btn span {
    font: inherit !important;
}

.erp-action-btn i,
.erp-action-btn .ew-icon,
.erp-row-action i,
.erp-row-action .ew-icon,
.erp-workflow-btn i,
.erp-workflow-btn .ew-icon,
.erp-approval-btn i,
.erp-approval-btn .ew-icon,
.ew-list-form td[data-name="workflow_actions"] .btn i,
.ew-list-form td[data-name="workflow_actions"] .btn .ew-icon {
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1 !important;
}

/* Primaria e sucesso operacional usam o azul institucional. */
.erp-action-primary,
.erp-action-success,
.erp-row-action-primary,
.erp-row-action-success,
.erp-workflow-primary,
.erp-workflow-success,
.erp-workflow-btn-success,
.erp-approval-btn.is-approve,
.ew-list-form td[data-name="workflow_actions"] .btn-primary,
.ew-list-form td[data-name="workflow_actions"] .btn-success {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.erp-action-primary:hover,
.erp-action-success:hover,
.erp-row-action-primary:hover,
.erp-row-action-success:hover,
.erp-workflow-primary:hover,
.erp-workflow-success:hover,
.erp-workflow-btn-success:hover,
.erp-approval-btn.is-approve:hover,
.ew-list-form td[data-name="workflow_actions"] .btn-primary:hover,
.ew-list-form td[data-name="workflow_actions"] .btn-success:hover {
    color: #fff !important;
    background: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
}

/* Destrutiva permanece sem preenchimento vermelho permanente. */
.erp-action-danger,
.erp-row-action-danger,
.erp-row-action-danger-soft,
.erp-workflow-danger,
.erp-workflow-btn-danger,
.erp-approval-btn.is-reject,
.ew-list-form td[data-name="workflow_actions"] .btn-danger {
    color: #b4232f !important;
    background: #fff !important;
    border-color: #d9a4aa !important;
}

.erp-action-danger:hover,
.erp-row-action-danger:hover,
.erp-row-action-danger-soft:hover,
.erp-workflow-danger:hover,
.erp-workflow-btn-danger:hover,
.erp-approval-btn.is-reject:hover,
.ew-list-form td[data-name="workflow_actions"] .btn-danger:hover {
    color: #9f1f2c !important;
    background: #fff6f6 !important;
    border-color: #c97882 !important;
}

/* Atencao usa amarelo apenas como semantica, com baixo peso visual. */
.erp-action-warning,
.erp-row-action-warning,
.erp-workflow-warning,
.erp-workflow-btn-warning,
.ew-list-form td[data-name="workflow_actions"] .btn-warning {
    color: #7a5900 !important;
    background: #fff8e6 !important;
    border-color: #e7cf8a !important;
}

.erp-action-warning:hover,
.erp-row-action-warning:hover,
.erp-workflow-warning:hover,
.erp-workflow-btn-warning:hover,
.ew-list-form td[data-name="workflow_actions"] .btn-warning:hover {
    color: #684a00 !important;
    background: #fff1c9 !important;
    border-color: #d9bc64 !important;
}

.ew-list-form th[data-name="workflow_actions"],
.ew-list-form td[data-name="workflow_actions"] {
    width: auto !important;
    min-width: 126px !important;
    max-width: none !important;
    overflow: visible !important;
    text-align: left !important;
    white-space: nowrap !important;
}

/* Mantem botoes nativos de visualizar/editar/excluir como icones compactos. */
.ew-list-form td[data-name="view"] .btn,
.ew-list-form td[data-name="edit"] .btn,
.ew-list-form td[data-name="copy"] .btn,
.ew-list-form td[data-name="delete"] .btn,
.ew-list-form td[data-name="view"] a,
.ew-list-form td[data-name="edit"] a,
.ew-list-form td[data-name="copy"] a,
.ew-list-form td[data-name="delete"] a {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

/* Responsividade: mesma largura e fluxo vertical em qualquer breakpoint. */
@media (max-width: 1100px) {
    #entrada-kpis.erp-kpi-grid,
    .erp-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767.98px) {
    .content-wrapper > .content,
    .content-wrapper > .content > .container-fluid,
    .ew-content,
    .ew-content > .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .ew-search-panel .row,
    .ew-basic-search .row,
    .ew-advanced-search .row,
    form[id$="srch"] .row,
    form[name$="srch"] .row {
        display: block !important;
    }

    .ew-search-panel .input-group,
    .ew-basic-search .input-group,
    .ew-advanced-search .input-group,
    form[id$="srch"] .input-group,
    form[name$="srch"] .input-group,
    .ew-search-panel button[type="submit"],
    .ew-basic-search button[type="submit"],
    .ew-advanced-search button[type="submit"],
    form[id$="srch"] button[type="submit"],
    form[name$="srch"] button[type="submit"] {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    #entrada-kpis.erp-kpi-grid,
    .erp-kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    #entrada-kpis .erp-kpi-card {
        min-height: 118px !important;
    }

    .erp-action-group,
    .erp-row-actions,
    .erp-approval-actions,
    .ew-list-form td[data-name="workflow_actions"] .ew-btn-group {
        flex-wrap: nowrap !important;
    }
}

/* ================================================================
   25. LISTAGEM — EXPANSÃO REAL DO CONTÊINER
   Corrige grades que permanecem com a largura intrínseca da tabela,
   mesmo quando pesquisa e cards já ocupam toda a área disponível.
   ================================================================ */

.content-wrapper .content > .container-fluid > #ew-list,
.content-wrapper .content > .container-fluid > .ew-list,
#ew-list,
.ew-list {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
}

#ew-list > form.ew-list-form,
.ew-list > form.ew-list-form,
form.ew-form.ew-list-form,
form[id$="list"].ew-form,
form[id$="List"].ew-form {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
}

#ew-list .ew-grid,
.ew-list .ew-grid,
.ew-list-form > .ew-grid,
.ew-list-form > div.ew-grid.card,
div.ew-grid.card,
.card.ew-grid {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
}

#ew-list .ew-grid-middle-panel,
.ew-list .ew-grid-middle-panel,
#ew-list .table-responsive,
.ew-list .table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

#ew-list table.ew-table,
.ew-list table.ew-table,
#ew-list .table-responsive > table,
.ew-list .table-responsive > table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: none !important;
    margin-right: 0 !important;
    table-layout: auto !important;
}

/* ==========================================================================
   26. BOTOES GLOBAIS - CONTRASTE E CONSISTENCIA
   --------------------------------------------------------------------------
   Corrige botoes Bootstrap/PHPMaker que herdavam fundo branco de regras
   especificas (ex.: .erp-workflow-btn) sem herdar a cor correspondente.
   Mantem as cores semanticas e garante contraste em estado normal, hover,
   focus e active em paginas nativas e customizadas.
   ========================================================================== */

/* Base: botoes nunca devem herdar cor invisivel do container/pagina. */
.btn {
    text-decoration: none !important;
}

/* Primario preenchido */
.btn.btn-primary {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.btn.btn-primary:hover,
.btn.btn-primary:focus,
.btn.btn-primary:active,
.btn.btn-primary.active,
.show > .btn.btn-primary.dropdown-toggle {
    color: #fff !important;
    background: var(--labs-dark) !important;
    border-color: var(--labs-dark) !important;
}

/* Primario em contorno */
.btn.btn-outline-primary {
    color: var(--labs-blue) !important;
    background: #fff !important;
    border-color: var(--labs-blue) !important;
}

.btn.btn-outline-primary:hover,
.btn.btn-outline-primary:focus,
.btn.btn-outline-primary:active,
.btn.btn-outline-primary.active,
.show > .btn.btn-outline-primary.dropdown-toggle {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

/* Secundario em contorno */
.btn.btn-outline-secondary {
    color: #475467 !important;
    background: #fff !important;
    border-color: #cfd8e3 !important;
}

.btn.btn-outline-secondary:hover,
.btn.btn-outline-secondary:focus,
.btn.btn-outline-secondary:active,
.btn.btn-outline-secondary.active {
    color: var(--labs-dark) !important;
    background: var(--labs-soft) !important;
    border-color: #aebdca !important;
}

/* Sucesso */
.btn.btn-success {
    color: #fff !important;
    background: #198754 !important;
    border-color: #198754 !important;
}

.btn.btn-success:hover,
.btn.btn-success:focus,
.btn.btn-success:active,
.btn.btn-success.active {
    color: #fff !important;
    background: #146c43 !important;
    border-color: #146c43 !important;
}

.btn.btn-outline-success {
    color: #16704c !important;
    background: #fff !important;
    border-color: #198754 !important;
}

.btn.btn-outline-success:hover,
.btn.btn-outline-success:focus,
.btn.btn-outline-success:active,
.btn.btn-outline-success.active {
    color: #fff !important;
    background: #198754 !important;
    border-color: #198754 !important;
}

/* Perigo */
.btn.btn-danger {
    color: #fff !important;
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.btn.btn-danger:hover,
.btn.btn-danger:focus,
.btn.btn-danger:active,
.btn.btn-danger.active {
    color: #fff !important;
    background: #bb2d3b !important;
    border-color: #b02a37 !important;
}

.btn.btn-outline-danger {
    color: #b4232f !important;
    background: #fff !important;
    border-color: #d9a4aa !important;
}

.btn.btn-outline-danger:hover,
.btn.btn-outline-danger:focus,
.btn.btn-outline-danger:active,
.btn.btn-outline-danger.active {
    color: #fff !important;
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

/* Alerta */
.btn.btn-warning {
    color: #3f3200 !important;
    background: #ffc107 !important;
    border-color: #ffc107 !important;
}

.btn.btn-warning:hover,
.btn.btn-warning:focus,
.btn.btn-warning:active,
.btn.btn-warning.active {
    color: #3f3200 !important;
    background: #e0a800 !important;
    border-color: #d39e00 !important;
}

.btn.btn-outline-warning {
    color: #7a5900 !important;
    background: #fff8e6 !important;
    border-color: #e7cf8a !important;
}

.btn.btn-outline-warning:hover,
.btn.btn-outline-warning:focus,
.btn.btn-outline-warning:active,
.btn.btn-outline-warning.active {
    color: #684a00 !important;
    background: #fff1c9 !important;
    border-color: #d9bc64 !important;
}

/* Info */
.btn.btn-info {
    color: #fff !important;
    background: var(--labs-sky) !important;
    border-color: var(--labs-sky) !important;
}

.btn.btn-outline-info {
    color: #0b719f !important;
    background: #fff !important;
    border-color: var(--labs-sky) !important;
}

.btn.btn-outline-info:hover,
.btn.btn-outline-info:focus,
.btn.btn-outline-info:active,
.btn.btn-outline-info.active {
    color: #fff !important;
    background: var(--labs-sky) !important;
    border-color: var(--labs-sky) !important;
}

/* Light e links precisam continuar legiveis sobre fundos claros. */
.btn.btn-light {
    color: #344054 !important;
    background: #f8f9fa !important;
    border-color: #d8e2ec !important;
}

.btn.btn-link {
    color: var(--labs-blue) !important;
    background: transparent !important;
    border-color: transparent !important;
}

.btn.btn-link:hover,
.btn.btn-link:focus {
    color: var(--labs-dark) !important;
}

/* --------------------------------------------------------------------------
   Compatibilidade entre Bootstrap e o padrao de workflow do ERP.
   A classe Bootstrap define a semantica quando estiver combinada com
   .erp-workflow-btn. Isto corrige casos como DANFE/XML.
   -------------------------------------------------------------------------- */

.erp-workflow-btn.btn-primary {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.erp-workflow-btn.btn-outline-primary {
    color: var(--labs-blue) !important;
    background: #fff !important;
    border-color: var(--labs-blue) !important;
}

.erp-workflow-btn.btn-outline-primary:hover,
.erp-workflow-btn.btn-outline-primary:focus,
.erp-workflow-btn.btn-outline-primary:active {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.erp-workflow-btn.btn-outline-secondary {
    color: #475467 !important;
    background: #fff !important;
    border-color: #cfd8e3 !important;
}

.erp-workflow-btn.btn-outline-secondary:hover,
.erp-workflow-btn.btn-outline-secondary:focus,
.erp-workflow-btn.btn-outline-secondary:active {
    color: var(--labs-dark) !important;
    background: var(--labs-soft) !important;
    border-color: #aebdca !important;
}

/* Classes ERP explicitas continuam tendo precedencia semantica. */
.erp-workflow-btn.erp-workflow-primary {
    color: var(--labs-blue) !important;
    background: #fff !important;
    border-color: var(--labs-blue) !important;
}

.erp-workflow-btn.erp-workflow-primary:hover,
.erp-workflow-btn.erp-workflow-primary:focus {
    color: #fff !important;
    background: var(--labs-blue) !important;
    border-color: var(--labs-blue) !important;
}

.erp-workflow-btn.erp-workflow-success,
.erp-workflow-btn.erp-workflow-btn-success {
    color: #fff !important;
    background: var(--labs-sky) !important;
    border-color: var(--labs-sky) !important;
}

.erp-workflow-btn.erp-workflow-danger,
.erp-workflow-btn.erp-workflow-btn-danger {
    color: #344054 !important;
    background: #fff !important;
    border-color: #cfd8e3 !important;
}

.erp-workflow-btn.erp-workflow-warning,
.erp-workflow-btn.erp-workflow-btn-warning {
    color: #7a5900 !important;
    background: #fff8e6 !important;
    border-color: #e7cf8a !important;
}

/* Estado desabilitado: visivel, mas claramente indisponivel. */
.btn:disabled,
.btn.disabled,
fieldset:disabled .btn {
    opacity: 0.58 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
}

/* Icones acompanham a cor calculada do proprio botao. */
.btn > i,
.btn > .ew-icon,
.btn > svg {
    color: currentColor !important;
}

