/* ============================================================
   SalesCRM — style.css
   Clean, professional, mobile-responsive design
   ============================================================ */

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #e0e7ff;
  --green:         #10b981;
  --green-light:   #d1fae5;
  --red:           #ef4444;
  --red-light:     #fee2e2;
  --yellow:        #f59e0b;
  --yellow-light:  #fef3c7;
  --blue:          #3b82f6;
  --blue-light:    #dbeafe;
  --orange:        #f97316;
  --orange-light:  #ffedd5;
  --purple:        #8b5cf6;
  --purple-light:  #ede9fe;
  --teal:          #06b6d4;
  --teal-light:    #cffafe;
  --gray:          #6b7280;
  --gray-light:    #f3f4f6;

  --sidebar-w:     240px;
  --topbar-h:      60px;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --bg:            #f8fafc;
  --white:         #ffffff;
  --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     14px;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ─── Layout ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #1e293b;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform .3s ease;
}
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.page-content { padding: 24px; flex: 1; max-width: 1400px; }

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-mark { font-size: 28px; }
.logo-name { color: #fff; font-size: 16px; font-weight: 700; }
.logo-sub  { color: #94a3b8; font-size: 11px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #94a3b8; font-size: 13.5px; font-weight: 500;
  transition: all .15s; cursor: pointer; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-section { color: #475569; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 16px 12px 4px; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-card { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.user-name { color: #e2e8f0; font-size: 13px; font-weight: 600; }
.user-role { color: #64748b; font-size: 11px; }
.logout-btn { color: #64748b; font-size: 18px; margin-left: auto; padding: 4px; transition: color .15s; }
.logout-btn:hover { color: var(--red); text-decoration: none; }

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.hamburger { display: none; background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; text-transform: capitalize; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.badge-alert { background: var(--yellow-light); color: var(--yellow); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: default; }

/* Notification button */
.notif-btn { position: relative; font-size: 20px; cursor: pointer; user-select: none; }
.notif-badge {
  position: absolute; top: -5px; right: -6px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.notif-dropdown {
  position: fixed; top: var(--topbar-h); right: 16px;
  width: 320px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden;
}
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.notif-header button { font-size: 11px; color: var(--primary); background: none; border: none; cursor: pointer; }
.notif-loading { padding: 20px; text-align: center; color: var(--text-muted); }
.notif-item { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.notif-item.unread { background: var(--blue-light); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Page Header ────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.date-badge { background: var(--primary-light); color: var(--primary-dark); padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 0; }
.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 20px; display: flex; align-items: flex-start; gap: 14px;
  box-shadow: var(--shadow); border-top: 3px solid transparent;
}
.stat-card.blue   { border-top-color: var(--blue);   }
.stat-card.green  { border-top-color: var(--green);  }
.stat-card.red    { border-top-color: var(--red);    }
.stat-card.yellow { border-top-color: var(--yellow); }
.stat-card.orange { border-top-color: var(--orange); }
.stat-card.purple { border-top-color: var(--purple); }
.stat-card.teal   { border-top-color: var(--teal);   }
.stat-icon { font-size: 28px; }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ─── Cards ─────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 15px; font-weight: 700; }
.mt-20 { margin-top: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.p-10 { padding: 10px 20px; }
.p-16 { padding: 16px 20px; }
.p-0 { padding: 0; }

/* ─── Progress Bars ─────────────────────────────────────── */
.progress-bar-wrap { background: #e2e8f0; border-radius: 4px; height: 6px; overflow: hidden; width: 100%; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .4s ease; }
.progress-bar.green  { background: var(--green);  }
.progress-bar.yellow { background: var(--yellow); }
.progress-bar.red    { background: var(--red);    }
.progress-bar.blue   { background: var(--blue);   }
.mt-8 { margin-top: 8px; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-green  { background: var(--green-light);  color: #065f46; }
.badge-red    { background: var(--red-light);    color: #991b1b; }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-blue   { background: var(--blue-light);   color: #1e40af; }
.badge-orange { background: var(--orange-light); color: #9a3412; }
.badge-purple { background: var(--purple-light); color: #5b21b6; }
.badge-gray   { background: var(--gray-light);   color: #374151; }
.ml-4 { margin-left: 4px; }

/* Type & Priority badges */
.badge-type { background: #f1f5f9; color: #475569; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.priority-badge-urgent { background: var(--red-light);    color: #991b1b; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.priority-badge-high   { background: var(--orange-light); color: #9a3412; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.priority-badge-medium { background: var(--blue-light);   color: #1e40af; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.priority-badge-low    { background: var(--gray-light);   color: #374151; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.recur-badge { background: var(--teal-light); color: #0e7490; padding: 2px 8px; border-radius: 4px; font-size: 10px; margin-left: 6px; }
.overdue-label { background: var(--red); color: #fff; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; margin-left: 6px; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--gray-light); text-decoration: none; }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-green:hover { opacity: .9; }
.btn-red { background: var(--red-light); color: var(--red); border-color: var(--red-light); }
.btn-red:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-group { display: flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); background: var(--white); transition: border .15s;
  width: 100%;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-row .flex-2 { flex: 2; }
.quick-form { padding: 16px 20px; }
.quick-form .form-row { margin-bottom: 12px; }
.quick-form .form-group { margin-bottom: 12px; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: #f8fafc; padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.data-table .row-overdue td { background: #fff5f5; }
.data-table .row-gold td { background: #fffbeb; }
.empty-row { text-align: center; color: var(--text-muted); padding: 32px; }
.sub-text { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.task-title-cell { max-width: 250px; }
.task-title-cell strong { display: block; }

/* ─── Agents / Leads Mini List ───────────────────────────── */
.agent-name { display: flex; align-items: center; gap: 8px; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.mini-progress { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.mini-progress span { font-size: 12px; }

.lead-mini-list li { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid #f1f5f9; }
.lead-mini-list li:last-child { border-bottom: none; }
.lead-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lead-info { flex: 1; }
.lead-name { font-size: 13px; font-weight: 600; }
.lead-stage { font-size: 11px; color: var(--text-muted); }

/* ─── Task List ──────────────────────────────────────────── */
.task-list { }
.task-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f1f5f9; }
.task-item:last-child { border-bottom: none; }
.task-item.priority-urgent { border-left: 3px solid var(--red); }
.task-item.priority-high   { border-left: 3px solid var(--orange); }
.task-item.priority-medium { border-left: 3px solid var(--blue); }
.task-item.priority-low    { border-left: 3px solid #94a3b8; }
.task-check input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; margin-top: 2px; }
.task-body { flex: 1; }
.task-title { font-size: 13px; font-weight: 600; }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* ─── Activity Timeline ──────────────────────────────────── */
.activity-timeline { padding: 8px 20px; }
.timeline-date-divider { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 0 4px; }
.timeline-item { display: flex; gap: 12px; padding: 8px 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.timeline-content { flex: 1; font-size: 13px; }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.timeline-user { font-weight: 700; }

/* ─── Kanban Board ───────────────────────────────────────── */
.kanban-board {
  display: flex; gap: 16px; overflow-x: auto;
  padding-bottom: 16px; -webkit-overflow-scrolling: touch;
}
.kanban-col { min-width: 240px; width: 240px; flex-shrink: 0; }
.kanban-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--white); border-radius: var(--radius-sm) var(--radius-sm) 0 0; border: 1px solid var(--border); border-bottom: none; }
.kh-title { font-size: 13px; font-weight: 700; }
.kh-count { background: var(--gray-light); color: var(--text-muted); width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.kanban-cards { min-height: 200px; padding: 8px; background: #f8fafc; border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: var(--white); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .15s, transform .15s; border: 1px solid var(--border); }
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kc-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.kc-company { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.kc-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.kc-value { font-weight: 700; color: var(--green); }
.kc-agent { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* Pipeline stats row */
.pipeline-stats { display: flex; gap: 12px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 4px; }
.ps-card { min-width: 150px; flex-shrink: 0; background: var(--white); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.ps-name { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.ps-count { font-size: 18px; font-weight: 800; }
.ps-value { font-size: 11px; color: var(--green); margin-top: 2px; font-weight: 600; }

/* ─── Targets ────────────────────────────────────────────── */
.targets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding: 16px 20px; }
.target-card { border-radius: var(--radius); padding: 16px; background: #fafafa; border: 1px solid var(--border); }
.target-card.status-green  { border-left: 4px solid var(--green);  }
.target-card.status-yellow { border-left: 4px solid var(--yellow); }
.target-card.status-red    { border-left: 4px solid var(--red);    }
.tc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tc-name { font-weight: 700; font-size: 14px; }
.tc-overall { font-size: 24px; font-weight: 800; }
.clr-green  { color: var(--green);  }
.clr-yellow { color: var(--yellow); }
.clr-red    { color: var(--red);    }
.tc-actions { margin-top: 12px; }
.target-progress { margin-bottom: 10px; }
.tp-header { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--text-muted); }

/* ─── Monthly Grid ───────────────────────────────────────── */
.monthly-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px 20px; }
.monthly-item { }
.monthly-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.monthly-value { font-size: 16px; font-weight: 700; margin-bottom: 6px; }

/* ─── Outcome Grid ───────────────────────────────────────── */
.outcome-grid { padding: 16px 20px; }
.outcome-item { margin-bottom: 14px; }
.oi-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }

/* ─── Call Log List ──────────────────────────────────────── */
.call-log-list { }
.call-log-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f1f5f9; }
.call-log-item:last-child { border-bottom: none; }
.cl-icon { font-size: 20px; }
.cl-body { flex: 1; }
.cl-agent { font-size: 12px; font-weight: 700; color: var(--primary); }
.cl-lead { font-size: 13px; font-weight: 600; }
.cl-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.cl-duration { font-size: 11px; color: var(--text-muted); }
.cl-notes { font-size: 11px; color: var(--text-muted); }
.cl-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; padding: 16px 20px; flex-wrap: wrap; }
.page-btn { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-muted); transition: all .15s; }
.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Filter Bar ─────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-form select, .filter-form input[type=date] { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--white); color: var(--text); }
.task-counts { display: flex; gap: 8px; }
.period-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: var(--red-light);   color: #991b1b; border: 1px solid #fca5a5; }

/* ─── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 300; display: flex;
  align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
  max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-box.modal-lg { max-width: 680px; }
@keyframes modalIn { from { opacity:0; transform:scale(.96) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 2px 6px; border-radius: 4px; transition: background .15s; }
.modal-close:hover { background: var(--gray-light); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }

/* ─── EOD Popup ──────────────────────────────────────────── */
#eodContent { font-size: 13px; }
.eod-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.eod-item:last-child { border-bottom: none; }

/* ─── Toast ──────────────────────────────────────────────── */
#toastContainer { position: fixed; bottom: 20px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ─── Sidebar overlay (mobile) ───────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }

/* ─── Misc helpers ───────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .monthly-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.4); }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .hamburger { display: block; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-user { display: none; }
  .filter-form { flex-direction: column; align-items: stretch; width: 100%; }
  .filter-form select, .filter-form input { width: 100%; }
  .form-row { flex-direction: column; }
  .targets-grid { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; overflow-x: hidden; }
  .kanban-col { width: 100%; min-width: unset; }
  .notif-dropdown { right: 8px; left: 8px; width: auto; }
  .modal-box { max-width: 100%; margin: 0; }
  .pipeline-stats { flex-direction: column; }
  .ps-card { min-width: unset; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .monthly-grid { grid-template-columns: 1fr; }
}

/* ── Click-to-Call Button ───────────────────────────────────── */
.btn-call {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff !important;
  border: none;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
  display: inline-block;
  transition: opacity .2s;
}
.btn-call:hover { opacity: .85; }
.btn-xs { font-size: 12px; padding: 4px 10px; }

/* ── Smart Call Queue ────────────────────────────────────────── */
.call-queue-list { list-style:none; padding:0; margin:0; }
.cq-item {
  display:flex; align-items:center; gap:10px;
  padding:12px 16px; border-bottom:1px solid #f1f5f9;
  transition: background .15s;
}
.cq-item:hover { background:#f8fafc; }
.cq-item:last-child { border-bottom:none; }
.cq-top { background:linear-gradient(90deg,#fff7ed,#fff); border-left:3px solid #ea580c; }
.cq-rank {
  width:22px; height:22px; border-radius:50%;
  background:#f1f5f9; color:#64748b;
  font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.cq-top .cq-rank { background:#ea580c; color:#fff; }
.cq-body { flex:1; min-width:0; }
.cq-name { font-size:14px; font-weight:600; color:#1e293b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cq-meta { font-size:11px; color:#64748b; margin-top:2px; display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.cq-dot { color:#cbd5e1; }
.cq-score {
  font-size:12px; font-weight:700; padding:3px 8px;
  border-radius:20px; flex-shrink:0;
}
.badge-urgent {
  background:#fef2f2; color:#dc2626; border:1px solid #fecaca;
  font-size:10px; padding:1px 6px; border-radius:10px;
  font-weight:600; margin-left:4px;
}

/* ── Idle Alert Popup ─────────────────────────────────────────── */
.idle-alert-bar {
  position:fixed; top:70px; left:50%; transform:translateX(-50%);
  background:linear-gradient(135deg,#dc2626,#b91c1c);
  color:#fff; padding:12px 24px; border-radius:12px;
  box-shadow:0 8px 30px rgba(220,38,38,.4);
  z-index:9999; display:flex; align-items:center; gap:12px;
  font-size:14px; font-weight:600; animation:slideDown .3s ease;
  max-width:90vw;
}
.idle-alert-bar button {
  background:rgba(255,255,255,.2); border:1px solid rgba(255,255,255,.4);
  color:#fff; padding:5px 14px; border-radius:8px; cursor:pointer;
  font-size:13px; font-weight:600;
}
.idle-alert-bar button:hover { background:rgba(255,255,255,.35); }
@keyframes slideDown { from{opacity:0;top:50px} to{opacity:1;top:70px} }

/* ── Heat Score Badge (on lead cards) ────────────────────────── */
.heat-badge {
  display:inline-block; font-size:10px; font-weight:700;
  padding:2px 7px; border-radius:10px; margin-top:4px;
}

/* ── Manager Alert Panel ─────────────────────────────────────── */
.alert-list { padding:8px 0; min-height:80px; }
.alert-loading { padding:20px 16px; color:#94a3b8; font-size:14px; text-align:center; }
.alert-empty { padding:20px 16px; color:#16a34a; font-size:14px; text-align:center; }
.alert-item {
  display:flex; align-items:flex-start; gap:10px;
  padding:12px 16px; border-left:4px solid transparent;
  border-bottom:1px solid #f1f5f9; transition:background .15s;
}
.alert-item:last-child { border-bottom:none; }
.alert-item:hover { background:#f8fafc; }
.alert-critical { border-left-color:#dc2626; background:#fff5f5; }
.alert-warning  { border-left-color:#f59e0b; background:#fffbeb; }
.alert-info     { border-left-color:#3b82f6; background:#eff6ff; }
.alert-success  { border-left-color:#16a34a; background:#f0fdf4; }
.alert-icon { font-size:18px; flex-shrink:0; margin-top:1px; }
.alert-body { flex:1; min-width:0; }
.alert-title { font-size:13px; font-weight:700; color:#1e293b; line-height:1.4; }
.alert-detail { font-size:12px; color:#64748b; margin-top:2px; line-height:1.4; }
.alert-badge {
  background:#dc2626; color:#fff; font-size:11px; font-weight:700;
  padding:2px 7px; border-radius:20px; margin-left:8px;
}

/* ── EOD Summary ────────────────────────────────────────────── */
.eod-list { padding:0; }
.eod-totals {
  display:grid; grid-template-columns:repeat(4,1fr);
  gap:1px; background:#f1f5f9; border-bottom:1px solid #f1f5f9;
}
.eod-stat {
  background:#fff; padding:14px 8px; text-align:center;
}
.eod-num { display:block; font-size:20px; font-weight:800; color:#1e293b; }
.eod-lbl { display:block; font-size:11px; color:#64748b; margin-top:2px; }
.eod-agents { padding:8px 0; }
.eod-agent-row {
  display:flex; align-items:center; gap:10px;
  padding:10px 16px; border-bottom:1px solid #f8fafc;
}
.eod-medal { font-size:18px; flex-shrink:0; }
.eod-aname { font-size:13px; font-weight:600; color:#1e293b; flex:1; }
.eod-apills { display:flex; gap:6px; flex-wrap:wrap; }
.pill-call,.pill-conv,.pill-rev {
  font-size:11px; font-weight:600; padding:2px 8px; border-radius:10px;
}
.pill-call { background:#eff6ff; color:#2563eb; }
.pill-conv { background:#f0fdf4; color:#16a34a; }
.pill-rev  { background:#fefce8; color:#854d0e; }
.eod-warn {
  margin:8px 16px; padding:10px 14px; background:#fefce8;
  border:1px solid #fde68a; border-radius:8px;
  font-size:13px; color:#854d0e;
}
@media(max-width:768px) {
  .eod-totals { grid-template-columns:repeat(2,1fr); }
  .eod-apills { flex-direction:column; }
}

/* ── Meeting Scheduler ───────────────────────────────────────── */
.meetings-list { padding:8px 0; }
.meet-row {
  display:flex; align-items:center; gap:14px;
  padding:12px 16px; border-bottom:1px solid #f1f5f9; transition:background .15s;
}
.meet-row:last-child { border-bottom:none; }
.meet-row:hover { background:#f8fafc; }
.meet-soon { background:#fff5f5 !important; border-left:3px solid #dc2626; }
.meet-time { text-align:center; min-width:70px; }
.meet-clock { font-size:15px; font-weight:700; color:#1e293b; }
.meet-until { font-size:11px; margin-top:2px; font-weight:600; }
.meet-info { flex:1; min-width:0; }
.meet-title { font-size:14px; font-weight:600; color:#1e293b; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.meet-lead { font-size:12px; color:#64748b; margin-top:2px; }
.meet-actions { display:flex; gap:6px; flex-shrink:0; }

/* ── Pre-Meeting Brief ────────────────────────────────────────── */
.brief-lead { background:linear-gradient(135deg,#f5f3ff,#ede9fe); border-radius:10px; padding:16px; margin-bottom:16px; }
.brief-name { font-size:20px; font-weight:800; color:#4c1d95; }
.brief-meta { font-size:13px; color:#6d28d9; margin-top:6px; line-height:1.6; }
.brief-section { margin-bottom:16px; }
.brief-label { font-size:12px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:.5px; margin-bottom:8px; }
.brief-points { margin:0; padding-left:18px; }
.brief-points li { font-size:14px; color:#1e293b; margin-bottom:6px; line-height:1.5; }
.brief-history { display:flex; flex-direction:column; gap:8px; }
.brief-call { display:flex; align-items:center; gap:10px; padding:8px 12px; background:#f8fafc; border-radius:8px; }
.brief-outcome { font-size:11px; font-weight:700; padding:2px 8px; border-radius:10px; flex-shrink:0; }
.brief-callnotes { font-size:13px; color:#1e293b; flex:1; }
.brief-calltime { font-size:11px; color:#94a3b8; flex-shrink:0; }
.brief-notes { font-size:14px; color:#334155; background:#f8fafc; padding:12px; border-radius:8px; line-height:1.6; }

/* ── Leaderboard ─────────────────────────────────────────────── */
.period-tabs { display:flex; gap:4px; background:#f1f5f9; padding:4px; border-radius:10px; }
.period-btn {
  padding:6px 16px; border-radius:8px; border:none; cursor:pointer;
  font-size:13px; font-weight:600; color:#64748b; background:transparent; transition:all .2s;
}
.period-btn.active { background:#fff; color:#1e293b; box-shadow:0 1px 4px rgba(0,0,0,.1); }

.lb-totals {
  display:grid; grid-template-columns:repeat(4,1fr);
  gap:12px; margin-bottom:20px;
}
.lb-total-item {
  background:#fff; border-radius:12px; padding:16px;
  text-align:center; box-shadow:0 1px 4px rgba(0,0,0,.06);
}
.lb-total-num { display:block; font-size:28px; font-weight:800; color:#1e293b; }
.lb-total-lbl { display:block; font-size:12px; color:#64748b; margin-top:4px; }

.lb-grid { display:flex; flex-direction:column; gap:12px; }
.lb-loading { text-align:center; padding:40px; color:#94a3b8; font-size:15px; }
.lb-card {
  background:#fff; border-radius:14px; padding:16px 20px;
  display:flex; align-items:center; gap:16px;
  box-shadow:0 1px 4px rgba(0,0,0,.06); transition:transform .2s;
  border:2px solid transparent;
}
.lb-card:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(0,0,0,.1); }
.lb-first { border-color:#f59e0b; background:linear-gradient(135deg,#fffbeb,#fff); }
.lb-mine  { border-color:#6366f1; }
.lb-rank-wrap { display:flex; flex-direction:column; align-items:center; gap:4px; min-width:40px; }
.lb-rank-num {
  width:32px; height:32px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:800; color:#fff;
}
.lb-medal { font-size:20px; }
.lb-agent-info { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.lb-avatar {
  width:44px; height:44px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:18px; font-weight:800; color:#fff; flex-shrink:0;
}
.lb-name { font-size:16px; font-weight:700; color:#1e293b; }
.lb-you { background:#6366f1; color:#fff; font-size:10px; padding:2px 7px; border-radius:8px; margin-left:6px; font-weight:700; }
.lb-score-bar-wrap { height:4px; background:#f1f5f9; border-radius:2px; margin-top:6px; width:200px; max-width:100%; }
.lb-score-bar { height:100%; border-radius:2px; transition:width .5s ease; }
.lb-score-big { font-size:28px; font-weight:900; color:#1e293b; min-width:90px; text-align:center; }
.lb-stats { display:flex; gap:16px; flex-wrap:wrap; }
.lb-stat-item { text-align:center; min-width:50px; }
.lb-stat-val { display:block; font-size:18px; font-weight:800; color:#1e293b; }
.lb-stat-lbl { display:block; font-size:10px; color:#94a3b8; margin-top:2px; }
.lb-mini-bar { height:3px; background:#e2e8f0; border-radius:2px; margin-top:4px; width:40px; }
.score-pill { font-size:12px; font-weight:700; padding:4px 10px; border-radius:8px; }

@media(max-width:768px) {
  .lb-totals { grid-template-columns:repeat(2,1fr); }
  .lb-card { flex-wrap:wrap; }
  .lb-score-bar-wrap { width:120px; }
  .lb-stats { gap:10px; }
}

/* ── Bulk Selection ────────────────────────────────────────── */
.lead-cb { accent-color: #2563eb; cursor: pointer; }
.kanban-card.selected { outline: 2px solid #2563eb; background: #eff6ff; }

/* ── Outcome Modal Quick Styles ──────────────────────────────── */
.outcome-btn:hover { transform: scale(1.02); box-shadow: 0 4px 10px rgba(0,0,0,.12) !important; }
.fu-quick {
  background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe;
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
  cursor: pointer; font-weight: 600; transition: background .15s;
}
.fu-quick:hover { background: #bfdbfe; }

/* ═══════════════════════════════════════
   DARK MODE
═══════════════════════════════════════ */
body.dark-mode {
  --bg:        #0f172a;
  --card-bg:   #1e293b;
  --border:    #334155;
  --text:      #e2e8f0;
  --text-sub:  #94a3b8;
  --sidebar:   #0f172a;
  --topbar:    #1e293b;
  background:  #0f172a !important;
  color: #e2e8f0 !important;
}
body.dark-mode .card,
body.dark-mode .stat-card { background:#1e293b !important; border-color:#334155 !important; }
body.dark-mode .data-table thead tr { background:#0f172a !important; }
body.dark-mode .data-table td,
body.dark-mode .data-table th { border-color:#334155 !important; color:#e2e8f0 !important; }
body.dark-mode .data-table tr:hover { background:#334155 !important; }
body.dark-mode .modal { background:#1e293b !important; border-color:#334155 !important; }
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background:#0f172a !important;
  border-color:#334155 !important;
  color:#e2e8f0 !important;
}
body.dark-mode .page-content { background:#0f172a !important; }
body.dark-mode .topbar { background:#1e293b !important; border-color:#334155 !important; }
body.dark-mode .kanban-col { background:#1e293b !important; }
body.dark-mode .kanban-card { background:#0f172a !important; border-color:#334155 !important; }
body.dark-mode .clf-btn { background:#1e293b !important; border-color:#334155 !important; color:#94a3b8 !important; }
body.dark-mode .clf-btn.active { background:#3b82f6 !important; color:#fff !important; }
body.dark-mode .badge-blue   { background:#1e3a5f !important; color:#60a5fa !important; }
body.dark-mode .badge-green  { background:#14532d !important; color:#4ade80 !important; }
body.dark-mode .badge-red    { background:#7f1d1d !important; color:#f87171 !important; }
body.dark-mode .badge-gray   { background:#334155 !important; color:#94a3b8 !important; }
body.dark-mode .alert-success { background:#14532d !important; color:#4ade80 !important; }
body.dark-mode .alert-error   { background:#7f1d1d !important; color:#f87171 !important; }
