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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --blue:    #3B82F6; --blue-l:   #EFF6FF;
  --teal:    #0D9488; --teal-l:   #F0FDFA;
  --amber:   #F59E0B; --amber-l:  #FFFBEB;
  --red:     #EF4444; --red-l:    #FEF2F2;
  --violet:  #7C3AED; --violet-l: #F5F3FF;
  --green:   #10B981; --green-l:  #ECFDF5;
  --orange:  #F97316; --orange-l: #FFF7ED;
  --text:    #0F172A; --muted:    #64748B;
  --border:  #E2E8F0; --bg:       #F8FAFF;
  --card:    #FFFFFF;
}

body { font-family: 'Nunito', sans-serif; background: var(--bg); color: var(--text); }
h1,h2,h3,h4,.font-sora { font-family: 'Sora', sans-serif; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
input,select,textarea,button { font-family: 'Nunito', sans-serif; }

/* ── Layout ─────────────────────────────────────────────── */
.app-shell     { display: flex; min-height: 100vh; background: var(--bg); }
.main-area     { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page-content  { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 224px; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh;
  position: sticky; top: 0; flex-shrink: 0; z-index: 100;
}
.sidebar-logo  { margin:auto;: 0px 18px 0px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.logo-icon     { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,#3B82F6,#0D9488); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.logo-text     .name  { font-family: 'Sora',sans-serif; font-size: 14px; font-weight: 800; color: var(--text); line-height: 1; }
.logo-text     .sub   { font-size: 11px; color: var(--muted); font-weight: 600; }
.sidebar-inst  { margin: 13px 10px; padding: 10px 12px; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); }
.sidebar-inst  .inst-label { font-size: 11px; font-weight: 700; color: var(--muted); }
.sidebar-inst  .inst-name  { font-size: 13px; font-weight: 800; color: var(--text); margin-top: 1px; }
.sidebar-nav   { flex: 1; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  width: 100%; text-align: left; padding: 11px 13px; border-radius: 10px;
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s; display: flex; align-items: center; gap: 9px;
  text-decoration: none;
}
.nav-btn:hover  { background: var(--bg); color: var(--text); }
.nav-btn.active { background: var(--blue-l); color: var(--blue); font-weight: 800; }
.nav-icon { font-size: 15px; }
.sidebar-user  { padding: 13px 15px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.user-av  { width: 33px; height: 33px; border-radius: 50%; background: linear-gradient(135deg,#3B82F6,#7C3AED); display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Sora',sans-serif; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 700; color: var(--text); }
.user-role { font-size: 11px; color: var(--muted); }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 15px 26px; display: flex; justify-content: space-between;
  align-items: center; flex-shrink: 0;
}
.topbar-title  { font-family: 'Sora',sans-serif; font-size: 20px; font-weight: 800; color: var(--text); }
.topbar-date   { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-right  { display: flex; align-items: center; gap: 11px; }
.search-box    { background: var(--bg); border-radius: 10px; padding: 9px 14px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); }
.search-box input { border: none; background: transparent; font-size: 13px; color: var(--text); width: 150px; outline: none; }
.notif-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.btn-add-lead { padding: 9px 16px; border-radius: 10px; border: none; background: linear-gradient(135deg,#3B82F6,#0D9488); color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; box-shadow: 0 4px 12px rgba(59,130,246,.44); white-space: nowrap; }

/* ── Cards & KPI ────────────────────────────────────────── */
.card  { background: var(--card); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 1px 6px rgba(15,23,42,.05); }
.card-lg { border-radius: 20px; box-shadow: 0 1px 8px rgba(15,23,42,.06); }
.kpi-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.kpi {
  background: var(--card); border-radius: 16px; padding: 20px;
  border: 1px solid var(--border); flex: 1; min-width: 160px;
  box-shadow: 0 1px 6px rgba(15,23,42,.05);
}
.kpi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.kpi-label  { font-size: 12px; font-weight: 700; color: var(--muted); }
.kpi-icon   { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.kpi-value  { font-family: 'Sora',sans-serif; font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 8px; }
.kpi-footer { display: flex; gap: 5px; align-items: center; }
.kpi-delta  { font-size: 12px; font-weight: 700; }
.kpi-sub    { font-size: 12px; color: var(--muted); }
.delta-up   { color: var(--green); }
.delta-down { color: var(--red); }

/* ── Avatars ─────────────────────────────────────────────── */
.av { border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Sora',sans-serif; font-weight: 800; flex-shrink: 0; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pipeline-new      { background: #EFF6FF; color: #3B82F6; }
.pipeline-contacted{ background: #F0FDFA; color: #0D9488; }
.pipeline-demo-sched{ background: #F5F3FF; color: #7C3AED; }
.pipeline-demo-done { background: #FFFBEB; color: #F59E0B; }
.pipeline-proposal  { background: #FFF7ED; color: #F97316; }
.pipeline-enrolled  { background: #ECFDF5; color: #10B981; }
.pipeline-lost      { background: #FEF2F2; color: #EF4444; }

.role-admin     { background: #F5F3FF; color: #7C3AED; }
.role-manager   { background: #EFF6FF; color: #3B82F6; }
.role-counsellor{ background: #F0FDFA; color: #0D9488; }

/* ── Tables ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: #F8FAFF; }
.table-wrap  { overflow-x: auto; }
.thead-row   { background: #F8FAFF; border-bottom: 2px solid var(--border); }

/* ── Score bar ───────────────────────────────────────────── */
.score-bar-wrap { display: flex; align-items: center; gap: 5px; }
.score-bar { height: 5px; background: #F1F5F9; border-radius: 3px; overflow: hidden; }
.score-bar .fill { height: 100%; border-radius: 3px; }
.score-high { background: var(--green); }
.score-mid  { background: var(--amber); }
.score-low  { background: var(--red); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { padding: 10px 20px; border-radius: 10px; border: none; font-weight: 700; font-size: 13px; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-outline   { background: #fff; border: 1.5px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-success   { background: var(--green-l); color: var(--green); }
.btn-danger    { background: var(--red-l); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 8px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--border); font-size: 13px;
  color: var(--text); background: #fff; outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); }
.form-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; display: block; margin-bottom: 5px; }
.form-group { display: flex; flex-direction: column; gap: 0; }

/* ── Filters bar ─────────────────────────────────────────── */
.filters { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filter-select { padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border); font-size: 13px; color: var(--muted); background: #fff; cursor: pointer; }

/* ── Lead Detail Panel ───────────────────────────────────── */
.detail-panel {
  position: fixed; top: 0; right: 0; width: 350px; height: 100vh;
  background: #fff; box-shadow: -4px 0 32px rgba(15,23,42,.12);
  z-index: 300; display: flex; flex-direction: column;
  border-left: 1px solid var(--border); transform: translateX(100%);
  transition: transform .25s ease;
}
.detail-panel.open { transform: translateX(0); }
.panel-header { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg); }
.panel-close  { border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.panel-body   { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.panel-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.detail-field-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 3px; }
.detail-field-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Pipeline Kanban ─────────────────────────────────────── */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col   { min-width: 234px; flex: 0 0 234px; }
.kanban-head  { border-radius: 12px 12px 0 0; padding: 11px 14px; display: flex; justify-content: space-between; align-items: center; }
.kanban-body  { display: flex; flex-direction: column; gap: 9px; padding: 9px; background: #F8FAFF; border-radius: 0 0 12px 12px; border: 1px solid var(--border); border-top: none; min-height: 280px; }
.kanban-card  { background: #fff; border-radius: 11px; padding: 12px 13px; border: 1px solid var(--border); cursor: grab; box-shadow: 0 1px 4px rgba(15,23,42,.05); transition: box-shadow .15s; }
.kanban-card:hover { box-shadow: 0 4px 14px rgba(15,23,42,.1); }
.kanban-more  { text-align: center; padding: 7px 0; font-size: 12px; font-weight: 700; color: var(--blue); cursor: pointer; }

/* ── Heatmap ─────────────────────────────────────────────── */
.heatmap-grid { display: grid; gap: 4px; }
.heatmap-cell { height: 34px; border-radius: 6px; cursor: pointer; transition: transform .15s; }
.heatmap-cell:hover { transform: scale(1.18); }

/* ── Funnel bars ─────────────────────────────────────────── */
.funnel-item { margin-bottom: 9px; }
.funnel-label { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.funnel-bar-wrap { height: 24px; background: #F1F5F9; border-radius: 6px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 6px; transition: width .4s ease; }

/* ── Sequence cards ──────────────────────────────────────── */
.seq-card { background: var(--card); border-radius: 16px; padding: 20px; border: 1px solid var(--border); box-shadow: 0 1px 6px rgba(15,23,42,.05); }
.seq-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 4px; margin-left: 8px; flex-shrink: 0; }

/* ── Flow steps ──────────────────────────────────────────── */
.flow-steps { display: flex; gap: 0; overflow-x: auto; padding-bottom: 8px; }
.flow-step  { width: 150px; background: #F8FAFF; border: 1.5px solid rgba(59,130,246,.2); border-radius: 12px; padding: 12px 14px; text-align: center; flex-shrink: 0; }
.flow-arrow { width: 20px; height: 2px; background: rgba(59,130,246,.27); flex-shrink: 0; align-self: center; }

/* ── Integration cards ───────────────────────────────────── */
.intg-card  { background: var(--card); border-radius: 18px; border: 1.5px solid var(--border); overflow: hidden; box-shadow: 0 1px 6px rgba(15,23,42,.05); transition: all .2s; }
.intg-card.active { box-shadow: 0 4px 20px rgba(59,130,246,.14); }
.intg-head  { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.intg-icon  { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.intg-body  { padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.intg-endpoint { background: #F8FAFF; border-radius: 8px; padding: 8px 12px; font-family: monospace; font-size: 11px; color: var(--blue); border: 1px solid var(--border); word-break: break-all; }
.intg-snippet  { background: #0F172A; color: #93C5FD; padding: 12px 14px; border-radius: 10px; font-size: 11px; font-family: monospace; overflow-x: auto; line-height: 1.6; white-space: pre-wrap; }

/* ── Status dot ──────────────────────────────────────────── */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-active   { background: var(--green); }
.status-inactive { background: var(--red); }
.status-connected { background: var(--green); }
.status-pending   { background: var(--amber); }
.status-not-connected { background: var(--red); }

/* ── Leaderboard ─────────────────────────────────────────── */
.lb-row { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; }
.lb-rank { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: 'Sora',sans-serif; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; }

/* ── Activity feed ───────────────────────────────────────── */
.activity-item { display: flex; gap: 11px; padding-bottom: 13px; position: relative; }
.activity-item:not(:last-child)::before { content: ''; position: absolute; left: 16px; top: 34px; width: 2px; height: calc(100% - 18px); background: var(--border); }
.activity-icon { width: 33px; height: 33px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }

/* ── Permissions matrix ──────────────────────────────────── */
.perm-table th, .perm-table td { padding: 10px 13px; }
.perm-row-even { background: #FAFBFF; }

/* ── Toggle switch ───────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { width: 44px; height: 24px; border-radius: 12px; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.toggle-knob { width: 18px; height: 18px; border-radius: 50%; background: #fff; position: absolute; top: 3px; transition: left .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.toggle.on  { background: var(--green); }
.toggle.off { background: #CBD5E1; }
.toggle.on  .toggle-knob { left: 22px; }
.toggle.off .toggle-knob { left: 3px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(3px); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 22px; width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 80px rgba(15,23,42,.2); }
.modal-head { padding: 22px 26px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg); }
.modal-body { flex: 1; overflow-y: auto; padding: 22px 26px; }
.modal-foot { padding: 15px 26px; border-top: 1px solid var(--border); display: flex; gap: 9px; background: #fff; }
.modal-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 26px; }
.modal-tab  { padding: 12px 16px; border: none; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.modal-tab.active { font-weight: 800; color: var(--blue); border-bottom-color: var(--blue); }

/* ── Chart containers ────────────────────────────────────── */
.chart-container { position: relative; }

/* ── Util ────────────────────────────────────────────────── */
.flex    { display: flex; }
.flex-1  { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.overflow-x { overflow-x: auto; }
.text-sm   { font-size: 12px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--muted); }
.text-blue  { color: var(--blue); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-teal  { color: var(--teal); }
.text-amber { color: var(--amber); }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.p-0   { padding: 0; }
.p-20  { padding: 20px; }
.p-24  { padding: 24px; }
.border-bottom { border-bottom: 1px solid var(--border); }
.rounded-full { border-radius: 9999px; }
.view-toggle { display: flex; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.view-btn { padding: 10px 13px; border: none; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; transition: all .15s; }
.view-btn.active { background: var(--blue); color: #fff; }
.code-block { font-family: monospace; font-size: 13px; color: var(--blue); background: #fff; padding: 4px 10px; border-radius: 6px; display: inline-block; border: 1px solid var(--border); }
.section-title { font-family: 'Sora',sans-serif; font-size: 22px; font-weight: 700; color: var(--text); }
.section-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .logo-text, .sidebar .nav-btn span:not(.nav-icon),
  .sidebar .sidebar-inst, .sidebar .user-name, .sidebar .user-role { display: none; }
  .sidebar .nav-btn { justify-content: center; }
  .sidebar-user { justify-content: center; }
}
