:root,
html.light-mode,
body.light-mode,
html:not(.dark-mode),
body:not(.dark-mode) {
    --fundo: #e6e6e6;
    --fundo-sidebar: #fbfbfb;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #111827;

    --border: 1px solid #e5e7eb;

    /* Cores de Destaque */
    --verde: #466955a6;
    --verde-claro: #dcfce7;
    --rosa: #ff7aa2;
    --rosa-claro: #fce7f3;
    --preto: #18181b;
    --azul: #485461;
    --vermelho: #791e1ea2;
    --branco: #ffffff;
    --cinza: #fafafa;
    --cinza-claro: #f3f4f6;
    --amarelo: #ccb76dd2;
    --cinza-escuro: #6b7280;
    --roxo: #a855f7;
    --azul-claro-strong: #0ea5e9;
    --laranja: #d97706;

    /* Estruturais */
    --radius: 4px;
    --shadow: 0 5px 5px rgba(0, 0, 0, 0.12);
    --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.15);

    --fundo-label-cadastros: #f7f7f7;
    --fundo-modal: rgba(255, 255, 255, 0.96);
    --fundo-textbox: #ffffff;

    /* FONTES (tamanho — não usar --text como cor) */
    --text: 0.7rem;
    --text-2: 0.8rem;
    --text-3: 0.9rem;
    --text-4: 1.1rem;
}

/* Variáveis para Tema Escuro (ativado pelo botão TEMA) */
html.dark-mode,
body.dark-mode {
    --fundo: #030a12;
    --fundo-sidebar: #111827;
    --bg-sidebar: #1f2937;
    --bg-card: #1f2937;
    --text-main: #f9fafb;
    --cinza-escuro: #9ca3af;
    --border: 1px solid rgba(108, 110, 114, 0.2);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    --preto: #f9fafb;
    --branco: #1f2937;
    --cinza: rgba(255, 255, 255, 0.06);
    --cinza-claro: rgba(255, 255, 255, 0.08);
    --vermelho: #d65b5b;
    --verde: #2caa2c;
    --laranja: #d97706;
    --azul: #587cb6;
    --roxo: #c7bfcf;

    --fundo-label-cadastros: #111827;
    --fundo-modal: rgba(31, 41, 55, 0.92);
    --fundo-textbox: #1f2937;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Michroma', sans-serif;
    font-size: var(--text);
    font-weight: 600;
}

html {
    background: var(--fundo);
}

body {
    background: var(--fundo);
    color: var(--cinza-escuro);
    display: flex;
    justify-content: center;
    padding: 2px;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* Estrutura Principal */
.dashboard {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: auto;
    height: calc(100vh - 4px);
    max-height: calc(100vh - 4px);
    align-items: stretch;
    background: var(--fundo);
    border-radius: var(--radius);
    overflow: hidden;
    gap: 10px;
}

/* --- Barra Lateral (Sidebar) --- */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    overflow-y: auto;
    flex-shrink: 0;
    align-self: stretch;
    height: 100%;
    min-height: 0;
    box-shadow: var(--shadow-soft);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 20;
    font-size: var(--text);
}

.sidebar.collapsed {
    margin-left: -280px;
}

.sidebar::-webkit-scrollbar { width: 0px; }

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-left: 8px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.search-sidebar {
    background: var(--fundo-sidebar);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    margin-right: 10px;
    color: var(--cinza-escuro);
    font-size: var(--text-2);
}

.search-sidebar input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    color: var(--text-main);
    font-family: 'Michroma', sans-serif;
    font-weight: 400;
    letter-spacing: 0.5px;
    font-size: var(--text);
}

.cmd-f {
    position: absolute;
    right: 5px;
    top: 1;
    width: 28px;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--text-main);
    background-color: var(--border);
    color: var(--text-main);
    font-size: var(--text);
    padding: 4px 6px;
    border-radius: var(--radius);
    font-weight: 400;
}

.menu-section {
    margin-bottom: 24px;
}

.menu-section h4 {
    font-size: var(--text);
    color: var(--cinza-escuro);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    padding-left: 12px;
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: var(--cinza-escuro);
    text-decoration: none;
    font-size: var(--text);
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    text-transform: uppercase;
    
}

.menu-item:hover:not(.active) {
    background: var(--border);
    color: var(--preto);
    box-shadow: var(--shadow);
}

.menu-item.active {
    background: var(--fundo-label-cadastros);
    color: var(--preto);
    box-shadow: var(--shadow);
}

.menu-item.active:hover {
    background: var(--fundo-sidebar);
    color: var(--preto);
    transition: all 0.2s;
}

.menu-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item-content svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

