:root {
    /* Mantenha suas cores aqui */
    --primary: #294788;
    --bg: #F0F0F0;

}

/* Resetando o body para não conflitar com a estrutura da sidebar */
body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    /* ADICIONE ESTAS DUAS LINHAS: */
    min-height: 100vh;
    overflow-y: auto !important;
}

/* 🗑️ REMOVA .tab-nav, .tab-link, .dropdown pois agora usamos a Sidebar */

/* Ajuste dos Cards de KPI para o novo estilo */
.kpi-card {
    background: var(--card-bg);
    padding: 25px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Sombra mais visível no fundo cinza */
    transition: transform 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    /* Efeito suave ao passar o mouse */
}

.modern-chart-card {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    border: none;

}

/* Specific rule for modern-chart-card within modern-middle-grid to be white */
.modern-middle-grid .modern-chart-card {
    background: white;
}

/* Ajuste dos Gráficos */
.chart-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Navbar original mantida */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    border-bottom: 2px solid #ccfbf1;
    padding-bottom: 0;
}

.tab-link {
    text-decoration: none;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    margin-bottom: -2px;
}

.tab-link.active {
    background: #ffffff;
    color: #0f766e;
    border-top: 3px solid #0f766e;
    border-bottom: 2px solid white;
    z-index: 10;
}

/* Estilo do Dashboard de Analytics */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

/* Container da lista do Ranking para suportar o Top 10 com scroll */
#topProductsList {
    list-style: none;
    padding: 0 10px 0 0;
    /* Espaço para não cobrir a barra de rolagem */
    margin-top: 15px;
    max-height: 400px;
    /* Define a altura máxima antes de rolar */
    overflow-y: auto;
    /* Ativa o scroll vertical */
    scrollbar-width: thin;
    /* Barra mais fina em navegadores modernos */
    scrollbar-color: #0f766e #f0fdfa;
}

/* Estilização da barra de rolagem para navegadores Chrome/Safari */
#topProductsList::-webkit-scrollbar {
    width: 6px;
}

#topProductsList::-webkit-scrollbar-track {
    background: #f0fdfa;
}

#topProductsList::-webkit-scrollbar-thumb {
    background-color: #0f766e;
    border-radius: 10px;
}


/* No seu CSS, garanta que o estado padrão da margem considere a barra fechada */
.analytics-section {
    /* Usa a largura mini (80px) + o gap (30px) que configuramos antes */
    margin-left: calc(var(--sidebar-mini) + var(--gap-content)) !important;
    transition: margin-left 0.3s ease;
}

/* Só aumenta a margem se a sidebar NÃO tiver a classe collapsed */
body:not(:has(.sidebar.collapsed)) .analytics-section {
    margin-left: calc(var(--sidebar-width) + var(--gap-content)) !important;
}


.kpi-card {
    font-size: 22px;
    background: white;
    padding: 25px 20px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* Estilo base do item */
.item-canal {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #F0F0F0;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    /* Necessário para posicionar o check se quiser */
}

/* Container do Check (escondido por padrão) */
.check-indicador {
    display: none;
    font-size: 0.9em;
}

/* Estágios ATIVOS por plataforma */
.item-canal.ativo-shopee {
    background-color: #fff2e6 !important;
    /* Laranja bem claro */
    border-color: #ee4d2d !important;
    color: #ee4d2d;
    font-weight: bold;
}

.item-canal.ativo-ml {
    background-color: #fff9e6 !important;
    /* Amarelo bem claro */
    border-color: #ffdb15 !important;
    color: #665500;
    font-weight: bold;
}

.item-canal.ativo-tiktok {
    background-color: #f1f1f1 !important;
    /* Cinza claro */
    border-color: #000000 !important;
    color: #000;
    font-weight: bold;
}

.item-canal.ativo-geral {
    background-color: #e0f2fe !important;
    border-color: #3b82f6 !important;
    color: #1e3a8a;
    font-weight: bold;
}

/* Mostrar o check apenas quando estiver ativo */
.item-canal[class*="ativo-"] .check-indicador {
    display: inline-block;
}


.kpi-card h4 {
    margin: 0 0 15px 0;
    /* Adicionado 15px de margem na parte de baixo */
    font-size: 0.8em;
    /* Diminuí um pouco para destacar mais os botões */
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ajuste no container dos itens para eles não subirem demais */
#resCanais {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}



.item-canal {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    /* Aumentei o padding para o botão ficar mais gordinho */
    background: #F0F0F0;
    border-radius: 8px;
    /* Arredondamento mais suave */
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    font-size: 0.9em;
}

.kpi-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary);
    margin: 5px 0;
}

