:root {
    --bg-base: #0b0f19;
    --bg-panel: #131b2e;
    --bg-elevated: #1a233a;
    --bg-hover: #1e2943;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background: var(--bg-base); color: var(--text-main); font-size: 15px; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }

/* ================= LAYOUT ================= */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}
.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
}
.logo-box {
    display: flex; align-items: center; gap: 12px;
}
.logo-box i { font-size: 28px; color: var(--primary); text-shadow: 0 0 10px var(--primary-glow); }
.logo-box h2 { font-weight: 700; font-size: 20px; letter-spacing: 1px; }

.nav-links { flex: 1; padding: 20px 0; list-style: none; }
.nav-links li { padding: 8px 16px; margin: 4px 16px; border-radius: 8px; transition: var(--transition); cursor: pointer; }
.nav-links li:hover { background: var(--bg-hover); }
.nav-links li.active { background: var(--primary); box-shadow: 0 4px 12px var(--primary-glow); }
.nav-links li a { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; padding: 6px 8px; }
.nav-links li a i { font-size: 22px; }

.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); }
.profile-details { display: flex; align-items: center; gap: 12px; }
.profile-content img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--primary); }
.profile_name { font-weight: 600; font-size: 14px; }
.job { color: var(--success); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.job::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(59,130,246,0.05), transparent 400px);
}
.top-header {
    height: 80px; padding: 0 40px; display: flex; justify-content: space-between;
    align-items: center; border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10;
}
.header-title h1 { font-size: 24px; font-weight: 600; }
.header-title p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.status-indicator {
    display: flex; align-items: center; gap: 8px; background: rgba(16, 185, 129, 0.1);
    padding: 8px 16px; border-radius: 20px; color: var(--success); font-size: 13px; font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16,185,129, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129, 0); } }

/* ================= VIEWS ================= */
.view-container { padding: 40px; position: relative; }
.view { display: none; opacity: 0; animation: fadeIn 0.4s ease forwards; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 30px; }
.stat-card {
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
    display: flex; align-items: center; gap: 20px; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.15); box-shadow: 0 10px 20px rgba(0,0,0,0.3); }
