/* ─── RESET & BASE ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; background: #0a0e1a; color: #e2e8f0; font-size: 14px; }
a { color: inherit; text-decoration: none; }
:root {
  --gold: #46508c; --navy: #0a0e1a; --navy-light: #111827;
  --card: #161d2e; --border: rgba(255,255,255,0.08);
  --green: #25d366; --text-muted: #64748b; --radius: 12px;
  --sidebar-w: 240px;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
body { display: flex; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; height: 100vh;
  background: #0d1322; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
  position: fixed; left: 0; top: 0; z-index: 100;
  transition: transform 0.3s;
}
.main-wrapper {
  margin-left: var(--sidebar-w); flex: 1; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column;
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px; font-size: 1rem; font-weight: 700; color: #fff;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo span:first-child { font-size: 1.4rem; }
.sidebar-nav { display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-muted);
  transition: all 0.2s; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(70,80,140,0.12); color: var(--gold); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.monthly-target { }
.target-header { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.target-bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; margin-bottom: 6px; }
.target-fill { height: 100%; background: linear-gradient(90deg, var(--gold), #323264); border-radius: 3px; transition: width 0.5s ease; }
.target-pct { font-size: 0.72rem; color: var(--text-muted); }

/* ─── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: rgba(13,19,34,0.95); position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
.page-title { font-size: 1.1rem; font-weight: 700; color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.month-badge {
  background: rgba(70,80,140,0.12); color: var(--gold);
  border: 1px solid rgba(70,80,140,0.25);
  padding: 4px 12px; border-radius: 50px; font-size: 0.78rem; font-weight: 600;
}
.btn-export, .btn-add {
  padding: 7px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s;
}
.btn-export { background: rgba(255,255,255,0.07); color: var(--text-muted); border: 1px solid var(--border); }
.btn-export:hover { background: rgba(255,255,255,0.12); color: #fff; }
.btn-add { background: var(--gold); color: #0a0e1a; }
.btn-add:hover { background: #323264; }

/* ─── VIEWS ──────────────────────────────────────────────── */
.view { display: none; padding: 28px; flex: 1; }
.view.active { display: block; }

