@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/*
Responsive HTML Table With Pure CSS - Web Design/UI Design

Code written by:
👨🏻‍⚕️ Coding Design (Jeet Saru)

> You can do whatever you want with the code. However if you love my content, you can **SUBSCRIBED** my YouTube Channel.

🌎link: www.youtube.com/codingdesign 
*/

* {
    /*margin: 0;*/
    padding: 0;

    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

@media print {

    .table,
    .table__body {
        overflow: visible;
        height: auto !important;
        width: auto !important;
    }
}

/*@page {
    size: landscape;
    margin: 0; 
}*/

:root {
    /* Light Theme (Padrão) */
    --bg-primary: #f8f9fa;
    --bg-navbar: #ffffff;
    --bg-table-body: #ffffff;
    --bg-sidebar: #f8f9fa;
    --bg-thead: #d5d1defe;
    --bg-row-even: #0000000b;
    --bg-row-hover: #00000005;
    --text-primary: #333;
    --text-secondary: #6c757d;
    --border-color: #ccc;
    --card-shadow: 0 .4rem .8rem rgba(0, 0, 0, 0.15);
    --blue: #2a2185;
    --white: #ffffff;
    --form-label-color: #495057;
    --primary-color: #2a2185;
    --primary-color-rgb: 42, 33, 133;
}

/* Zebrado dinâmico que respeita linhas de destaque */
tr.row-even:not(.estoque-vermelho) {
    background-color: var(--bg-row-even) !important;
}

body.dark-theme {
    /* Dark Theme (Premium) */
    --bg-primary: #0b0f19;
    --bg-navbar: #111827;
    --bg-table-body: #0f172a;
    --bg-sidebar: #2a2185;
    /* Mantém o azul premium na sidebar */
    --bg-thead: #1e293b;
    --bg-row-even: rgba(255, 255, 255, 0.03);
    --bg-row-hover: rgba(255, 255, 255, 0.07);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    --white: var(--bg-primary);
    /* Em dark mode, var(--white) segue o fundo escuro */
    --form-label-color: #cbd5e1;
}

body {
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, color 0.3s;
}

main.table {
    display: flex;
    flex-direction: column;
    width: 96vw;
    height: 96vh;
    background-color: var(--bg-primary);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    border-radius: .8rem;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}


/* Mantém a navbar dentro do main.table */
main.table .navbar {
    flex-shrink: 0;
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Ajuste visual para manter a proporção */
.navbar .btn {
    font-size: 0.85rem;
    padding: 4px 10px;
    min-width: 75px;
    white-space: nowrap;
}

/* Faz o conteúdo quebrar graciosamente quando faltar espaço */
.navbar .d-flex.flex-wrap {
    gap: 5px;
    row-gap: 6px;
}

.table__header {
    width: 100%;
    height: 10%;
    background-color: var(--bg-primary);
    padding: .8rem 1rem;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table__header .input-group {
    width: 35%;
    height: 100%;
    background-color: var(--bg-primary);
    padding: 0 .8rem;
    border-radius: 2rem;

    display: flex;
    justify-content: center;
    align-items: center;

    transition: .2s;
    border: 1px solid var(--border-color);
}

.table__header .input-group:hover {
    width: 45%;
    background-color: var(--bg-row-hover);
    box-shadow: 0 .1rem .4rem #0002;
}

.table__header .input-group img {
    width: 1.2rem;
    height: 1.2rem;
}

.table__header .input-group input {
    width: 100%;
    padding: 0 .5rem 0 .3rem;
    background-color: transparent;
    border: none;
    outline: none;
}

.table__body {
    flex: 1;
    /* overflow-y: auto; */
    padding: 1rem;
    background-color: var(--bg-table-body);
}

.table-wrapper {

    max-height: 400px;
    /* Janela dos itens do tbody */
    overflow-y: auto;
    /* Enables vertical scroll */
    width: 99%;
    overflow-x: hidden;
    /* Impede rolagem horizontal */

}

.table-wrapper480 {
    max-height: 480px;
    /* Janela dos itens do tbody */
    overflow-y: auto;
    /* Enables vertical scroll */
    width: 99%;
    overflow-x: hidden;
    /* Impede rolagem horizontal */
}

.table-wrapper450 {
    max-height: 450px;
    /* Janela dos itens do tbody */
    overflow-y: auto;
    /* Enables vertical scroll */
    width: 99%;
    overflow-x: hidden;
    /* Impede rolagem horizontal */
}


.table-wrapper-orc {

    max-height: 320px;
    /* Janela dos itens do tbody */
    overflow-y: auto;
    /* Enables vertical scroll */
    overflow-x: hidden;
    /* Impede rolagem horizontal */

}


.table-wrapper::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

.table-wrapper::-webkit-scrollbar-thumb {
    border-radius: .5rem;
    background-color: #0004;
    visibility: hidden;
}

.table-wrapper:hover::-webkit-scrollbar-thumb {
    visibility: visible;
}


table {
    width: 100%;
}

td img {
    width: 30px;
    height: 30px;
    margin-right: .5rem;
    border-radius: 50%;

    vertical-align: middle;
}

table,
th,
td {
    border-collapse: collapse;
    padding: 0.5rem;
    text-align: left;
    color: var(--text-primary);
}

thead th {
    position: sticky;
    top: 0;
    left: 0;
    background-color: var(--bg-thead, #d5d1defe);
    color: var(--text-primary);
    cursor: pointer;
    text-transform: capitalize;
    transition: background-color 0.3s;
}

tbody tr:nth-child(even) {
    background-color: var(--bg-row-even, #0000000b);
}

tbody tr {
    --delay: .1s;
    transition: .2s ease-in-out var(--delay), background-color 0s;
}

tbody tr.hide {
    opacity: 0;
    transform: translateX(100%);
}

tbody tr:hover {
    background-color: var(--bg-row-hover, #fff6) !important;
}

tbody tr td,
tbody tr td p,
tbody tr td img {
    transition: .2s ease-in-out;
    font-size: 12px;
}

tbody tr.hide td,
tbody tr.hide td p {
    padding: 0;
    font: 0 / 0 sans-serif;
    transition: .2s ease-in-out .2s;
}

tbody tr.hide td img {
    width: 0;
    height: 0;
    transition: .2s ease-in-out .2s;
}

.status {
    padding: .4rem 0;
    border-radius: 2rem;
    text-align: center;
}

.status.delivered {
    background-color: #86e49d;
    color: #006b21;
}

.status.cancelled {
    background-color: #d893a3;
    color: #b30021;
}

.status.pending {
    background-color: #ebc474;
}

.status.shipped {
    background-color: #6fcaea;
}


@media (max-width: 1000px) {
    td:not(:first-of-type) {
        min-width: 12.1rem;
    }
}

thead th span.icon-arrow {
    display: inline-block;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    border: 1.4px solid transparent;

    text-align: center;
    font-size: 1rem;

    margin-left: .5rem;
    transition: .2s ease-in-out;
}

thead th:hover span.icon-arrow {
    border: 1.4px solid #6c00bd;
}

thead th:hover {
    color: #6c00bd;
}

thead th.active span.icon-arrow {
    background-color: #6c00bd;
    color: #fff;
}

thead th.asc span.icon-arrow {
    transform: rotate(180deg);
}

thead th.active,
tbody td.active {
    color: #6c00bd;
}

.export__file {
    position: relative;
}

.export__file .export__file-btn {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    /* background: #fff6 url(images/export.png) center / 80% no-repeat; */
    border-radius: 50%;
    transition: .2s ease-in-out;
}

.export__file .export__file-btn:hover {
    background-color: #fff;
    transform: scale(1.15);
    cursor: pointer;
}

.export__file input {
    display: none;
}

.export__file .export__file-options {
    position: absolute;
    right: 0;

    width: 12rem;
    border-radius: .5rem;
    overflow: hidden;
    text-align: center;

    opacity: 0;
    transform: scale(.8);
    transform-origin: top right;

    box-shadow: 0 .2rem .5rem #0004;

    transition: .2s;
}

.export__file input:checked+.export__file-options {
    opacity: 1;
    transform: scale(1);
    z-index: 100;
}

.export__file .export__file-options label {
    display: block;
    width: 100%;
    padding: .6rem 0;
    background-color: #f2f2f2;

    display: flex;
    justify-content: space-around;
    align-items: center;

    transition: .2s ease-in-out;
}

.export__file .export__file-options label:first-of-type {
    padding: 1rem 0;
    background-color: #86e49d !important;
}

.export__file .export__file-options label:hover {
    transform: scale(1.05);
    background-color: #fff;
    cursor: pointer;
}

.export__file .export__file-options img {
    width: 2rem;
    height: auto;
}


.btnq {
    border-radius: 50%;
    width: 30px;
    /* Ajusta a largura do botão */
    height: 30px;
    /* Ajusta a altura do botão */
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-icon {
    font-size: 1.0rem;
    /* Tamanho do ícone */
}

/* Estilização do título */
.table__header h1 {
    font-size: 2em;
    margin: 10 10 20px;
    color: var(--text-primary);
    text-align: center;
}

/* Estilização do grupo de entrada */
.input-group {
    display: flex;
    align-items: center;
    /* Alinha verticalmente */
}

.input-group input[type="search"] {
    /* border: 1px solid #ccc; */
    padding: 10px;
    border-radius: 5px;
    flex: 1;
    /* Faz com que a barra de pesquisa ocupe o espaço restante */
}


/* Estilização do select */
select {
    padding: 8px;
    /* Reduzido */
    border: 1px solid #ccc;
    border-radius: 5px;
    /* Arredondado */
    margin-left: 10px;
    font-size: 1em;
    width: 300px;
    /* Ajusta o tamanho */
}


/* Estilização do botão */
button#toPDF {
    padding: 7px 7px;
    border: none;
    border-radius: 5px;
    /* Arredondado */
    background-color: #28a745;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s;
}

button#toPDF:hover {
    background-color: #218838;
}



/* Destaca estoque zerado */
tr.estoque-vermelho td {
    background-color: #ffcccc !important;
    color: #a80000 !important;
}


.admrow {
    font-size: 10px;
}


td.estoque-vermelho,
td.estoque-vermelho~td {
    background-color: #ffeaea !important;
    color: #b80000 !important;
}



.destacar-item {
    font-weight: bold;
    color: red;
}


.box_base {
    position: relative;
    border-radius: 1%;
    border: 1.8px solid rgb(196, 195, 195);
    padding: 20px;
    top: 15px;
}



.navigation {
    position: relative;
    /* width: auto; */
    width: 98%;
    height: 40px;
    background: linear-gradient(to right, rgb(19, 10, 65), rgb(50, 117, 148));
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    margin: 10px;
    border: 1px solid var(--border-color);
}

.navigation ul {
    display: flex;
    width: 600px;
    background: transparent;
    /* distância dos icones */

}

.navigation ul li {
    position: relative;
    width: 550px;
    height: 0;

    list-style: none;
    z-index: 1;
}

.navigation ul li a {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 50%;
    text-align: center;
    font-weight: 10;
}

.navigation ul li a .icon {
    position: relative;
    display: block;
    line-height: 30px;
    font-size: 1.5em;
    text-align: center;
    color: #fff;
    transition: .5s;
}

.navigation ul li.active a .icon {
    transform: translateY(-30px);
}

.navigation ul li a .text {
    position: absolute;
    color: #fff;
    font-weight: 400;
    font-size: .75em;
    letter-spacing: .05em;
    opacity: 0;
    transform: translateY(10px);
    transition: .5s;
}

.navigation ul li.active a .text {
    opacity: 1;
    transform: translateY(0px);
}

.navigation ul li a .circle {
    position: absolute;
    display: block;
    width: 40px;
    height: 40px;
    background: transparent;
    border-radius: 50%;
    border: 1.8px solid #fff;
    transform: translateY(-50px) scale(0);
}

.navigation ul li.active a .circle {
    transition: .5s;
    transition-delay: .5s;
    transform: translateY(-35px) scale(1);
}

.indicator {
    position: absolute;
    top: -85%;
    width: 60px;
    height: 60px;
    background: linear-gradient(to right, rgb(19, 10, 65), rgb(50, 117, 148));
    border: 6px solid #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: .5s;
}

.indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -22px;
    width: 20px;
    height: 20px;
    background: transparent;
    border-top-right-radius: 20px;
    box-shadow: 1px -10px 0 #fff;
}

.indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -22px;
    width: 20px;
    height: 20px;
    background: transparent;
    border-top-left-radius: 20px;
    box-shadow: -1px -10px 0 #fff;
}

.navigation ul li:nth-child(1).active~.indicator {
    transform: translateX(calc(116px * 0));
}

.navigation ul li:nth-child(2).active~.indicator {
    transform: translateX(calc(116px * 1));
}

.navigation ul li:nth-child(3).active~.indicator {
    transform: translateX(calc(116px * 2));
}

.navigation ul li:nth-child(4).active~.indicator {
    transform: translateX(calc(117px * 3));
}

.navigation ul li:nth-child(5).active~.indicator {
    transform: translateX(calc(117px * 4));
}


.btnfunc {
    position: relative;
    margin-top: 40px;
    margin-left: 100px;
}


.areaindex {
    width: 35%;
    max-width: 35%;
    background: var(--bg-glass);
    padding: 5px;
    box-shadow: 0 7px 25px rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 5px;
    margin-left: 30px;
    box-sizing: border-box;
    /* Garante que padding e bordas estejam inclusos no width */

}

.grafindex {
    width: 98%;
    height: 275px;
    overflow: hidden;
    padding: 5px;
    box-sizing: border-box;
}

.boxtab {
    position: relative;
    border-radius: 1%;
    border: 1.8px solid rgb(196, 195, 195);
    padding: 20px;
    top: 15px;
}

.gpbtn {
    position: relative;
    margin-top: 30px;
}

/* =========================================================================================
   DARK MODE OVERRIDES (BOOTSTRAP & CUSTOM)
   ========================================================================================= */

body.dark-theme {
    /* Basicos */
    --bs-body-bg: var(--bg-primary);
    --bs-body-color: var(--text-primary);
}

body.dark-theme .bg-white,
body.dark-theme .bg-light {
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
}

/* Modais e Offcanvas */
/* backdrop-filter em main.table cria stacking context que sobrepõe modais — forçar z-index acima */
.modal         { z-index: 2000 !important; }
.modal-backdrop { z-index: 1900 !important; }
/* Offcanvas e backdrop acima da navbar (z-index: 1050) */
.offcanvas-backdrop { z-index: 1055 !important; }
/* SweetAlert2 deve sempre aparecer acima de modais e offcanvas */
.swal2-container { z-index: 9999 !important; }

body.dark-theme .modal-content,
body.dark-theme .offcanvas {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme .offcanvas-header {
    border-color: var(--border-color) !important;
}

body.dark-theme .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Custom borda-modal e listas internas */
body.dark-theme .borda-modal {
    background-color: var(--bg-glass) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .listconciliar:nth-child(even) {
    background-color: var(--bg-row-even) !important;
}

/* Links e textos secundários */
body.dark-theme .text-secondary,
body.dark-theme .text-muted {
    color: var(--text-secondary) !important;
}

/* Input groups (usados em filtros de estabelecimento) */
body.dark-theme .input-group-text {
    background-color: var(--bg-sidebar) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Overrides de Sidebar e Navegação */
body.dark-theme .list-group-item {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .list-group-item.active {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
}

/* Fix Texto Tabela e Células */
body.dark-theme table,
body.dark-theme th,
body.dark-theme td,
body.dark-theme .table-striped>tbody>tr:nth-of-type(odd)>*,
body.dark-theme .table {
    color: var(--text-primary) !important;
}

/* Botões Premium (Glassmorphism Outline) no Dark Mode */
body.dark-theme .btn-info,
body.dark-theme .btn-danger,
body.dark-theme .btn-primary,
body.dark-theme .btn-warning,
body.dark-theme .btn-success {
    background-color: transparent !important;
    backdrop-filter: blur(5px);
    border-width: 1.5px !important;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: none !important;
}

body.dark-theme .btn-info {
    border-color: #0dcafec0 !important;
    color: #0dcafefe !important;
}

body.dark-theme .btn-info:hover {
    background-color: #0dcafec0 !important;
    color: #fff !important;
    box-shadow: 0 0 15px #0dcafe40 !important;
}

body.dark-theme .btn-danger {
    border-color: #dc3545c0 !important;
    color: #dc3545fe !important;
}

body.dark-theme .btn-danger:hover {
    background-color: #dc3545c0 !important;
    color: #fff !important;
    box-shadow: 0 0 15px #dc354540 !important;
}

body.dark-theme .btn-primary {
    border-color: #0d6efdc0 !important;
    color: #0d6efdfe !important;
}

body.dark-theme .btn-primary:hover {
    background-color: #0d6efdc0 !important;
    color: #fff !important;
    box-shadow: 0 0 15px #0d6efd40 !important;
}

/* Botão Novo (Warning) */
body.dark-theme .btn-warning {
    border-color: #ffc107c0 !important;
    color: #ffc107fe !important;
}

body.dark-theme .btn-warning:hover {
    background-color: #ffc107c0 !important;
    color: #fff !important;
    box-shadow: 0 0 15px #ffc10740 !important;
}

/* Texto do Usuário e Elementos Fortes na Navbar */
body.dark-theme .navbar .nav-link strong,
body.dark-theme .navbar-brand strong,
body.dark-theme .navbar span strong {
    color: var(--text-primary) !important;
}

/* Placeholders dos Filtros */
body.dark-theme input::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.7;
}

/* Sidebar transparency fix */
#sidebarMenu,
#sidebarMenu .list-group,
#sidebarMenu .list-group-item {
    background-color: transparent !important;
}

/* =============================================
   DARK MODE — Overrides Complementares
   ============================================= */

/* Texto hardcoded escuro */
body.dark-theme .text-dark {
    color: var(--text-primary) !important;
}

/* Formulários */
body.dark-theme .form-control,
body.dark-theme .form-select,
body.dark-theme input[type="text"],
body.dark-theme input[type="number"],
body.dark-theme input[type="email"],
body.dark-theme input[type="password"],
body.dark-theme input[type="search"],
body.dark-theme textarea,
body.dark-theme select {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
}

/* Dropdown menus */
body.dark-theme .dropdown-menu {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .dropdown-item {
    color: var(--text-primary) !important;
}

body.dark-theme .dropdown-item:hover,
body.dark-theme .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.07) !important;
    color: var(--text-primary) !important;
}

body.dark-theme .dropdown-divider {
    border-color: var(--border-color) !important;
}

/* Accordion */
body.dark-theme .accordion-item {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .accordion-button {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .accordion-button:not(.collapsed) {
    background-color: rgba(13, 110, 253, 0.15) !important;
    color: #7fb3ff !important;
    box-shadow: none !important;
}

body.dark-theme .accordion-button::after {
    filter: invert(1) brightness(2);
}

body.dark-theme .accordion-body {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-primary) !important;
}

/* Painéis tintados (panel-danger, panel-success, panel-primary) */
body.dark-theme .panel {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .panel-danger {
    background: rgba(220, 53, 69, 0.08) !important;
    border-color: rgba(220, 53, 69, 0.3) !important;
    border-left-color: #dc3545 !important;
}

body.dark-theme .panel-success {
    background: rgba(25, 135, 84, 0.08) !important;
    border-color: rgba(25, 135, 84, 0.3) !important;
    border-left-color: #198754 !important;
}

body.dark-theme .panel-primary {
    background: rgba(13, 110, 253, 0.08) !important;
    border-color: rgba(13, 110, 253, 0.3) !important;
    border-left-color: #0d6efd !important;
}

/* thead da tabela */
body.dark-theme .table-light,
body.dark-theme thead.table-light > tr > th {
    background-color: var(--bg-thead) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}


/* Correção para o "Usuário:" label */
/* Sidebar Premium Style - Curve Outside Effect */
.sidebar-link {
    position: relative !important;
    background-color: transparent !important;
    color: #ffffff !important;
    transition: all 0.3s ease !important;
    border-radius: 35px 0 0 35px !important;
    margin-bottom: 8px;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    width: 100%;
    padding: 10px 20px !important;
    /* Reduzi levemente o padding vertical */
    font-weight: 500 !important;
    overflow: visible !important;
    z-index: 2 !important;
    font-size: 0.9rem !important;
    /* Fonte menor para o texto */
}

/* Color for sub-elements in default (Inactive) state */
.sidebar-link span {
    color: #ffffff !important;
    opacity: 1 !important;
}

.sidebar-link ion-icon {
    color: #ffffff !important;
    opacity: 1 !important;
    font-size: 1.2rem !important;
    /* Ícone um pouco maior que o texto, mas menor que antes */
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Active State MUST have dark/blue text for the light background */
.sidebar-link.active {
    background-color: var(--bg-primary, #f8f9fa) !important;
}

.sidebar-link.active span,
.sidebar-link.active ion-icon {
    color: var(--blue, #2a2185) !important;
    font-weight: 700 !important;
}


/* Pseudo-elementos para a curva "Curve Outside" - Sombreado refinado (menos opaco/suave) */
.sidebar-link.active::before {
    content: "";
    position: absolute;
    right: 0;
    top: -50px;
    width: 50px;
    height: 50px;
    background-color: transparent;
    border-radius: 50%;
    box-shadow: 35px 35px 0 10px var(--bg-primary, #f8f9fa);
    pointer-events: none;
    z-index: 1;
}

.sidebar-link.active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -50px;
    width: 50px;
    height: 50px;
    background-color: transparent;
    border-radius: 50%;
    box-shadow: 35px -35px 0 10px var(--bg-primary, #f8f9fa);
    pointer-events: none;
    z-index: 1;
}

body.dark-theme .sidebar-link.active {
    background-color: var(--bg-primary) !important;
    color: #ffffff !important;
}

body.dark-theme .sidebar-link.active span,
body.dark-theme .sidebar-link.active ion-icon {
    color: #ffffff !important;
}

body.dark-theme .sidebar-link.active::before,
body.dark-theme .sidebar-link.active::after {
    box-shadow: 35px 35px 0 10px var(--bg-primary) !important;
}

body.dark-theme .sidebar-link.active::after {
    box-shadow: 35px -35px 0 10px var(--bg-primary) !important;
}

/* ─── Sidebar: Grupos colapsáveis (submenus) ────────────────────────────── */

.sidebar-group-header .sidebar-chevron {
    margin-left: auto;
    font-size: 0.85rem !important;
    opacity: 0.7;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.sidebar-group-header[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-group-header.group-active {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

/* Sublinks: indentados, sem pseudo-elementos de curva */
.sidebar-sublink {
    padding: 7px 16px 7px 38px !important;
    font-size: 0.82rem !important;
    margin-bottom: 3px;
}

.sidebar-sublink.active {
    background-color: var(--bg-primary, #f8f9fa) !important;
}

.sidebar-sublink.active span,
.sidebar-sublink.active ion-icon {
    color: var(--blue, #2a2185) !important;
    font-weight: 700 !important;
}

.sidebar-sublink.active::before,
.sidebar-sublink.active::after {
    display: none !important;
}

body.dark-theme .sidebar-sublink.active {
    background-color: var(--bg-primary) !important;
}

body.dark-theme .sidebar-sublink.active span,
body.dark-theme .sidebar-sublink.active ion-icon {
    color: #ffffff !important;
}

/* Estilos Modernos Simulador e Dashboard (Sincronizado com Dark Mode) */
.sim-card-modern {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: var(--bg-table-body, var(--white));
    border: 1px solid var(--border-color, #eee);
    box-shadow: var(--card-shadow, 0 4px 15px rgba(0, 0, 0, 0.05));
    border-radius: 15px;
}

.sim-card-modern.price {
    border-left: 5px solid var(--blue);
}

.sim-card-modern.profit {
    border-left: 5px solid #28a745;
}

.sim-card-modern.info {
    border-left: 5px solid #17a2b8;
}

.sim-card-modern.warning {
    border-left: 5px solid #ffc107;
}

.sim-card-modern.danger {
    border-left: 5px solid #dc3545;
}

.sim-card-modern.purple {
    border-left: 5px solid #6f42c1;
}

.sim-card-modern.secondary {
    border-left: 5px solid #6c757d;
}

.sim-card-modern.primary {
    background: var(--blue);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(42, 33, 133, 0.2);
}

.sim-card-modern .label {
    font-size: 0.65rem;
    font-weight: 800;
    display: block;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.sim-card-modern.price .label {
    color: var(--blue);
}

.sim-card-modern.profit .label {
    color: #28a745;
    font-weight: 900;
}

.sim-card-modern.info .label {
    color: #17a2b8;
}

.sim-card-modern.warning .label {
    color: #fd7e14;
}

.sim-card-modern.danger .label {
    color: #dc3545;
}

.sim-card-modern.purple .label {
    color: #6f42c1;
}

.sim-card-modern.secondary .label {
    color: #6c757d;
}

.sim-card-modern.primary .label {
    color: rgba(255, 255, 255, 0.9);
}

.sim-card-modern .value {
    font-size: 1.1rem;
    font-weight: 800;
    display: block;
    color: var(--text-primary);
}

.sim-card-modern.primary .value {
    font-size: 1.3rem;
    color: #ffffff;
}

.sim-card-modern.profit .value {
    color: #28a745;
}

/* Scrollbar Customizada Theme-Aware */
::-webkit-scrollbar {
    width: 10px;
    display: block;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Form Styles Theme-Aware */
.form-label {
    color: var(--form-label-color) !important;
    font-weight: 500;
}

.form-control {
    background-color: var(--bg-glass) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.form-control:focus {
    background-color: var(--bg-glass) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

body.dark-theme .form-control {
    background-color: rgba(15, 23, 42, 0.6) !important;
}

/* === CHAT COCKPIT === */

/* Selects dentro dos panes são sempre escuros (pane tem background fixo #1e293b) */
.cockpit-pane select {
    color: #f1f5f9 !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
.cockpit-pane select option {
    background-color: #1e293b;
    color: #f1f5f9;
}
.cockpit-pane input[type="text"],
.cockpit-pane input[type="search"],
.cockpit-pane input[type="password"],
.cockpit-pane input[type="email"],
.cockpit-pane input:not([type]) {
    color: #f1f5f9 !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
.cockpit-pane input::placeholder {
    color: rgba(148, 163, 184, 0.8) !important;
}

.cockpit-grid {
    display: flex;
    width: 100%;
    height: calc(98vh - 60px);
    gap: 0;
    overflow: hidden;
}

.cockpit-pane {
    background: #1e293b;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.cockpit-pane.pane-collapsed {
    width: 50px !important;
    min-width: 50px !important;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.pane-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.pane-toggle-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

.pane-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.cockpit-pane.pane-collapsed .pane-label,
.cockpit-pane.pane-collapsed .pane-title span.pane-label {
    display: none;
}

.instance-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.led-green  { background: #10b981; box-shadow: 0 0 4px #10b981; }
.led-amber  { background: #f59e0b; box-shadow: 0 0 4px #f59e0b; }
.led-gray   { background: #64748b; }

.badge-fiscal-alerta {
    cursor: pointer;
    transition: opacity 0.15s;
}
.badge-fiscal-alerta:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Zebra PDV — alterna apenas entre linhas principais (exclui item-detalhe) */
.tableorc tbody tr.row-zebra-odd > td {
    background-color: rgba(0, 0, 0, 0.03);
}
.tableorc tbody tr.row-zebra-even > td {
    background-color: transparent;
}


/* DARK MODE — Overrides Complementares */
body.dark-theme .item-detalhe td {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

body.dark-theme .tableorc tbody tr.row-zebra-odd > td {
    background-color: rgba(255, 255, 255, 0.04);
}
body.dark-theme .tableorc tbody tr.row-zebra-even > td {
    background-color: transparent;
}

body.dark-theme .cockpit-pane {
    background: #1e293b;
    border-right-color: rgba(255, 255, 255, 0.08);
}

/* === NAV RAIL — Janela 1 estilo Chatwoot === */
#pane-nav {
    flex-direction: row !important;
}

#pane-nav.pane-collapsed {
    width: 48px !important;
    min-width: 48px !important;
}

#pane-nav.pane-collapsed .nav-panel {
    display: none;
}

.nav-rail {
    width: 48px;
    min-width: 48px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 2px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.18);
}

.nav-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.nav-rail-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    position: relative;
}

.nav-rail-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.nav-rail-btn.active {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.nav-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Títulos e ícones dos pane-headers: fundo sempre escuro — forçar texto claro */
.pane-header {
    background: rgba(0, 0, 0, 0.15);
}

/* Cockpit panes têm fundo fixo escuro (#1e293b) independente do tema.
   Escopa as variáveis CSS para garantir contraste correto no light mode. */
.cockpit-pane {
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
}

.pane-title {
    color: #f1f5f9 !important;
}

#nav-panel-title {
    color: #f1f5f9;
}

body.dark-theme #pane-chat {
    background: #0f172a;
}

/* Kanban card hover */
.kanban-card:hover {
    background: rgba(255, 255, 255, 0.07) !important;
}
body.dark-theme .kanban-card:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Botão remover do funil */
.kanban-card-remove:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.12) !important;
}

/* Kanban drag ghost */
.kanban-card-ghost {
    opacity: 0.4;
}
body.dark-theme .kanban-card-ghost {
    opacity: 0.3;
}

/* Cockpit — Hover substituto para handlers inline removidos (CSP-safe) */
.internal-user-item:hover {
    background: rgba(255,255,255,0.07) !important;
}
[data-estab-group-header]:hover {
    color: #94a3b8 !important;
}

/* =============================================================================
   BOTÃO GLOBAL DE NOTIFICAÇÃO DE CHAT
   ============================================================================= */

#global-chat-notif-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--blue, #2a2185);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    z-index: 9998;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

#global-chat-notif-btn:hover {
    transform: scale(1.08);
    color: #fff;
}

#global-chat-notif-btn ion-icon {
    font-size: 1.45rem;
    pointer-events: none;
}

/* Badge com contador */
#global-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #dc3545;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--bg-primary, #f8f9fa);
    line-height: 1;
}

/* Pulsação intermitente quando há notificações */
@keyframes chat-notif-pulse {
    0%   { box-shadow: 0 4px 14px rgba(0,0,0,0.28), 0 0 0 0 rgba(220, 53, 69, 0.75); }
    60%  { box-shadow: 0 4px 14px rgba(0,0,0,0.28), 0 0 0 12px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 4px 14px rgba(0,0,0,0.28), 0 0 0 0 rgba(220, 53, 69, 0); }
}

#global-chat-notif-btn.notif-pulsing {
    animation: chat-notif-pulse 1.4s ease-out infinite;
}

/* Dark mode */
body.dark-theme #global-chat-badge {
    border-color: #0b0f19;
}

/* Lead Discovery — Skeleton */
.skeleton-box {
    background: var(--border-color);
    border-radius: 4px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
body.dark-theme .skeleton-box {
    background: rgba(255, 255, 255, 0.08);
}

/* Lead Discovery — Reordenação Dinâmica */
.lead-row-reordering {
    transition: transform 0.4s ease;
    will-change: transform;
}

/* Lead Discovery — Badge de Status WhatsApp */
.badge-whatsapp {
    transition: background-color 0.3s ease, color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    overflow: visible;
}
.badge-whatsapp ion-icon {
    font-size: 0.9em;
    flex-shrink: 0;
}
.badge-whatsapp-pendente {
    background-color: #6c757d;
    color: #fff;
    animation: badge-pulse 1.5s ease-in-out infinite;
}
.badge-whatsapp-ativo {
    background-color: #198754;
    color: #fff;
}
.badge-whatsapp-inativo {
    background-color: #343a40;
    color: #dee2e6;
}
.badge-whatsapp-erro {
    background-color: #ffc107;
    color: #000;
}
@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}
/* Dark mode overrides */
body.dark-theme .badge-whatsapp-inativo {
    background-color: #495057;
    color: #dee2e6;
}
/* Lead Discovery — Badge Top Rated */
.badge-top-rated {
    vertical-align: middle;
    cursor: default;
}

/* ===== AGENTE IA — Offcanvas (sem Bootstrap JS) ===== */
#offcanvas-agent-config {
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out, visibility 0.3s;
}
#offcanvas-agent-config.show {
    visibility: visible;
    transform: none;
}

/* ===== AGENTE IA — Painel de Configuração ===== */
.agent-panel { font-size: 0.82rem; }
.agent-panel__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.agent-panel__title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.agent-panel__form { display: flex; flex-direction: column; gap: 12px; }
.agent-panel__actions { margin-top: 4px; }
.agent-field-group { display: flex; flex-direction: column; gap: 4px; }
.agent-field-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.agent-field-input,
.agent-field-select,
.agent-field-textarea {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 0.82rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}
.agent-field-input:focus,
.agent-field-select:focus,
.agent-field-textarea:focus { border-color: rgba(99,102,241,0.6); }
.agent-field-textarea { resize: vertical; min-height: 80px; }
.agent-key-row { margin-bottom: 6px; }
.btn-agent-save {
    background: rgba(34,197,94,0.2);
    border: 1px solid rgba(34,197,94,0.4);
    color: #22c55e;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.btn-agent-save:hover { background: rgba(34,197,94,0.3); }
.agent-divider { border-color: var(--border-color); margin: 16px 0; }
.agent-section__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.agent-section__title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.btn-agent-sm {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-agent-sm:hover { background: rgba(255,255,255,0.12); }
.btn-agent-sm--primary {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.4);
    color: #818cf8;
}
.btn-agent-sm--primary:hover { background: rgba(99,102,241,0.3); }
.agent-mcp-add-form {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px; padding: 10px;
    border: 1px solid var(--border-color);
}
.agent-mcp-form-actions { display: flex; gap: 6px; }
.agent-mcp-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.agent-mcp-item {
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px; padding: 8px 10px;
}
.agent-mcp-item__info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.agent-mcp-item__name { font-weight: 600; color: var(--text-primary); font-size: 0.8rem; }
.agent-mcp-item__url { color: var(--text-secondary); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-mcp-item__tools { color: #22c55e; font-size: 0.7rem; }
.agent-mcp-item__actions { display: flex; gap: 4px; flex-shrink: 0; }
.agent-mcp-empty { color: var(--text-secondary); font-size: 0.78rem; padding: 8px 0; }
.btn-agent-icon { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; font-size: 0.85rem; transition: background 0.2s; }
.btn-agent-icon:hover { background: rgba(255,255,255,0.08); }
.btn-agent-icon--danger:hover { background: rgba(239,68,68,0.15); color: #ef4444; }
.agent-status-bar { font-size: 0.75rem; color: #22c55e; padding: 4px 0; min-height: 18px; }

/* Agent toggle switch */
.agent-toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.agent-toggle-switch input { opacity: 0; width: 0; height: 0; }
.agent-toggle-slider {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    transition: background 0.2s;
}
.agent-toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px; height: 16px;
    left: 2px; bottom: 2px;
    background: #94a3b8;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.agent-toggle-switch input:checked + .agent-toggle-slider { background: rgba(34,197,94,0.25); border-color: #22c55e; }
.agent-toggle-switch input:checked + .agent-toggle-slider::before { transform: translateX(18px); background: #22c55e; }
.agent-toggle-switch input:disabled + .agent-toggle-slider { opacity: 0.5; cursor: not-allowed; }

.model-option:hover { background: rgba(99,102,241,0.15); }
.model-option:last-child { border-bottom: none; }

/* ── Gerenciador de Arquivos ─────────────────────────────────────────────── */
#drop-zone { transition: background .2s, border-color .2s; }
#drop-zone.dragover { background: rgba(42,33,133,0.1) !important; border-color: var(--primary-color) !important; }

body.dark-theme #drop-zone { border-color: rgba(255,255,255,0.15); }
body.dark-theme #drop-zone.dragover { background: rgba(42,33,133,0.2) !important; }
body.dark-theme #lista-arquivos-container table,
body.dark-theme #lista-backups-container table { color: var(--text-primary); }
body.dark-theme #lista-arquivos-container tbody tr:hover,
body.dark-theme #lista-backups-container tbody tr:hover { background: rgba(255,255,255,0.04); }
body.dark-theme #breadcrumb-container .breadcrumb-item + .breadcrumb-item::before { color: var(--text-secondary); }
body.dark-theme #modal-nova-pasta .modal-content,
body.dark-theme #modal-mover .modal-content,
body.dark-theme #modal-compartilhar .modal-content { background: var(--bg-primary); color: var(--text-primary); }
body.dark-theme #input-link-share { background: rgba(255,255,255,0.05); color: var(--text-primary); border-color: var(--border-color); }
