* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #1e40af 100%);
    min-height: 100vh;
    color: #333;
    font-size: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #3730a3;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #1e40af;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#ultima-atualizacao {
    font-size: 0.85rem;
    color: #6b7280;
}

.btn-refresh {
    background: linear-gradient(135deg, #3730a3, #1e40af);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(55, 48, 163, 0.3);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(55, 48, 163, 0.4);
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3730a3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading.hidden {
    display: none;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
}

/* Visão Geral Section */
.visao-geral-section {
    margin-bottom: 2.5rem;
}

.visao-geral-section h2 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-left: 5px solid var(--accent-color);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: var(--accent-color);
    opacity: 0.1;
    border-radius: 0 16px 0 50px;
}

.kpi-card.oportunidades { --accent-color: #3b82f6; }
.kpi-card.conversao { --accent-color: #10b981; }
.kpi-card.vendas { --accent-color: #f59e0b; }
.kpi-card.ticket { --accent-color: #8b5cf6; }

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-color)dd);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.kpi-content h3 {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 0.3rem;
    line-height: 1;
}

.kpi-change {
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
}

.kpi-change.positive { color: #10b981; }
.kpi-change.negative { color: #ef4444; }
.kpi-change.neutral { color: #6b7280; }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    align-items: start;
}

/* Chart Containers */
.chart-container, .orcamentos-container, .equipe-container {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border-top: 4px solid #3730a3;
}

.chart-container:hover, .orcamentos-container:hover, .equipe-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.12);
}

.chart-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.chart-header h3 {
    color: #1e40af;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.3rem;
}

.chart-subtitle {
    color: #6b7280;
    font-size: 0.85rem;
    font-style: italic;
}

.negociacao-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #6b7280;
}

.negociacao-stats strong {
    color: #1e40af;
}

/* Funil específico */
.funil-container {
    grid-column: span 2;
}

/* Canvas dos gráficos */
.chart-container canvas {
    max-height: 300px !important;
}

.funil-container canvas {
    max-height: 400px !important;
}

/* Orçamentos Grid */
.orcamentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.orcamento-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.orcamento-item:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.orcamento-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3730a3, #1e40af);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.orcamento-info h4 {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.orcamento-info p {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e40af;
}

/* Tabela da Equipe */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table th,
table td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

table th {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #1e40af;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    color: #374151;
    font-weight: 500;
}

table tr:hover {
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 1200px) {
    .funil-container {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .kpis-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .kpi-card {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }
    
    .orcamentos-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .negociacao-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    table th,
    table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .kpis-grid {
        grid-template-columns: 1fr;
    }
    
    .orcamentos-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
}

/* Animações */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card,
.chart-container,
.orcamentos-container,
.equipe-container {
    animation: fadeInUp 0.6s ease forwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}