:root {
    --primary: #4f46e5; --primary-hover: #4338ca; --secondary: #e0e7ff; --secondary-text: #3730a3;
    --background: #f3f4f6; --surface: #ffffff; --text-main: #111827; --text-muted: #6b7280;
    --border: #e5e7eb; --success: #10b981; --warning: #f59e0b; --danger: #ef4444; --info: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--background); color: var(--text-main); -webkit-font-smoothing: antialiased; }

h1, h2, h3 { font-weight: 600; color: var(--text-main); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.mt-20 { margin-top: 20px; } .mb-20 { margin-bottom: 20px; }

button { border: none; border-radius: var(--radius); padding: 10px 16px; font-weight: 500; cursor: pointer; transition: all 0.2s; font-size: 0.875rem; }
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); box-shadow: var(--shadow-md); }
.btn-secondary { background-color: var(--secondary); color: var(--secondary-text); }
.btn-secondary:hover { background-color: #c7d2fe; }
.btn-danger { background-color: #fee2e2; color: var(--danger); }
.btn-danger:hover { background-color: #fecaca; }
.btn-success { background-color: var(--success); color: white; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-main); font-size: 0.875rem; outline: none; transition: border 0.2s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }

input[type="checkbox"] { width: auto !important; cursor: pointer; transform: scale(1.2); margin-right: 8px; accent-color: var(--primary); }

.status-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-cb { display: flex; align-items: center; font-size: 0.85rem; font-weight: 500; cursor: pointer; user-select: none; background: #f8fafc; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); transition: 0.2s;}
.filter-cb:hover { border-color: var(--primary); background: #f1f5f9; }

.auth-wrapper { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, #000080 100%); }
.auth-card { background: var(--surface); padding: 40px; border-radius: 12px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header h2 { font-size: 2.2rem; color: var(--text-main); font-weight: 700;}
.auth-header p { color: var(--text-muted); margin-top: 5px; }
.auth-card .input-group { margin-bottom: 15px; }
.auth-card label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }

.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-brand { padding: 24px; font-size: 1.5rem; font-weight: 700; color: var(--text-main); border-bottom: 1px solid var(--border); }
.user-profile { padding: 20px 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.avatar { width: 45px; height: 45px; background-color: var(--secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; border: 2px solid var(--primary); transition: 0.2s;}
.avatar:hover { opacity: 0.8; }
.user-profile strong { display: block; font-size: 0.9rem; }
.user-profile span { font-size: 0.8rem; color: var(--text-muted); text-transform: capitalize;}
.sidebar-nav { padding: 20px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item { padding: 10px 12px; border-radius: var(--radius); color: var(--text-main); text-decoration: none; font-weight: 500; transition: 0.2s; display: flex; align-items: center; gap: 10px; font-size: 0.95rem; }
.nav-item:hover, .nav-item.active { background: var(--secondary); color: var(--primary); }
.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); }

.main-content { flex: 1; display: flex; flex-direction: column; background-color: var(--background); overflow-y: auto; }
.topbar { background: var(--surface); padding: 20px 32px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.content-area { padding: 32px; max-width: 1400px; margin: 0 auto; width: 100%; }

.panel { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.panel h3 { margin-bottom: 16px; font-size: 1.1rem; border-bottom: 1px solid var(--border); padding-bottom: 8px;}
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; border: none; cursor: pointer; }
.bg-novo { background: #dbeafe; color: #1e40af; }
.bg-negociacao { background: #fef3c7; color: #b45309; }
.bg-fechado { background: #d1fae5; color: #065f46; }
.bg-perdido { background: #fee2e2; color: #991b1b; }
.bg-iniciada { background: #1e3a8a; color: white; } 
.bg-sem-wpp { background: #7f1d1d; color: white; }  

.list-item { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; background: var(--surface); display: flex; justify-content: space-between; align-items: center; transition: 0.2s;}
.list-item:hover { border-color: #cbd5e1; box-shadow: var(--shadow-sm); }
.content-editable { outline: none; border-bottom: 1px dashed transparent; transition: 0.2s;}
.content-editable:focus { border-bottom-color: var(--primary); background: #f8fafc;}

.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); transition: 0.2s; position: relative;}
.lead-card:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.lead-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.lead-name { font-weight: 600; font-size: 1.1rem; color: var(--text-main); }
.lead-info { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.lead-notes { width: 100%; border: 1px solid #d1d5db; border-radius: 6px; padding: 12px; font-size: 0.9rem; background: #fffbdd; resize: vertical; margin-bottom: 12px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); transition: 0.2s;}
.lead-notes:focus { background: #fff; border-color: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.stat-card { background: var(--surface); padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stat-card h3 { font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; border: none; padding: 0;}
.stat-card .value { font-size: 2.5rem; font-weight: 700; color: var(--text-main); }

.dropzone { border: 2px dashed #9ca3af; background: #f9fafb; text-align: center; padding: 30px; transition: 0.3s; display: flex; justify-content: center; align-items: center; }
.dropzone.dragover { border-color: var(--primary); background: #e0e7ff; }

.folder-section { margin-bottom: 20px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm);}
.folder-header { background: #f8fafc; padding: 15px 20px; font-weight: bold; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.folder-content { padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; min-height: 50px;}
.reply-card { background: white; border: 1px solid var(--border); border-radius: 6px; padding: 15px; box-shadow: var(--shadow-sm); cursor: grab; transition: 0.2s;}
.reply-card:active { cursor: grabbing; opacity: 0.8; transform: scale(0.98); }
.reply-card.drag-over { border: 2px dashed var(--primary); opacity: 0.5; }

/* ---- CALENDÁRIO DE TAREFAS ---- */
.calendar-panel { overflow: hidden; }
.calendar-controls { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--border); margin-bottom: 15px;}
.calendar-controls h2 { font-size: 1.4rem; color: var(--primary); margin: 0; text-transform: capitalize; }
.calendar-grid-header { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-weight: bold; color: var(--text-muted); font-size: 0.9rem; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); border-right: 1px solid var(--border);}
.cal-day { background: var(--surface); min-height: 120px; padding: 8px; display: flex; flex-direction: column; cursor: pointer; transition: 0.2s; }
.cal-day:hover { background: #f8fafc; }
.cal-day-number { font-weight: bold; font-size: 0.9rem; color: var(--text-main); margin-bottom: 8px; text-align: right;}
.cal-day.empty { background: #f9fafb; cursor: default; }
.cal-day.weekend { background: #f3f4f6; } 
.cal-day.today .cal-day-number { color: var(--primary); font-size: 1.1rem; }
.cal-task { background: #e0e7ff; border-left: 3px solid var(--primary); border-radius: 4px; padding: 6px; margin-bottom: 5px; font-size: 0.8rem; display: flex; flex-direction: column; gap: 4px; position: relative;}
.cal-task.done { background: #f3f4f6; border-left-color: #9ca3af; color: #9ca3af; }
.cal-task.done .task-title { text-decoration: line-through; }
.task-header-cal { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.task-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; outline: none; }
.task-time-badge { font-size: 0.7rem; background: rgba(0,0,0,0.05); padding: 2px 4px; border-radius: 4px; color: var(--text-muted); font-weight: bold;}