@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --red-50: #fef2f2; --red-100: #fee2e2; --red-200: #fecaca;
  --red-300: #fca5a5; --red-400: #f87171; --red-500: #ef4444;
  --red-600: #dc2626; --red-700: #b91c1c; --red-800: #991b1b; --red-900: #7f1d1d;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
  --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937; --gray-900: #111827;
  --white: #ffffff; --black: #000000;
  --primary: var(--red-600); --primary-hover: var(--red-700); --primary-light: var(--red-50);
  --sidebar-bg: var(--gray-900); --sidebar-text: var(--gray-300);
  --sidebar-active: var(--red-600); --sidebar-width: 260px;
  --content-bg: var(--gray-50); --card-bg: var(--white);
  --text-primary: var(--gray-900); --text-secondary: var(--gray-500);
  --border: var(--gray-200); --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius-sm: 6px; --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --transition: all .2s ease;
  --stage-new: #6366f1; --stage-contacted: #3b82f6; --stage-interested: #f59e0b;
  --stage-demo: #8b5cf6; --stage-negotiation: #f97316; --stage-joined: #22c55e;
  --stage-lost: #ef4444; --stage-not-interested: #6b7280;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Inter', sans-serif; background: var(--content-bg); color: var(--text-primary); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; font-size: .9rem; outline: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* LOGIN */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gray-900) 0%, #1a1a2e 50%, var(--red-900) 100%); }
.login-card { background: var(--white); border-radius: var(--radius-xl); padding: 3rem;
  width: 420px; max-width: 90vw; box-shadow: 0 25px 50px rgba(0,0,0,.3); animation: slideUp .5s ease; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 2rem; font-weight: 800; }
.login-logo .logo-red { color: var(--red-600); }
.login-logo .logo-black { color: var(--gray-900); }
.login-logo p { color: var(--text-secondary); font-size: .85rem; margin-top: .25rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; font-size: .8rem; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: .4rem; }
.form-control { width: 100%; padding: .7rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: var(--transition); background: var(--white); font-size: .9rem; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--red-100); }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .65rem 1.25rem;
  border-radius: var(--radius); font-weight: 600; font-size: .85rem; transition: var(--transition); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--gray-100); color: var(--text-primary); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--red-100); color: var(--red-700); }
.btn-danger:hover { background: var(--red-200); }
.btn-success { background: #dcfce7; color: #166534; }
.btn-success:hover { background: #bbf7d0; }
.btn-block { width: 100%; justify-content: center; padding: .85rem; font-size: 1rem; }
.btn-sm { padding: .4rem .75rem; font-size: .78rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* LAYOUT */
.app-container { display: none; }
.app-container.active { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform .3s ease; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-header h1 { font-size: 1.3rem; font-weight: 800; }
.sidebar-header .logo-red { color: var(--red-400); }
.sidebar-header .logo-white { color: var(--white); }
.sidebar-header p { font-size: .7rem; color: var(--gray-500); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: .75rem; overflow-y: auto; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section-title { font-size: .65rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--gray-500); padding: 0 .75rem; margin-bottom: .5rem; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem;
  border-radius: var(--radius); color: var(--gray-400); font-size: .85rem; font-weight: 500;
  transition: var(--transition); cursor: pointer; margin-bottom: 2px; position: relative; }
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item.active { background: var(--red-600); color: var(--white); }
.nav-item .badge { position: absolute; right: .75rem; background: var(--red-500);
  color: white; font-size: .65rem; padding: 1px 6px; border-radius: 10px; font-weight: 700; }
.nav-item.active .badge { background: rgba(255,255,255,.25); }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,.08); }
.user-info { display: flex; align-items: center; gap: .75rem; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--red-600);
  display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: .8rem; }
.user-name { font-size: .85rem; font-weight: 600; color: var(--white); }
.user-role { font-size: .7rem; color: var(--gray-500); }

.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; }
.page-header { padding: 1.5rem 2rem; background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.page-title h2 { font-size: 1.4rem; font-weight: 700; }
.page-title p { color: var(--text-secondary); font-size: .82rem; }
.page-actions { display: flex; gap: .5rem; align-items: center; }
.page-body { padding: 1.5rem 2rem; }

/* STATS CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: var(--transition);
  position: relative; overflow: hidden; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.red::before { background: var(--red-500); }
.stat-card.blue::before { background: #3b82f6; }
.stat-card.green::before { background: #22c55e; }
.stat-card.orange::before { background: #f59e0b; }
.stat-card.purple::before { background: #8b5cf6; }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 1rem; }
.stat-card.red .stat-icon { background: var(--red-50); color: var(--red-600); }
.stat-card.blue .stat-icon { background: #eff6ff; color: #3b82f6; }
.stat-card.green .stat-icon { background: #f0fdf4; color: #22c55e; }
.stat-card.orange .stat-icon { background: #fffbeb; color: #f59e0b; }
.stat-card.purple .stat-icon { background: #faf5ff; color: #8b5cf6; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-secondary); font-size: .78rem; margin-top: .25rem; font-weight: 500; }
.stat-change { font-size: .72rem; font-weight: 600; margin-top: .5rem; display: inline-flex; align-items: center; gap: .2rem; padding: 2px 6px; border-radius: 4px; }
.stat-change.up { background: #dcfce7; color: #166534; }
.stat-change.down { background: #fef2f2; color: #991b1b; }

/* CHARTS */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.chart-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.chart-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 1rem; }
.chart-container { position: relative; height: 260px; }