.charts-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #ccfbf1;
}

.chart-container {
    position: relative;
    height: 350px;
}

.recent-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9em;
}

.recent-table td {
    padding: 8px;
    border-bottom: 1px solid #f0fdfa;
}


/* Estilo do Dropdown no Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 220px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-radius: 8px;
    border: 1px solid #ccfbf1;
    margin-top: 2px;
}

.dropdown-content a {
    color: #64748b;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    transition: 0.2s;
}

.dropdown-content a:hover {
    background-color: #f0fdfa;
    color: var(--primary);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Controle de visibilidade das seções */
/* Esconde todas as seções por padrão */
.analytics-section {
    display: none;
}

/* Mostra apenas a que tiver a classe 'active' */
.analytics-section.active {
    display: block !important;
}

/* Badge de Inatividade */
.badge-inactive {
    background: #fee2e2;
    color: #dc2626;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
}

/* Ajuste para o Dropdown flutuar sobre os gráficos */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 220px;
    box-shadow: 0px 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 999;
    border-radius: 8px;
    border: 1px solid #ccfbf1;
}

.analytics-section {
    display: none;
    animation: fadeIn 0.3s;
}

.analytics-section.active {
    display: block;
}



.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-online {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-warning {
    background-color: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.status-danger {
    background-color: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

#containerBarras {
    display: flex;
    align-items: flex-end;
    /* Faz as barras crescerem de baixo para cima */
    gap: 4px;
    height: 150px;
    /* Altura do gráfico */
    padding: 10px;
    background: #fdfdfd;
    border-bottom: 2px solid #ddd;
}

.barra-historico:hover {
    background-color: #2980b9 !important;
    /* Muda de cor ao passar o mouse */
    cursor: pointer;
}

/* BARRA BRANCA PRINCIPAL */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F0F0F0;
    padding: 12px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    width: 100%;
}

/* GRUPO DO PERFIL (Estilo Mac Gibson) */
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Espaço entre a foto e o texto */
}

/* O CÍRCULO DA FOTO */
.avatar-circle {
    width: 45px;
    height: 45px;
    background: #e2e8f0;
    /* Cor de fundo caso não tenha foto */
    border-radius: 50%;
    overflow: hidden;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* NOME E CARGO EMPILHADOS */
.user-data {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: #19253f;
    /* Seu azul escuro */
    line-height: 1.2;
}

.user-role {
    font-size: 0.8rem;
    color: #94a3b8;
    /* Azul acinzentado claro */
    font-weight: 500;
}

/* AJUSTE DO BOTÃO E SAUDAÇÃO */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.greeting {
    font-size: 1.3rem;
    font-weight: 700;
    color: #19253f;
}


.container {
    margin-left: var(--sidebar-width-collapsed) !important;
    width: calc(100% - var(--sidebar-width-collapsed)) !important;
    min-width: 0;
    box-sizing: border-box;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:not(.collapsed)~.container {
    margin-left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
}

/* Regra Base */
.sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh !important;
    width: var(--sidebar-width-collapsed) !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: visible !important;
}

/* Sidebar expandida — usa classe collapsed removida pelo sidebar.js */
.sidebar:not(.collapsed) {
    width: var(--sidebar-width) !important;
}

.sidebar-menu-button {
    background: none;
    border: none;
    cursor: pointer;
    color: #19253f;
    display: flex;
}

/* Conteúdo principal empurrado para direita */
.main-content {
    margin-left: var(--sidebar-width) !important;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-width-collapsed) !important;
}