/* --- Estilos para os Submenus --- */
.menu-item-wrapper {
    margin-bottom: 4px;
}

.menu-item.toggle-btn {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    font-family: 'Michroma', sans-serif;
    font-size: var(--text);
    font-weight: 600;
    text-transform: uppercase;
}

.menu-item-wrapper i {
    font-size: var(--text);
    transition: transform 0.3s ease;
}

.menu-item-wrapper.open i {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, margin 0.3s ease;
    padding-left: 42px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item-wrapper.open .submenu {
    max-height: 400px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.submenu-item {
    padding: 8px 12px;
    color: var(--cinza-escuro);
    text-decoration: none;
    font-size: var(--text);
    font-weight: 600;
    border-radius: var(--radius);
    display: block;
    transition: all 0.2s;
    position: relative;
    text-transform: uppercase;
}

/* Pequeno ponto lateral nos itens do submenu */
.submenu-item::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--border);
    transition: background-color 0.2s;
}

.submenu-item:hover {
    color: var(--text-main);
    background: var(--border);
}

.submenu-item.active {
    color: var(--text-main);
    background: var(--fundo-sidebar);
    font-weight: 600;
}

.submenu-item.active::before {
    background-color: var(--verde);
}



.badge-new {
    background: var(--rosa-claro);
    color: var(--rosa);
    font-size: var(--text);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

/* --- Sidebar Footer & User Profile --- */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: var(--border) !important;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--fundo-sidebar);
}

.user-profile i.fa-user-circle {
    font-size: 32px;
    color: var(--cinza-escuro);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-info .name {
    font-weight: 700;
    font-size: var(--text-2);
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .role {
    font-size: var(--text);
    color: var(--cinza-escuro);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Wrapper Principal --- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: var(--fundo);
}

.main-wrapper > .top-header {
    flex-shrink: 0;
}

/* Todo conteúdo (dashboard, listagens, cards) = altura do sidebar */
.main-wrapper > .dashboard-wrap,
.main-wrapper > .painel-listagem,
.main-wrapper > .card,
.main-wrapper > .content,
.main-wrapper > .importacoes-page {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    width: 100%;
}

.painel-listagem {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.painel-listagem > .card {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
}

/* --- Barra Superior --- */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0 10px 0;
}

.header-title {
    font-size: var(--text-2);
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}

/*CHEVRON DO MENU*/
.menu-toggle {
    background: var(--fundo-sidebar);
    border: var(--border) !important;
    border-radius: var(--radius);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--text-main);
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.2s,
                background-color 0.2s;
    position: absolute;  
    z-index: 1000;
}

.menu-toggle:hover {
    background: var(--border) !important;
}

.menu-toggle i {
    font-size: var(--text);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle {
    background: var(--bg-card);
    border: var(--border) !important;
    border-radius: var(--radius);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--text-main);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s, background-color 0.2s;
    position: relative;
}

/* Posição padrão do botão (ao lado da sidebar) */
.menu-toggle {
    top: 6px;
    left: 230px;
}

/* Quando o menu é colapsado, leva o botão para o topo/esquerda da janela */
body.menu-toggle-top-left .menu-toggle {
    top: 0;
    left: 0;
}

body.menu-toggle-top-left .titulo {
    margin-top: 0 !important;
    margin-left: 40px !important; /* afasta do toggle à esquerda */
}
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 6px 16px 6px 6px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    cursor: pointer;
}

.icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fundo-sidebar);
    color: var(--cinza-escuro);
}

.user-profile-header img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.user-text {
    display: flex;
    flex-direction: column;
}

.user-text .name {
    font-size: var(--text-2);
    font-weight: 600;
    color: var(--text-main);
}
.user-text .email {
    font-size: var(--text);
    color: var(--cinza-escuro);
}

.topo-tabela {
   display:flex; justify-content: space-between; align-items: end; gap: 10px;

}

.topo-tabela .search-sidebar {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 220px;
  max-width: 360px;
}

.topo-tabela .search-sidebar input {
   
    min-height: 24px;
    
    color: var(--text-main) !important;
    font-weight: 300 !important;
    letter-spacing: 0.5px !important;   
    font-size: var(--text-3) !important;   
}




.card {
    background: var(--branco);
    border-radius: var(--radius);
    box-shadow: var(--shadow); 
    /* não cortar submenus de filtro */
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 10px;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
  }

.card > .topo-tabela,
.card > .card-toolbar,
.card > .painel-topo-tabela,
.card > .card-footer {
    flex-shrink: 0;
}

.card > .card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.card > .table-responsive {
    flex: 1 1 auto;
    min-height: 0;
}