:root {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-column: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #cbd5e1;
    
    --tag-yellow-bg: #fff7ed;
    --tag-yellow-text: #ea580c;
    --tag-blue-bg: #eff6ff;
    --tag-blue-text: #2563eb;
    --tag-red-bg: #fef2f2;
    --tag-red-text: #ef4444;
    --tag-green-bg: #f0fdf4;
    --tag-green-text: #16a34a;
    --tag-gray-bg: #f1f5f9;
    
    --whatsapp: #22c55e;
    --primary: #4f46e5; /* Indigo Vibrante */
    --accent: #f59e0b;  /* Amber para o "Sol" */
    --sidebar-bg: #1e1b4b; /* Dark Indigo Premium */
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-main); color: var(--text-main); height: 100vh; overflow: hidden; }

.app-container { display: flex; height: 100vh; width: 100vw; }

.sidebar { width: 220px; background: var(--sidebar-bg); border-right: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; }
.logo { padding: 25px 20px; font-size: 1.1rem; font-weight: 800; border-bottom: 1px solid rgba(255,255,255,0.1); color: white; letter-spacing: -0.5px; }
.nav-links { list-style: none; padding: 15px 8px; display: flex; flex-direction: column; gap: 4px; }
.nav-links li { padding: 10px 14px; border-radius: 8px; cursor: pointer; color: rgba(255,255,255,0.6); font-weight: 500; font-size: 0.9rem; transition: all 0.2s; }
.nav-links li:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-links li.active { background: var(--primary); color: white; font-weight: 600; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar { height: 70px; padding: 0 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg-card); gap: 20px; }
.search-container { flex: 1; max-width: 600px; }
#main-search { width: 100%; padding: 12px 20px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-main); font-size: 0.95rem; outline: none; transition: all 0.2s; }
#main-search:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }
.btn-primary { background: var(--primary); color: white; border: none; padding: 12px 20px; border-radius: 10px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2); }

.dynamic-area { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 12px; }
.board { display: flex; gap: 12px; height: 100%; align-items: stretch; }
.column { background: #e2e8f0; border-radius: 10px; width: 240px; min-width: 240px; height: 100%; display: flex; flex-direction: column; border: 1px solid var(--border); overflow: hidden; }
.col-header { padding: 10px 12px; font-weight: 700; font-size: 0.85rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; color: var(--text-main); background: rgba(255,255,255,0.3); }
.col-header .count { background: white; padding: 1px 6px; border-radius: 10px; font-size: 0.75rem; border: 1px solid var(--border); }
.cards-container { padding: 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }

/* Cards Micro Compactos */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.02); position: relative; border-left: 3px solid var(--accent); cursor: pointer; transition: all 0.2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.08); border-color: var(--primary-light); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.card-title { font-weight: 700; font-size: 0.8rem; color: var(--text-main); line-height: 1.2; }
.card-options { color: var(--text-muted); font-weight: bold; cursor: pointer; letter-spacing: 1px; line-height: 1; font-size: 0.8rem; }
.pill-empreendimento { background: var(--tag-yellow-bg); color: var(--tag-yellow-text); padding: 1px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 800; display: inline-block; border: 1px solid rgba(234, 88, 12, 0.2); margin-bottom: 4px; text-transform: uppercase; }
.info-line { display: flex; align-items: center; gap: 4px; font-size: 0.68rem; color: var(--text-muted); margin-bottom: 2px; }
.pill-renda { background: var(--tag-blue-bg); color: var(--tag-blue-text); padding: 1px 6px; border-radius: 4px; font-size: 0.68rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(37, 99, 235, 0.2); margin: 2px 0; }
.obs-box { background: #f8fafc; padding: 4px 6px; border-radius: 4px; font-size: 0.65rem; color: var(--text-muted); font-style: italic; margin: 4px 0; line-height: 1.1; border-left: 2px solid var(--border); }
.data-chegada { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 2px; }
.status-tags { display: flex; gap: 4px; margin-bottom: 6px; }
.tag-doc { background: var(--tag-red-bg); color: var(--tag-red-text); padding: 1px 4px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; border: 1px solid rgba(239, 68, 68, 0.2); }
.tag-status { background: var(--tag-green-bg); color: var(--tag-green-text); padding: 1px 4px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; border: 1px solid rgba(22, 163, 74, 0.2); display: flex; align-items: center; gap: 4px; }
.tag-status::before { content: ""; display: block; width: 4px; height: 4px; background: var(--tag-green-text); border-radius: 50%; }
.btn-whatsapp { background: var(--whatsapp); color: white; width: 100%; border: none; padding: 5px; border-radius: 6px; font-weight: 800; font-size: 0.75rem; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 4px; box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2); }


