* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f8fafc;
    color: #1e293b;
    overflow-x: hidden;
}

/* ESTRUTURA DO LAYOUT COM SIDEBAR */
.app-layout {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* SIDEBAR BARRA LATERAL */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: #1e293b;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 16px;
    box-sizing: border-box;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.sidebar-header h2 span {
    color: #ff6400;
}

.loja-conectada-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.loja-conectada-box small {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
}

.loja-conectada-box strong {
    font-size: 0.9rem;
    color: #f8fafc;
    display: block;
    word-break: break-word;
}

/* MENU DA SIDEBAR */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.menu-item.active {
    background: #ff6400;
    color: #ffffff;
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-user-text {
    font-size: 0.75rem;
    color: #94a3b8;
    word-break: break-all;
}

.btn-logout {
    background: #ef4444;
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #dc2626;
}

/* ÁREA DE CONTEÚDO PRINCIPAL */
.main-content {
    flex: 1;
    min-width: 0; /* TRAVA QUE IMPEDE ESTOURO DO FLEXBOX */
    padding: 24px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* CABEÇALHO */
.titulo-pagina {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.texto-titulo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.texto-titulo p {
    font-size: 0.85rem;
    color: #64748b;
}

.btn-abrir-repasses {
    background: #ff6400;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-abrir-repasses:hover {
    background: #e05800;
}

/* CARROSSEL ARRASTÁVEL */
.wrapper-carrossel-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    margin-bottom: 24px;
}

.carrossel-metricas {
    display: flex;
    align-items: stretch;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 8px 4px 16px 4px;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
}

.carrossel-metricas::-webkit-scrollbar {
    height: 6px;
}

.carrossel-metricas::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.carrossel-metricas::-webkit-scrollbar-track {
    background-color: transparent;
}

.carrossel-metricas.arrastando {
    cursor: grabbing;
    scroll-behavior: auto;
}

/* CARDS PADRONIZADOS */
.metrica-card {
    flex: 0 0 230px;
    width: 230px;
    min-width: 230px;
    height: 145px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.metrica-card.linkable {
    cursor: pointer;
}

.metrica-card:hover {
    transform: translateY(-4px);
    border-color: #ff6400;
    box-shadow: 0 8px 18px rgba(255, 100, 0, 0.12);
}

.metrica-card i {
    font-size: 1.3rem;
}

.metrica-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    margin: 4px 0;
}

.metrica-card span {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.35;
}

/* ÍCONES */
.icone-verde { color: #2ed573; }
.icone-azul { color: #1e90ff; }
.icone-vermelho { color: #ff4757; }
.icone-amarelo { color: #ffa502; }
.icone-laranja { color: #ff6400; }
.icone-turquesa { color: #32bcad; }

/* AVISO ESTOQUE BAIXO */
.box-aviso-estoque {
    background: #fff5f5;
    border: 1px solid #ffe0e0;
    color: #d63031;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.box-aviso-estoque a {
    color: #d63031;
    font-weight: 600;
    margin-left: 6px;
}

/* CARD GRÁFICO */
.card-grafico {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.header-card-grafico {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-card-grafico h3 {
    font-size: 1.1rem;
    color: #1e293b;
}

.select-dias-grafico {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.85rem;
    outline: none;
}

.wrapper-canvas-chart {
    position: relative;
    height: 320px;
    width: 100%;
}

/* MODAIS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-large { max-width: 850px; }
.modal-small { max-width: 420px; }

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { font-size: 1.1rem; }

.btn-fechar-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

.modal-body { padding: 20px; }

/* REPASSES GRID & TABELA */
.grid-resumo-repasses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.card-resumo-repasse {
    padding: 16px;
    border-radius: 8px;
}

.card-resumo-repasse.pendente { background: #fff5f5; border-left: 4px solid #ff4757; }
.card-resumo-repasse.quitado { background: #f0fff4; border-left: 4px solid #2ed573; }
.card-resumo-repasse.split { background: #f0f8ff; border-left: 4px solid #1e90ff; }

.valor-repasse.pendente { color: #ff4757; }
.valor-repasse.quitado { color: #2ed573; }
.valor-repasse.split { color: #1e90ff; }

.box-acao-pagamento-pix {
    background: #1e293b;
    color: #ffffff;
    padding: 16px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-pagar-pix-acao {
    background: #32bcad;
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.bar-controles-tabela {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.botoes-filtro-abas { display: flex; gap: 8px; }

.btn-filtro-aba {
    background: #e2e8f0;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-filtro-aba.ativo {
    background: #ff6400;
    color: #ffffff;
}

.btn-exportar-csv {
    background: #2ed573;
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.wrapper-tabela-scroll { overflow-x: auto; }

.tabela-repasses {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tabela-repasses th, .tabela-repasses td {
    padding: 10px;
    text-align: left;
}

.tabela-repasses thead tr { background: #f1f5f9; }
.tabela-repasses tbody tr { border-bottom: 1px solid #f1f5f9; }

.linha-vazia-tabela { text-align: center; color: #64748b; padding: 20px !important; }

/* MODAL PIX */
.modal-pix-conteudo { text-align: center; }
.wrapper-qr-code-img { background: #f8fafc; padding: 12px; border-radius: 10px; display: inline-block; margin: 12px 0; }
.wrapper-qr-code-img img { max-width: 180px; }
.group-pix-copia input { width: 100%; text-align: center; padding: 8px; border: 1px solid #cbd5e1; border-radius: 6px; margin: 6px 0 12px 0; }
.btn-copiar-pix { background: #32bcad; color: #ffffff; border: none; padding: 10px; border-radius: 6px; width: 100%; font-weight: 600; cursor: pointer; }
.status-aguardando-pix { color: #2ed573; font-size: 0.8rem; margin-top: 12px; font-weight: 600; }

.hidden { display: none !important; }

/* MOBILE RESPONSIVO */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; }
    .metrica-card { flex: 0 0 190px; width: 190px; min-width: 190px; height: 135px; }
    .box-acao-pagamento-pix { flex-direction: column; gap: 12px; align-items: flex-start; }
}