:root {
    --azul-royal: #4169E1;
    --azul-royal-escuro: #2a4bc0;
    --cinza: #6c757d;
    --cinza-claro: #f8f9fa;
    --cinza-escuro: #495057;
    --branco: #ffffff;
    --verde: #28a745;
    --laranja: #fd7e14;
    --vermelho: #dc3545;
    --roxo: #6f42c1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--cinza-claro);
    color: var(--cinza-escuro);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--azul-royal), var(--azul-royal-escuro));
    color: var(--branco);
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 60px;
    width: auto;
    border-radius: 8px;
}

.logo-text h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo-text p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.search-bar {
    display: flex;
    margin: 10px 0;
}

.search-bar input {
    padding: 10px 15px;
    border: none;
    border-radius: 6px 0 0 6px;
    width: 280px;
    font-size: 16px;
}

.search-bar button {
    background-color: var(--cinza-escuro);
    color: var(--branco);
    border: none;
    padding: 10px 18px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: var(--cinza);
}

nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

nav button {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--branco);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

nav button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.section {
    display: none;
    background-color: var(--branco);
    border-radius: 10px;
    padding: 25px;
    margin-top: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.active {
    display: block;
}

h2 {
    color: var(--azul-royal);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--cinza-claro);
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    color: var(--cinza-escuro);
    margin: 25px 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--cinza-escuro);
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--cinza);
    border-radius: 6px;
    font-size: 16px;
    transition: border 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--azul-royal);
    outline: none;
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.2);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

button {
    background-color: var(--azul-royal);
    color: var(--branco);
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

button:hover {
    background-color: var(--azul-royal-escuro);
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--verde);
}

.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: var(--laranja);
}

.btn-warning:hover {
    background-color: #e06b10;
}

.btn-danger {
    background-color: var(--vermelho);
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-cinza {
    background-color: var(--cinza);
}

.btn-cinza:hover {
    background-color: var(--cinza-escuro);
}

.btn-roxo {
    background-color: var(--roxo);
}

.btn-roxo:hover {
    background-color: #5a359a;
}

.clientes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.cliente-card {
    background-color: var(--branco);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    border-left: 5px solid var(--azul-royal);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.cliente-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--azul-royal), var(--azul-royal-escuro));
}

.cliente-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

/* NOVO: Estilos para cards de Visita de Avaliação */
.cliente-card.visita {
    border-left-color: var(--roxo);
}