/* Modal Editar Cliente */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none; /* Hide by default */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 600px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    background: #1e3a8a; /* Azul Escuro igual ao seu CRM */
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.close-btn {
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
}

.modal-body {
    padding: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    background: var(--bg-main);
}

.form-group textarea {
    height: 80px;
    resize: none;
}

.radio-group {
    display: flex;
    gap: 10px;
}

.radio-btn {
    flex: 1;
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.radio-btn.active-nao {
    background: #ecfdf5;
    border-color: #10b981;
    color: #10b981;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-save {
    padding: 10px 20px;
    background: var(--primary); /* Azul Forte */
    border: none;
    border-radius: 8px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

/* Tela de IA (Leitor Mágico) */
.ia-view { width: 100%; height: 100%; display: flex; justify-content: center; align-items: flex-start; padding-top: 40px; overflow-y: auto; }
.ia-container { background: white; width: 600px; max-width: 95%; border-radius: 20px; border: 1px solid var(--border); box-shadow: 0 20px 40px rgba(0,0,0,0.05); padding: 40px; display: flex; flex-direction: column; gap: 25px; }
.ia-header { text-align: center; }
.ia-icon { font-size: 3.5rem; margin-bottom: 15px; display: inline-block; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.ia-header h3 { font-size: 1.8rem; color: var(--text-main); margin-bottom: 8px; font-weight: 800; }
.ia-header p { color: var(--text-muted); font-size: 1rem; line-height: 1.6; }

.ia-body { display: flex; flex-direction: column; gap: 20px; }
.upload-area { border: 2px dashed var(--primary); background: #f5f3ff; border-radius: 16px; padding: 30px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: all 0.2s; }
.upload-area:hover { background: #ede9fe; transform: scale(1.02); }
.upload-area strong { color: var(--primary); font-size: 1.1rem; }

#ia-input { width: 100%; height: 150px; padding: 20px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-main); font-size: 1rem; color: var(--text-main); resize: none; outline: none; transition: all 0.2s; line-height: 1.5; }
#ia-input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }

.btn-ia { background: linear-gradient(135deg, #4f46e5, #8b5cf6); color: white; border: none; padding: 18px; border-radius: 16px; font-weight: 800; font-size: 1.1rem; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 12px; box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3); transition: all 0.2s; }
.btn-ia:hover { transform: translateY(-2px); box-shadow: 0 15px 30px rgba(79, 70, 229, 0.4); }
.btn-ia:active { transform: scale(0.98); }
/* Dashboard Styles */
.dashboard-view { padding: 20px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; height: 100%; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.dash-card { background: white; padding: 20px; border-radius: 16px; border: 1px solid var(--border); display: flex; align-items: center; gap: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.dash-icon { font-size: 2rem; background: var(--bg-main); width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.dash-info h4 { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
.dash-info p { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.chart-container { background: white; padding: 20px; border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.chart-container h5 { margin-bottom: 15px; font-size: 1rem; font-weight: 700; color: var(--text-main); }
canvas { width: 100% !important; max-height: 250px; }

/* Follow Up Styles */
.followup-view { padding: 20px; overflow-y: auto; height: 100%; }
.followup-header { margin-bottom: 25px; }
.followup-header h3 { font-size: 1.5rem; color: var(--text-main); margin-bottom: 5px; }
.followup-header p { color: var(--text-muted); }
.followup-list { display: flex; flex-direction: column; gap: 12px; }
.followup-item { background: white; padding: 15px 20px; border-radius: 12px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); flex-wrap: wrap; }
.fu-date-badge { padding: 8px 15px; border-radius: 8px; background: #eff6ff; color: #2563eb; font-weight: 700; font-size: 0.9rem; min-width: 110px; text-align: center; }
.fu-date-badge.atrasado { background: #fef2f2; color: #ef4444; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }
.fu-info { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.fu-info strong { font-size: 1.1rem; color: var(--text-main); }
.fu-info span { font-size: 0.85rem; color: var(--text-muted); }
.fu-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.fu-actions button { padding: 8px 15px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; font-size: 0.85rem; transition: transform 0.1s; }
.fu-actions button:first-child { background: var(--whatsapp); color: white; }
.fu-actions .btn-edit-small { background: var(--bg-main); color: var(--text-main); border: 1px solid var(--border); }
.empty-state { text-align: center; padding: 50px; color: var(--text-muted); font-size: 1.2rem; font-weight: 600; }