/* TABLE */
.table-card { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.table-header { padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.table-header h3 { font-size: .95rem; font-weight: 700; }
.table-filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filter-select { padding: .45rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .8rem; background: var(--white); color: var(--text-primary); }
.search-input { padding: .45rem .75rem .45rem 2rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .8rem; width: 200px; background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 8px center; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: .75rem 1rem; text-align: left; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary);
  background: var(--gray-50); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: .75rem 1rem; font-size: .85rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }
.lead-name { font-weight: 600; color: var(--text-primary); }
.lead-name span { display: block; font-weight: 400; font-size: .75rem; color: var(--text-secondary); }

/* BADGES */
.badge-stage { padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 600; display: inline-block; }
.badge-new { background: #eef2ff; color: #4338ca; }
.badge-contacted { background: #eff6ff; color: #1d4ed8; }
.badge-interested { background: #fffbeb; color: #b45309; }
.badge-demo { background: #faf5ff; color: #7c3aed; }
.badge-negotiation { background: #fff7ed; color: #c2410c; }
.badge-joined { background: #f0fdf4; color: #166534; }
.badge-lost { background: #fef2f2; color: #991b1b; }
.badge-not-interested { background: var(--gray-100); color: var(--gray-600); }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 200; display: none; align-items: flex-start; justify-content: center; padding: 3rem 1rem; overflow-y: auto; }
.modal-overlay.active { display: flex; animation: fadeIn .2s ease; }
.modal { background: var(--white); border-radius: var(--radius-xl); width: 600px; max-width: 95vw;
  box-shadow: 0 25px 50px rgba(0,0,0,.2); animation: slideUp .3s ease; }
.modal-lg { width: 800px; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; background: var(--gray-100); color: var(--gray-500); transition: var(--transition); }
.modal-close:hover { background: var(--gray-200); color: var(--gray-700); }
.modal-body { padding: 1.5rem; max-height: 65vh; overflow-y: auto; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* LEAD DETAIL */
.lead-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.detail-section { margin-bottom: 1.5rem; }
.detail-section h4 { font-size: .85rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.detail-item { display: flex; justify-content: space-between; padding: .4rem 0; font-size: .85rem; }
.detail-item .label { color: var(--text-secondary); }
.detail-item .value { font-weight: 500; text-align: right; }

/* FOLLOW-UP TIMELINE */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-item::before { content: ''; position: absolute; left: -1.5rem; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--white); box-shadow: var(--shadow-sm); z-index: 1; }
.timeline-item .time { font-size: .7rem; color: var(--text-secondary); font-weight: 500; }
.timeline-item .content { background: var(--gray-50); padding: .75rem 1rem; border-radius: var(--radius);
  margin-top: .25rem; font-size: .83rem; border: 1px solid var(--border); }
.timeline-item .author { font-weight: 600; color: var(--primary); font-size: .78rem; }

/* KANBAN */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; min-height: 500px; }
.kanban-column { min-width: 270px; flex: 1; background: var(--gray-100); border-radius: var(--radius-lg); padding: .75rem; }
.kanban-column-header { display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .75rem; margin-bottom: .75rem; }
.kanban-column-title { font-size: .8rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.kanban-count { background: var(--gray-300); color: var(--gray-700); padding: 1px 7px;
  border-radius: 10px; font-size: .68rem; font-weight: 600; }
.kanban-card { background: var(--white); border-radius: var(--radius); padding: .85rem;
  margin-bottom: .5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition); }
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card .name { font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.kanban-card .course { font-size: .75rem; color: var(--primary); font-weight: 500; }
.kanban-card .meta { display: flex; justify-content: space-between; margin-top: .5rem;
  font-size: .7rem; color: var(--text-secondary); }

/* REMINDERS */
.reminder-card { background: var(--card-bg); border-radius: var(--radius); padding: 1rem 1.25rem;
  border: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem;
  transition: var(--transition); }
.reminder-card:hover { box-shadow: var(--shadow-sm); }
.reminder-card.overdue { border-left: 3px solid var(--red-500); }
.reminder-card.today { border-left: 3px solid #f59e0b; }
.reminder-card.upcoming { border-left: 3px solid #3b82f6; }
.reminder-time { font-size: .75rem; color: var(--text-secondary); font-weight: 500; min-width: 80px; }
.reminder-info { flex: 1; }
.reminder-info .name { font-weight: 600; font-size: .85rem; }
.reminder-info .message { font-size: .8rem; color: var(--text-secondary); }

/* TOAST */
.toast-container { position: fixed; top: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast { padding: .85rem 1.25rem; border-radius: var(--radius); color: var(--white); font-size: .85rem;
  font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn .3s ease; min-width: 280px;
  display: flex; align-items: center; gap: .5rem; }
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }
.toast.info { background: #1e40af; }

/* PIPELINE MINI */
.pipeline-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: .5rem; }
.pipeline-segment { transition: width .5s ease; }

/* TABS */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab { padding: .65rem 1.25rem; font-size: .85rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: .3; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); }
.empty-state p { color: var(--text-secondary); font-size: .85rem; margin-top: .25rem; }

/* BATCH CARD */
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.batch-card { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.5rem;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: var(--transition); }
.batch-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.batch-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.batch-card .course-name { color: var(--primary); font-size: .82rem; font-weight: 600; }
.batch-card .batch-meta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; font-size: .78rem; color: var(--text-secondary); }
.batch-card .batch-meta span { display: flex; align-items: center; gap: .3rem; }
.batch-students { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); font-size: .8rem; }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }

/* TOGGLE SWITCH */
.view-toggle { display: flex; background: var(--gray-100); border-radius: var(--radius); padding: 3px; }
.view-toggle button { padding: .4rem .85rem; border-radius: var(--radius-sm); font-size: .8rem;
  font-weight: 500; color: var(--text-secondary); background: transparent; transition: var(--transition); }
.view-toggle button.active { background: var(--white); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* RESPONSIVE */
.mobile-toggle { display: none; background: none; font-size: 1.5rem; color: var(--text-primary); }
@media(max-width:1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .lead-detail-grid { grid-template-columns: 1fr; }
}
@media(max-width:768px) {
  .mobile-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-header { padding: 1rem; }
  .page-body { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .kanban-board { flex-direction: column; }
  .kanban-column { min-width: 100%; }
}
@media(max-width:480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table-filters { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
}