.cliente-card.visita::before {
    background: linear-gradient(90deg, var(--roxo), #8a6dcc);
}

.cliente-card.proposta {
    border-left-color: var(--laranja);
}

.cliente-card.proposta::before {
    background: linear-gradient(90deg, var(--laranja), #ff9d4d);
}

.cliente-card.pendente {
    border-left-color: var(--laranja);
}

.cliente-card.pendente::before {
    background: linear-gradient(90deg, var(--laranja), #ff9d4d);
}

.cliente-card.atrasado {
    border-left-color: var(--vermelho);
}

.cliente-card.atrasado::before {
    background: linear-gradient(90deg, var(--vermelho), #e35d6a);
}

.cliente-card h3 {
    color: var(--azul-royal);
    margin-bottom: 12px;
    font-size: 20px;
}

.cliente-info {
    margin-bottom: 15px;
}

.cliente-info p {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cliente-info i {
    color: var(--azul-royal);
    margin-top: 3px;
    flex-shrink: 0;
}

.cliente-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.cliente-actions button {
    flex: 1;
    padding: 10px;
    font-size: 14px;
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
    background-color: var(--cinza-claro);
    padding: 15px;
    border-radius: 8px;
}

.filters label {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--cinza-escuro);
}

.filters select, .filters button {
    padding: 10px 15px;
}

.alertas-list {
    margin-top: 20px;
}

.alerta-item {
    background-color: var(--branco);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border-left: 5px solid var(--azul-royal);
}

.alerta-item:hover {
    transform: translateX(5px);
}

.alerta-item.pendente {
    border-left-color: var(--laranja);
}

.alerta-item.atrasado {
    border-left-color: var(--vermelho);
}

.alerta-info h4 {
    margin-bottom: 8px;
    color: var(--azul-royal);
}

.alerta-info p {
    color: var(--cinza);
    font-size: 15px;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--cinza);
}

.empty-state i {
    font-size: 70px;
    margin-bottom: 20px;
    color: var(--cinza-claro);
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--cinza);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--branco);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
    transition: all 0.3s;
    border-top: 4px solid var(--azul-royal);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.stat-card h3 {
    font-size: 36px;
    margin-bottom: 10px;
    color: var(--azul-royal);
}

.stat-card.total {
    border-top-color: var(--azul-royal);
}

.stat-card.pendentes {
    border-top-color: var(--laranja);
}

.stat-card.pendentes h3 {
    color: var(--laranja);
}

.stat-card.atrasados {
    border-top-color: var(--vermelho);
}

.stat-card.atrasados h3 {
    color: var(--vermelho);
}

.stat-card.propostas {
    border-top-color: var(--roxo);
}

.stat-card.propostas h3 {
    color: var(--roxo);
}

/* NOVO: Estilo para cards de visita no dashboard */
.stat-card.visitas {
    border-top-color: var(--roxo);
}

.stat-card.visitas h3 {
    color: var(--roxo);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.form-actions button {
    flex: 1;
}

.tipo-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

/* NOVO: Badge para Visita de Avaliação */
.badge-visita {
    background-color: var(--roxo);
    color: white;
}

.badge-proposta {
    background-color: var(--laranja);
    color: white;
}

.badge-servico {
    background-color: var(--verde);
    color: white;
}

/* NOVO: Campos específicos para visita */
.campos-visita {
    background-color: rgba(111, 66, 193, 0.05);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--roxo);
    margin-bottom: 20px;
}

/* Responsividade */
@media (max-width: 992px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-bar {
        width: 100%;
        margin: 15px 0;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    nav {
        justify-content: flex-start;
    }
    
    .logo {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .logo-text {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .clientes-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filters > div {
        width: 100%;
    }
    
    .filters select {
        width: 100%;
    }
    
    .alerta-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .alerta-actions {
        margin-top: 15px;
        width: 100%;
        display: flex;
        gap: 10px;
    }
    
    .alerta-actions button {
        flex: 1;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 15px;
    }
    
    .section {
        padding: 20px;
    }
    
    .cliente-actions {
        flex-direction: column;
    }
    
    .logo-text h1 {
        font-size: 24px;
    }
    
    .logo-img {
        height: 50px;
    }
    
    nav button {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Estilos para Histórico */
.historico-list {
    margin-top: 20px;
}

.contato-item {
    background-color: var(--branco);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border-left: 4px solid var(--azul-royal);
    transition: all 0.3s;
}

.contato-item:hover {
    transform: translateX(5px);
}

.contato-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.contato-info h4 {
    margin-bottom: 5px;
    color: var(--azul-royal);
}

.contato-meta {
    color: var(--cinza);
    font-size: 14px;
    margin-bottom: 10px;
}

.contato-observacoes {
    color: var(--cinza-escuro);
    line-height: 1.5;
}

.contato-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.contato-actions button {
    padding: 6px 12px;
    font-size: 13px;
}

/* Badges para tipos de contato */
.badge-contato {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

.badge-telefone { background-color: #17a2b8; color: white; }
.badge-email { background-color: #6f42c1; color: white; }
.badge-whatsapp { background-color: #28a745; color: white; }
.badge-visita { background-color: #fd7e14; color: white; }
.badge-proposta { background-color: #e83e8c; color: white; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--branco);
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--azul-royal), var(--azul-royal-escuro));
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: white;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
}

/* Botão flutuante para adicionar contato */
.btn-flutuante {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--azul-royal);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s;
    z-index: 100;
}

.btn-flutuante:hover {
    background-color: var(--azul-royal-escuro);
    transform: scale(1.1);
}

/* Estilos para Relatórios */
.export-actions {
    text-align: center;
}

.export-actions button {
    margin-bottom: 10px;
}

.estatisticas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.estatistica-item {
    background: var(--cinza-claro);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--azul-royal);
}

.estatistica-item.destaque {
    background: var(--verde);
    color: white;
    border-left-color: var(--verde);
}

.estatistica-item h3 {
    margin: 0;
    font-size: 24px;
    color: inherit;
}

.estatistica-item p {
    margin: 5px 0 0 0;
    font-size: 12px;
    font-weight: 600;
}

.estatistica-item small {
    font-size: 10px;
    opacity: 0.8;
}

.relatorio-header {
    background: var(--cinza-claro);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.relatorio-info {
    margin-top: 10px;
}

.relatorio-info .badge {
    margin-right: 8px;
    margin-bottom: 5px;
}

.badge-info {
    background-color: var(--azul-royal);
    color: white;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--cinza-claro);
}

.table th {
    background-color: var(--azul-royal);
    color: white;
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Responsividade para relatórios */
@media (max-width: 768px) {
    .estatisticas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-responsive {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
    }
}

/* ESTILOS GLOBAIS PARA TODOS OS MODAIS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #4169E1;
}

.modal-body {
    padding: 20px;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #333;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modais específicos */
#modalContato .modal-content {
    max-width: 600px;
    margin: 2% auto;
    max-height: 90vh;
    overflow-y: auto;
}

#modalWhatsApp .modal-content {
    max-width: 500px;
    margin: 2% auto;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsividade */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    #modalContato .modal-content,
    #modalWhatsApp .modal-content {
        margin: 5% auto;
        max-width: 95%;
        max-height: 85vh;
    }
    
    .form-row {
        flex-direction: column !important;
    }
}

/* Dashboard Avançado */
.stats-grid {
    margin-bottom: 2rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid #4169E1;
}

.metric-card.positive {
    border-left-color: #28a745;
}

.metric-card.negative {
    border-left-color: #dc3545;
}

.metric-icon {
    font-size: 2rem;
    color: #4169E1;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2c3e50;
}

.metric-title {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Grid de Gráficos */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chart-card {
    padding: 1.5rem;
}

.chart-card h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsivo */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================= */
/* DASHBOARD AVANÇADO - CORREÇÕES */
/* ============================================= */

.stats-grid {
    margin-bottom: 2rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid #4169E1;
    min-height: 100px;
}

.metric-card.positive {
    border-left-color: #28a745;
}

.metric-card.negative {
    border-left-color: #dc3545;
}

.metric-icon {
    font-size: 2rem;
    color: #4169E1;
    flex-shrink: 0;
}

.metric-content {
    flex: 1;
    min-width: 0;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.2;
}

.metric-title {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Grid de Gráficos - CORRIGIDO */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 300px; /* ALTURA FIXA */
    display: flex;
    flex-direction: column;
}

.chart-card {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* IMPORTANTE para flexbox */
}

.chart-card h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0; /* Não encolher o título */
}

/* Container do canvas - CORRIGIDO */
.chart-card canvas {
    flex: 1; /* Ocupa todo espaço restante */
    min-height: 0; /* IMPORTANTE para flexbox */
    width: 100% !important; /* Forçar largura total */
    height: 100% !important; /* Forçar altura total */
}

/* Responsivo */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-container {
        height: 280px; /* Altura menor em mobile */
    }
    
    .metric-card {
        padding: 1rem;
        min-height: 80px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .metric-icon {
        font-size: 1.5rem;
    }
}

/* Garantir que os gráficos não vazem */
.chartjs-render-monitor {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Mensagens de erro */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

/* ============================================= */
/* DASHBOARD - LAYOUT CORRIGIDO */
/* ============================================= */

.stats-grid {
    margin-bottom: 2rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Layout corrigido para 2 cards na segunda linha */
.stats-row:last-child {
    grid-template-columns: repeat(2, 1fr);
    max-width: 50%;
    margin: 0 auto;
}

/* Cards de métricas - VERSÃO CORRIGIDA */
.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 5px solid #4169E1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 100px;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.metric-card.positive {
    border-left-color: #28a745;
}

.metric-card.negative {
    border-left-color: #dc3545;
}

.metric-icon {
    font-size: 2.5rem;
    color: #4169E1;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(65, 105, 225, 0.1);
    border-radius: 10px;
}

.metric-card.positive .metric-icon {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.metric-card.negative .metric-icon {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.metric-content {
    flex: 1;
    min-width: 0;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.metric-title {
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid de Gráficos */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chart-card {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chart-card h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chart-card canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Responsivo */
@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-row:last-child {
        max-width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .stats-row:last-child {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-container {
        height: 280px;
    }
    
    .metric-card {
        padding: 1.2rem;
        min-height: 90px;
    }
    
    .metric-value {
        font-size: 1.7rem;
    }
    
    .metric-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .metric-card {
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
        padding: 1rem;
    }
    
    .metric-icon {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
}

/* Garantir que os gráficos não vazem */
.chartjs-render-monitor {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* ============================================= */
/* DASHBOARD - LAYOUT SIMPLIFICADO */
/* ============================================= */

.dashboard-metrics {
    margin-bottom: 2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 5px solid #4169E1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 100px;
}

.metric-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.metric-icon {
    font-size: 2.5rem;
    color: #4169E1;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(65, 105, 225, 0.1);
    border-radius: 10px;
}

.metric-info {
    flex: 1;
    min-width: 0;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.metric-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid de Gráficos */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chart-card {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chart-card h3 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.chart-card canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    height: 100% !important;
}

/* Responsivo */
@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-container {
        height: 280px;
    }
    
    .metric-item {
        padding: 1.2rem;
        min-height: 90px;
    }
    
    .metric-value {
        font-size: 1.7rem;
    }
    
    .metric-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .metric-item {
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
        padding: 1rem;
    }
    
    .metric-icon {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
}

/* Garantir que os gráficos não vazem */
.chartjs-render-monitor {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Estilos para o funil triangular */
.chart-container .funil-connector {
    stroke: #999;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
}

/* Efeito visual para as barras do funil */
.metric-funil {
    background: linear-gradient(135deg, #4169E1, #FFC107, #28a745);
    border-radius: 0 0 10px 10px;
    clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}

/* Container do funil */
.funil-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 20px 0;
}

.funil-camada {
    background: #4169E1;
    color: white;
    padding: 15px 30px;
    text-align: center;
    font-weight: bold;
    position: relative;
    min-width: 200px;
}

.funil-camada.visitas { 
    background: #4169E1; 
    width: 300px;
}
.funil-camada.propostas { 
    background: #FFC107; 
    color: #333;
    width: 200px;
}
.funil-camada.servicos { 
    background: #28a745; 
    width: 100px;
}

.funil-camada::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 20px solid inherit;
}