/* ─── DASHBOARD STATS ────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.stat-card .sc-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }
.stat-card .sc-value { font-size: 1.8rem; font-weight: 800; color: #fff; line-height: 1; }
.stat-card .sc-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.gold-border { border-color: rgba(70,80,140,0.3); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.dash-card.wide { grid-column: 1 / -1; }
.dash-card h3 { font-size: 0.9rem; font-weight: 700; color: #fff; margin-bottom: 16px; }

.pipeline-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pipeline-bar-label { font-size: 0.78rem; color: var(--text-muted); width: 160px; flex-shrink: 0; }
.pipeline-bar-track { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; }
.pipeline-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold), #323264); }
.pipeline-bar-count { font-size: 0.78rem; font-weight: 600; color: var(--gold); width: 24px; text-align: right; }

.recent-lead-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.recent-lead-row:last-child { border-bottom: none; }
.rla-name { font-size: 0.85rem; font-weight: 600; color: #fff; }
.rla-sub { font-size: 0.75rem; color: var(--text-muted); }
.stage-badge { font-size: 0.7rem; font-weight: 600; padding: 3px 8px; border-radius: 50px; white-space: nowrap; }

/* ─── PIPELINE BOARD ─────────────────────────────────────── */
.pipeline-board {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start;
  min-height: calc(100vh - 140px);
}
.pipeline-col {
  flex-shrink: 0; width: 230px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.pipeline-col-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.pipeline-col-title { font-size: 0.82rem; font-weight: 700; color: #fff; }
.pipeline-col-count {
  background: rgba(255,255,255,0.08); color: var(--text-muted);
  font-size: 0.72rem; font-weight: 600; padding: 2px 7px; border-radius: 50px;
}
.pipeline-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 100px; }
.pipeline-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  cursor: pointer; transition: all 0.2s;
}
.pipeline-card:hover { border-color: rgba(70,80,140,0.3); transform: translateY(-1px); }
.pc-name { font-size: 0.85rem; font-weight: 600; color: #fff; margin-bottom: 4px; }
.pc-program { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 8px; }
.pc-actions { display: flex; gap: 6px; }
.pc-btn { font-size: 0.65rem; padding: 3px 7px; border-radius: 4px; border: none; cursor: pointer; font-weight: 600; transition: opacity 0.2s; }
.pc-btn:hover { opacity: 0.8; }
.pc-wa { background: rgba(37,211,102,0.15); color: var(--green); }
.pc-advance { background: rgba(70,80,140,0.15); color: var(--gold); }
.pc-view { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ─── STUDENTS TABLE ─────────────────────────────────────── */
.students-toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.search-input, .filter-select {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 14px; color: #e2e8f0;
  font-family: inherit; font-size: 0.85rem; outline: none;
}
.search-input { flex: 1; }
.search-input:focus, .filter-select:focus { border-color: rgba(70,80,140,0.4); }
.filter-select option { background: var(--card); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.students-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.students-table th {
  background: rgba(255,255,255,0.04); color: var(--text-muted);
  font-weight: 600; text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.students-table td {
  padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-muted);
}
.students-table tbody tr { transition: background 0.15s; }
.students-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.students-table tbody tr:last-child td { border-bottom: none; }
.td-name { font-weight: 600; color: #fff; }
.tbl-btn {
  background: rgba(255,255,255,0.06); border: none; border-radius: 5px;
  padding: 4px 8px; color: var(--text-muted); font-size: 0.72rem; cursor: pointer;
  transition: all 0.2s; margin-right: 4px; font-family: inherit;
}
.tbl-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.tbl-btn.wa { background: rgba(37,211,102,0.12); color: var(--green); }
.tbl-btn.del { background: rgba(239,68,68,0.12); color: #f87171; }

/* ─── FORM CARD ──────────────────────────────────────────── */
.form-card {
  max-width: 860px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
}
.form-card h2 { font-size: 1.1rem; font-weight: 700; color: #fff; margin-bottom: 24px; }
.form-section { margin-bottom: 28px; }
.form-section h4 {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--gold); margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fg { display: flex; flex-direction: column; gap: 6px; }
.fg.span2 { grid-column: 1 / -1; }
.fg label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.fg input, .fg select, .fg textarea {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; color: #e2e8f0;
  font-family: inherit; font-size: 0.85rem; outline: none;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: rgba(70,80,140,0.4); }
.fg select option { background: var(--card); }
.readonly-input { background: rgba(70,80,140,0.05) !important; color: var(--gold) !important; font-weight: 700; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.btn-primary { background: var(--gold); color: #0a0e1a; font-weight: 700; padding: 10px 24px; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-family: inherit; font-size: 0.85rem; }
.btn-primary:hover { background: #323264; }
.btn-ghost { background: rgba(255,255,255,0.07); color: var(--text-muted); font-weight: 600; padding: 10px 20px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 0.85rem; }
.btn-ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ─── SCHOOLS ────────────────────────────────────────────── */
.schools-header { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.comm-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 24px; }

/* ─── WA TEMPLATES ───────────────────────────────────────── */
.templates-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; }
.template-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.template-card h4 { font-size: 0.85rem; font-weight: 700; color: var(--gold); margin-bottom: 6px; }
.template-tag { font-size: 0.7rem; background: rgba(70,80,140,0.1); color: var(--gold); border: 1px solid rgba(70,80,140,0.2); padding: 2px 8px; border-radius: 50px; margin-bottom: 12px; display: inline-block; }
.template-text {
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.65;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font-family: inherit;
  white-space: pre-wrap; margin-bottom: 12px;
}
.copy-btn {
  background: rgba(37,211,102,0.12); color: var(--green); border: none;
  padding: 6px 14px; border-radius: 6px; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.copy-btn:hover { background: rgba(37,211,102,0.22); }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 500;
  backdrop-filter: blur(4px); align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; max-width: 680px; width: 90%; max-height: 85vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--text-muted); font-size: 1.2rem; cursor: pointer;
}
.modal-close:hover { color: #fff; }
.modal-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.detail-row { background: rgba(255,255,255,0.03); border-radius: 8px; padding: 10px 12px; }
.detail-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 3px; }
.detail-value { font-size: 0.85rem; color: #fff; font-weight: 500; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.log-entry { font-size: 0.78rem; color: var(--text-muted); padding: 6px 0; border-bottom: 1px solid var(--border); }
.log-date { color: var(--gold); font-weight: 600; }

/* ─── STAGE COLORS ───────────────────────────────────────── */
.stage-New\ Lead { background: rgba(100,116,139,0.15); color: #94a3b8; }
.stage-Consultation\ Booked { background: rgba(59,130,246,0.15); color: #60a5fa; }
.stage-Documents\ Submitted { background: rgba(245,158,11,0.15); color: #fbbf24; }
.stage-Applied\ to\ School { background: rgba(168,85,247,0.15); color: #c084fc; }
.stage-Accepted { background: rgba(16,185,129,0.15); color: #34d399; }
.stage-Enrolled { background: rgba(70,80,140,0.15); color: var(--gold); }
.stage-Commission\ Paid { background: rgba(37,211,102,0.15); color: var(--green); }

/* ─── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1e293b; border: 1px solid var(--border); color: #e2e8f0;
  padding: 12px 24px; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
  z-index: 9999; transition: transform 0.3s, opacity 0.3s; opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stat-cards { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .fg.span2 { grid-column: 1; }
  .templates-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .comm-summary { grid-template-columns: 1fr; }
}