.icon-box { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.icon-box.info { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.icon-box.primary { background: rgba(139, 92, 246, 0.1); color: var(--secondary); }
.icon-box.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.icon-box.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-info .label { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-info h3 { font-size: 28px; font-weight: 700; margin-top: 5px; }

/* CHARTS */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chart-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.chart-panel h3 { font-size: 16px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; color: var(--text-muted); }

/* CONTROLS */
.panel-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.filters { display: flex; gap: 12px; }
.custom-input, .custom-select {
    background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-main);
    padding: 10px 16px; border-radius: 8px; outline: none; transition: var(--transition);
}
.custom-input:focus, .custom-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-bar { position: relative; width: 300px; }
.search-bar i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-bar input { width: 100%; padding-left: 44px; background: var(--bg-elevated); border: 1px solid var(--border); color: #fff; padding-top: 10px; padding-bottom: 10px; border-radius: 8px;}

/* BUTTONS */
.btn { border: none; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #2563eb; box-shadow: 0 4px 12px var(--primary-glow); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-elevated); border-color: var(--text-muted); }
.btn-block { width: 100%; }

/* TABLE */
.table-container { margin-top: 24px; overflow-x: auto; }
.luxury-table { width: 100%; border-collapse: collapse; text-align: left; }
.luxury-table th { padding: 16px; color: var(--text-muted); font-size: 13px; text-transform: uppercase; font-weight: 600; border-bottom: 1px solid var(--border); }
.luxury-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.luxury-table tr:hover td { background: rgba(255,255,255,0.02); }
.luxury-table tr:last-child td { border-bottom: none; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge.ativo { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.convertido { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.encerrado { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.action-btn { background: var(--bg-elevated); color: var(--primary); border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: 0.2s; font-size: 18px; }
.action-btn:hover { background: var(--primary); color: #fff; }

/* CHAT VIEW */
.chat-layout { display: grid; grid-template-columns: 350px 1fr; gap: 24px; height: calc(100vh - 160px); }
.lead-info-panel, .conversation-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.lead-info-panel { padding: 30px 24px; text-align: center; }
.lead-avatar { width: 80px; height: 80px; background: var(--bg-elevated); border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--text-muted); }
.lead-info-panel h3 { font-size: 18px; margin-bottom: 8px; }
.divider { border: 0; height: 1px; background: var(--border); margin: 24px 0; }
.info-group { text-align: left; margin-bottom: 16px; background: var(--bg-elevated); padding: 12px; border-radius: 8px; }
.info-group span { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; }
.info-group strong { font-size: 15px; }

.conversation-panel { overflow: hidden; }
.conversation-header { padding: 20px; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.2); }
.messages-container { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.empty-state { text-align: center; color: var(--text-muted); margin: auto; }
.msg-bubble { max-width: 80%; padding: 12px 18px; border-radius: 12px; line-height: 1.5; position: relative; }
.msg-bubble.user { background: var(--bg-elevated); color: #fff; align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.msg-bubble.assistant { background: rgba(59, 130, 246, 0.15); color: #e2e8f0; align-self: flex-end; border-bottom-right-radius: 4px; border: 1px solid rgba(59, 130, 246, 0.3); }
.msg-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; display: block; text-align: right; }
.msg-badge { font-size: 10px; background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; position: absolute; top: -10px; right: 10px; border: 1px solid var(--border); }

/* CONFIG GRID */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.config-card .card-header-icon { font-size: 18px; font-weight: 600; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.config-card .card-header-icon i { color: var(--primary); font-size: 24px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.form-group .custom-input { width: 100%; }
.form-group small { display: block; margin-top: 6px; font-size: 12px; color: #64748b; }

/* TOGGLE SWITCH */
.toggle-switch { display: flex; align-items: center; cursor: pointer; gap: 12px; }
.toggle-switch input { display: none; }
.slider { width: 44px; height: 24px; background: var(--bg-elevated); border-radius: 34px; position: relative; transition: 0.3s; border: 1px solid var(--border); }
.slider:before { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: var(--text-muted); top: 2px; left: 3px; transition: 0.3s; }
.toggle-switch input:checked + .slider { background: var(--success); border-color: var(--success); }
.toggle-switch input:checked + .slider:before { transform: translateX(18px); background: #fff; }
.toggle-label { font-weight: 600; }

/* TOAST */
.toast { position: fixed; bottom: -100px; right: 24px; background: var(--bg-elevated); color: #fff; padding: 16px 24px; border-radius: 8px; border-left: 4px solid var(--primary); box-shadow: 0 10px 30px rgba(0,0,0,0.5); transition: 0.4s; z-index: 1000; display: flex; align-items: center; gap: 12px; }
.toast.show { bottom: 24px; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* ================= NOVOS ESTILOS CONFIGS ================= */
.input-wrapper { position: relative; width: 100%; }
.input-wrapper i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 18px; pointer-events: none; }
.input-wrapper input { width: 100% !important; padding-left: 42px !important; }

.config-inner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

.status-toggle-box { background: rgba(0,0,0,0.15); padding: 16px; border-radius: 12px; border: 1px solid var(--border); margin-top: 10px; }

.memory-setting { display: flex; gap: 20px; align-items: center; background: rgba(255,255,255,0.02); padding: 16px; border-radius: 12px; border: 1px dashed var(--border); }
.memory-info p { font-size: 13px; color: var(--text-muted); line-height: 1.4; margin-bottom: 6px; }

.save-actions { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 24px; }
.save-actions .btn { font-size: 15px; letter-spacing: 0.5px; }

.badge.info { background: rgba(59, 130, 246, 0.1); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.2); }

@media (max-width: 1024px) {
    .config-grid { grid-template-columns: 1fr; }
    .config-inner-grid { grid-template-columns: 1fr; }
}
