:root {
  --crm-primary: #8b5cf6;
  --crm-secondary: #22d3ee;
  --crm-bg: #f8fafc;
  --crm-card: #ffffff;
  --crm-text: #0f172a;
  --crm-text-muted: #64748b;
  --crm-border: #e2e8f0;
  --crm-success: #10b981;
  --crm-danger: #ef4444;
  --crm-warning: #f59e0b;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--crm-bg); color: var(--crm-text); }
.auth-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, #8b5cf6, #22d3ee); display: flex; justify-content: center; align-items: center; z-index: 10000; }
.auth-card { background: white; padding: 40px; border-radius: 28px; width: 90%; max-width: 450px; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.auth-card h2 { margin-bottom: 24px; }
.auth-card input { width: 100%; padding: 14px 16px; margin-bottom: 16px; border: 1px solid #e2e8f0; border-radius: 14px; font-size: 16px; }
.auth-card button { width: 100%; padding: 14px; background: linear-gradient(90deg, #8b5cf6, #22d3ee); color: white; border: none; border-radius: 14px; font-weight: 600; cursor: pointer; margin-bottom: 12px; }
.auth-switch { margin-top: 20px; color: #64748b; }
.auth-switch a { color: #8b5cf6; cursor: pointer; }
.crm-container { display: flex; min-height: 100vh; }
.crm-sidebar { width: 260px; background: var(--crm-card); border-right: 1px solid var(--crm-border); position: fixed; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.crm-logo { padding: 24px 20px; border-bottom: 1px solid var(--crm-border); font-size: 20px; font-weight: 700; background: linear-gradient(90deg, var(--crm-primary), var(--crm-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.crm-nav { padding: 20px; flex: 1; }
.crm-nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; border-radius: 12px; color: var(--crm-text-muted); cursor: pointer; transition: all 0.2s; }
.crm-nav-item:hover { background: rgba(139,92,246,0.08); color: var(--crm-primary); }
.crm-nav-item.active { background: linear-gradient(90deg, rgba(139,92,246,0.12), rgba(34,211,238,0.08)); color: var(--crm-primary); font-weight: 600; }
.crm-main { flex: 1; margin-left: 260px; padding: 24px 32px; }
.crm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--crm-border); flex-wrap: wrap; gap: 16px; }
.crm-header h1 { font-size: 28px; font-weight: 700; background: linear-gradient(135deg, #1e293b, #334155); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.crm-user { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--crm-card); border-radius: 40px; border: 1px solid var(--crm-border); }
.crm-avatar { width: 36px; height: 36px; background: linear-gradient(135deg, var(--crm-primary), var(--crm-secondary)); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; }
.logout-btn { background: none; border: 1px solid var(--crm-border); padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 12px; transition: 0.2s; }
.logout-btn:hover { background: var(--crm-danger); color: white; border-color: var(--crm-danger); }
.online-status { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 8px; }
.online-status.online { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
.online-status.offline { background: #ef4444; }
.crm-stats { display: grid; grid-template-columns: repeat(5,1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--crm-card); border-radius: 20px; padding: 20px; border: 1px solid var(--crm-border); transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.stat-card h3 { font-size: 14px; color: var(--crm-text-muted); margin-bottom: 8px; }
.stat-number { font-size: 28px; font-weight: 700; color: var(--crm-primary); }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-bottom: 32px; }
.chart-card { background: var(--crm-card); border-radius: 20px; padding: 20px; border: 1px solid var(--crm-border); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.chart-card h3 { margin-bottom: 16px; font-size: 18px; color: var(--crm-text); display: flex; align-items: center; gap: 8px; }
.chart-card canvas { max-height: 250px; width: 100%; }
.funnel-card { grid-column: span 2; }
.funnel-steps { display: flex; justify-content: space-around; margin-top: 20px; flex-wrap: wrap; gap: 16px; }
.funnel-step { text-align: center; flex: 1; min-width: 100px; padding: 16px; background: linear-gradient(135deg, #f8fafc, #f1f5f9); border-radius: 16px; }
.funnel-step .count { font-size: 32px; font-weight: 700; color: var(--crm-primary); }
.funnel-step .label { font-size: 14px; color: var(--crm-text-muted); margin-top: 8px; }
.funnel-step .percent { font-size: 12px; color: var(--crm-success); margin-top: 4px; }
.stats-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-mini-card { background: var(--crm-card); border-radius: 16px; padding: 16px; border: 1px solid var(--crm-border); text-align: center; }
.stat-mini-card .value { font-size: 24px; font-weight: 700; color: var(--crm-primary); }
.stat-mini-card .label { font-size: 13px; color: var(--crm-text-muted); margin-top: 4px; }
.btn-add, .btn-export, .btn-import, .btn-filter { background: var(--crm-primary); color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-weight: 500; transition: all 0.2s; }
.btn-add:hover, .btn-export:hover, .btn-import:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-export { background: var(--crm-success); }
.btn-filter { background: var(--crm-text-muted); }
.search-bar, .filter-select { padding: 12px 16px; margin-bottom: 20px; border-radius: 12px; border: 1px solid var(--crm-border); font-size: 15px; background: var(--crm-card); }
.filter-group { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-select { margin-bottom: 0; flex: 1; }
.contacts-table { background: var(--crm-card); border-radius: 20px; border: 1px solid var(--crm-border); overflow-x: auto; }
.contacts-table table { width: 100%; border-collapse: collapse; }
.contacts-table th, .contacts-table td { padding: 16px 20px; text-align: left; border-bottom: 1px solid var(--crm-border); }
.contacts-table th { background: #f8fafc; font-weight: 600; }
.contact-status { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.status-prospect { background: #fef3c7; color: #d97706; }
.status-contact { background: #dbeafe; color: #2563eb; }
.status-client { background: #d1fae5; color: #059669; }
.kanban-columns { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-top: 20px; }
.kanban-column { background: #f8fafc; border-radius: 16px; padding: 16px; min-height: 400px; }
.kanban-column h3 { margin-bottom: 16px; font-size: 1.2rem; }
.kanban-card { background: white; border-radius: 12px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--crm-border); cursor: pointer; transition: all 0.2s; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.crm-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 2000; justify-content: center; align-items: center; }
.crm-modal.active { display: flex; }
.modal-content { background: white; border-radius: 24px; width: 90%; max-width: 650px; max-height: 85vh; overflow-y: auto; padding: 32px; }
.modal-content input, .modal-content select, .modal-content textarea { width: 100%; padding: 12px; margin-bottom: 16px; border: 1px solid var(--crm-border); border-radius: 10px; font-family: inherit; }
.modal-buttons { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.loading-indicator { position: fixed; bottom: 20px; right: 20px; background: var(--crm-primary); color: white; padding: 8px 16px; border-radius: 40px; font-size: 12px; display: none; z-index: 3000; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1e293b; color: white; padding: 12px 24px; border-radius: 40px; z-index: 3000; animation: fadeInOut 3s ease; }
@keyframes fadeInOut { 0% { opacity: 0; transform: translateX(-50%) translateY(20px); } 10% { opacity: 1; transform: translateX(-50%) translateY(0); } 90% { opacity: 1; } 100% { opacity: 0; } }
.welcome-banner { background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(34,211,238,0.05)); border-radius: 16px; padding: 16px 20px; margin-bottom: 20px; border-left: 4px solid var(--crm-primary); }
.keyboard-hint { font-size: 11px; color: var(--crm-text-muted); margin-top: 8px; text-align: right; }
.appointment-container { max-width: 1200px; margin: 0 auto; }
.appointment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 40px; }
.appointment-calendar { background: white; border: 1px solid #e2e8f0; border-radius: 20px; padding: 20px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-weight: 500; margin-bottom: 10px; }
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; background: #f8fafc; transition: 0.2s; }
.calendar-day.selected { background: #8b5cf6; color: white; }
.calendar-day.has-appointment { border: 2px solid #f59e0b; }
.calendar-day.disabled { color: #cbd5e1; cursor: not-allowed; }
.appointment-form { background: white; border: 1px solid #e2e8f0; border-radius: 20px; padding: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; }
@media (max-width:1024px) { .crm-sidebar { width: 80px; } .crm-logo span, .crm-nav-item span:not(.emoji) { display: none; } .crm-main { margin-left: 80px; } .crm-stats { grid-template-columns: repeat(2,1fr); } .kanban-columns { grid-template-columns: 1fr; } .charts-grid { grid-template-columns: 1fr; } .funnel-card { grid-column: span 1; } .stats-mini { grid-template-columns: repeat(2,1fr); } }
@media (max-width:768px) { .crm-main { padding: 16px; } .crm-stats { grid-template-columns: 1fr; } .appointment-grid { grid-template-columns: 1fr; } }
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  flex-direction: column;
  gap: 20px;
}
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid white;
  border-top: 4px solid #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading-text {
  color: white;
  font-size: 1.2rem;
  font-weight: 500;
}