/* Quando sidebar expandida */
.sidebar.expanded~.main-content {
    margin-left: var(--sidebar-full) !important;
}

.card-style {
    background: #F0F0F0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.modern-table th {
    text-align: left;
    color: #8e94a0;
    font-size: 0.85rem;
    padding: 12px 8px;
    font-weight: 500;
}

.modern-table td {
    padding: 15px 8px;
    border-top: 1px solid #f4f6f9;
    font-size: 0.9rem;
    color: #1e293b;
}

/* Badges de Status das Fotos */
.badge-status {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
}

.paid {
    background: #e6f9f0;
    color: #00b050;
}

.not-paid {
    background: #e1f5fe;
    color: #01a3ff;
}

.cancelled {
    background: #fee7e7;
    color: #ff4d4d;
}

.product-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}




@media (max-width: 768px) {
    .user-data {
        display: none;
        /* Esconde o nome no celular, deixa só o círculo */
    }

    .greeting {
        font-size: 1.1rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}



/* MODAL DESEMPENHO DO PRODUTO */

/* 1. O Fundo Escuro que cobre a tela inteira */
.modal-overlay {
    display: none;
    /* Escondido por padrão, o JS vai mudar para 'flex' */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

/* 2. A Caixa Branca Centralizada */
.modal-caixa {
    background: #F0F0F0;
    width: 1000px;
    max-width: 95%;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 700px
}

/* 3. O Cabeçalho (Título e botão X) */
.modal-cabecalho {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
}

* ESTILOS NOVOS PARA AS ABAS */ .abas-container {
    display: flex;
    gap: 24px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
}

.btn-aba {
    background: none;
    border: none;
    font-size: 1em;
    font-weight: 600;
    color: #94a3b8;
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    /* Faz a borda sobrepor a linha cinza do container */
    transition: all 0.2s;
}

/* Aba Vendas Ativa */
.btn-aba.ativa-vendas {
    color: #1e293b;
    border-bottom: 2px solid #3b82f6;
    /* Linha Azul */
}

/* Aba Ads Ativa */
.btn-aba.ativa-ads {
    color: #10b981;
    /* Texto Verde igual sua imagem */
    border-bottom: 2px solid #10b981;
    /* Linha Verde */
}

.btn-fechar {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.btn-fechar:hover {
    background: #f1f5f9;
    color: #ef4444;
    /* Fica vermelho ao passar o mouse */
}

/* 4. Os Cartões de Desempenho (Flexbox em ação) */
.kpi-container {
    display: flex;
    gap: 16px;
}

.kpi-card {
    flex: 1;
    /* Manda todos os cartões dividirem o espaço igualmente */
    background: #F0F0F0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

.kpi-titulo {
    margin: 0;
    color: #64748b;
    font-size: 0.85em;
    font-weight: 600;
}


.kpi-info-icon {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    margin: 0 !important;
    z-index: 10 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ── TOOLTIPS DOS KPIs ──────────────────────────────────────── */

.kpi-tooltip-down,
.kpi-tooltip-up {
    display: none;
    position: absolute;
    right: 0;
    left: auto;
    background: #ffffff;
    color: #1e293b;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 13px;
    z-index: 999;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid #e2e8f0;
    line-height: 2;
    white-space: nowrap;
}

.kpi-tooltip-down {
    /* O ícone e a tooltip são irmãos, os dois "position: absolute" contra o mesmo
       ancestral (.modern-kpi-card) — top:calc(100% + 8px) media a altura do CARD
       INTEIRO, não a do ícone, por isso abria longe. O ícone fica em top:8px com
       16px de altura (style.css), então 8 + 16 + 8px de respiro = 32px encosta
       a tooltip logo abaixo dele, não do rodapé do card. */
    top: 32px;
}

.kpi-tooltip-up {
    bottom: calc(100% + 8px);
}

.kpi-tooltip-down::before,
.kpi-tooltip-up::before {
    content: '';
    position: absolute;
    right: 10px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
}

.kpi-tooltip-down::before {
    top: -6px;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
}

.kpi-tooltip-up::before {
    bottom: -6px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.kpi-info-icon:hover+.kpi-tooltip-down,
.kpi-tooltip-down:hover,
.kpi-info-icon:hover+.kpi-tooltip-up,
.kpi-tooltip-up:hover {
    display: block;
}

.kpi-tooltip-down strong,
.kpi-tooltip-up strong {
    float: right;
    margin-left: 24px;
    color: #334155;
    font-weight: 700;
}

/* Bloco "COMO CALCULAMOS" — texto de fórmula, precisa quebrar linha
   (o resto da tooltip usa white-space:nowrap, que não serve pra frase longa) */
.kpi-tooltip-formula {
    white-space: normal;
    max-width: 260px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.5;
}

.kpi-tooltip-formula .kpi-tooltip-heading {
    display: block;
    margin-bottom: 4px;
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.kpi-info-icon {
    cursor: pointer;
}

.periodo-option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9em;
    color: #1e293b;
    transition: background 0.15s;
}

.periodo-option:hover {
    background: #f1f5f9;
}

.periodo-active {
    background: #2563eb !important;
    color: #fff !important;
    font-weight: 600;
}

.cal-header {
    font-size: 0.75em;
    font-weight: 600;
    color: #94a3b8;
    padding: 6px 0;
}

.cal-day {
    padding: 7px 0;
    font-size: 0.85em;
    cursor: pointer;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    transition: all 0.15s;
}

.cal-day:hover {
    background: #f1f5f9;
    border-radius: 50%;
}

.cal-day.disabled {
    color: #cbd5e1;
    cursor: default;
}

.cal-day.disabled:hover {
    background: none;
}

.cal-day.in-range {
    background: #dcfce7;
    border-radius: 0;
    color: #166534;
}

.cal-day.range-start {
    background: #22c55e;
    color: #fff;
    border-radius: 50% 0 0 50%;
    font-weight: 600;
}

.cal-day.range-end {
    background: #22c55e;
    color: #fff;
    border-radius: 0 50% 50% 0;
    font-weight: 600;
}

.cal-day.range-single {
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
}

.cal-day.today {
    border: 1.5px solid #22c55e;
    border-radius: 50%;
}


/* 1. Força o espaçamento na tabela usando a classe do card que já existe no seu HTML */
.modern-chart-card table {
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
}

/* 2. Zera qualquer fundo ou borda que o seu JavaScript esteja tentando colocar no <tr> */
.modern-chart-card tbody tr {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* 3. Aplica o fundo e as bordas de cima/baixo */
.modern-chart-card tbody td {
    background-color: white !important;
    border-top: 1px solid #cbd5e1 !important;
    /* <-- Escurecemos aqui */
    border-bottom: 1px solid #cbd5e1 !important;
    /* <-- Escurecemos aqui */
}

/* 4. Arredonda e fecha a lateral da PRIMEIRA coluna */
.modern-chart-card tbody td:first-child {
    border-left: 1px solid #cbd5e1 !important;
    /* <-- Escurecemos aqui */
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
}

/* 5. Arredonda e fecha a lateral da ÚLTIMA coluna */
.modern-chart-card tbody td:last-child {
    border-right: 1px solid #cbd5e1 !important;
    /* <-- Escurecemos aqui */
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}




.sk {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    height: 14px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.sk-badge {
    width: 80px;
    height: 22px;
    border-radius: 20px;
}

.sk-text {
    width: 70%;
}

.sk-long {
    width: 90%;
}

.sk-btn {
    width: 60px;
    height: 28px;
    border-radius: 8px;
}

.skeleton-row td {
    padding: 12px 8px;
}


/* Skeleton KPI */
.kpi-skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    height: 32px;
    width: 120px;
    display: inline-block;
}