* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --bg: #F0F2F5;
  --sidebar-bg: #1E1E2E;
  --card-bg: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --border: #DFE6E9;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #E17055;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo h2 { font-size: 22px; font-weight: 700; }
.logo .subtitle { font-size: 12px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1px; }

.nav-links { list-style: none; margin-top: 16px; }

.nav-link {
  display: block;
  padding: 12px 24px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 15px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-link.active { color: #fff; background: rgba(108,92,231,0.2); border-left-color: var(--primary); }

/* Content */
.content {
  margin-left: 240px;
  padding: 32px;
  flex: 1;
  min-height: 100vh;
}

h1 { font-size: 28px; margin-bottom: 24px; font-weight: 700; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .label { font-size: 13px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 32px; font-weight: 700; margin-top: 4px; }
.stat-card .value.purple { color: var(--primary); }
.stat-card .value.green { color: var(--success); }
.stat-card .value.orange { color: #E17055; }

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h3 { font-size: 16px; margin-bottom: 16px; font-weight: 600; }

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Chart bars */
.chart-bars .bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.chart-bars .bar-label {
  width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-light);
}

.chart-bars .bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg);
  border-radius: 4px;
  margin: 0 8px;
  overflow: hidden;
}

.chart-bars .bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.chart-bars .bar-count { width: 40px; text-align: right; font-weight: 600; font-size: 13px; }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: var(--primary); }

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
  outline: none;
  cursor: pointer;
}

/* Tables */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

thead { background: var(--sidebar-bg); color: #fff; }
th { padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
tr:hover { background: rgba(108,92,231,0.03); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active { background: #D4EFDF; color: #27AE60; }
.badge-inactive { background: #FADBD8; color: #E74C3C; }
.badge-pending { background: #FEF5E7; color: #F39C12; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-view { background: var(--bg); color: var(--primary); }
.btn-view:hover { background: var(--primary); color: #fff; }
.btn-upload { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-upload:hover { background: var(--primary); color: #fff; }
.btn-whatsapp { background: #25D366; color: #fff; padding: 10px 24px; font-size: 15px; }
.btn-whatsapp:hover { background: #1DA851; }
.btn-back { background: none; color: var(--text-light); margin-bottom: 16px; cursor: pointer; border: none; font-size: 14px; }
.btn-back:hover { color: var(--primary); }

/* Client Detail */
.client-header {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.client-header h2 { font-size: 22px; margin-bottom: 12px; }

.client-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.client-meta .meta-item { font-size: 14px; }
.client-meta .meta-label { color: var(--text-light); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.client-meta .meta-value { font-weight: 500; margin-top: 2px; word-break: break-all; }

.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Form */
.call-form .form-group { margin-bottom: 14px; }
.call-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-light); }
.call-form input, .call-form select, .call-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.call-form input:focus, .call-form select:focus, .call-form textarea:focus { border-color: var(--primary); }

.inline-form { display: flex; gap: 12px; align-items: center; }
.inline-form input { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; }

/* Call history */
.call-entry {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}

.call-entry .call-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.call-entry .call-marketer { font-weight: 600; color: var(--primary); }
.call-entry .call-date { font-size: 12px; color: var(--text-light); }
.call-entry .call-method { font-size: 13px; color: var(--text-light); }
.call-entry .call-outcome { display: inline-block; margin-top: 4px; }
.call-entry .call-notes { font-size: 13px; color: var(--text); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.call-entry .call-followup { font-size: 12px; color: var(--warning); margin-top: 4px; }

.no-data { color: var(--text-light); font-size: 14px; padding: 20px 0; text-align: center; }
.notes-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-light); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.pagination button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* Recent calls in dashboard */
.recent-call-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.recent-call-item:last-child { border-bottom: none; }
.recent-call-biz { font-weight: 600; }
.recent-call-marketer { color: var(--primary); }
.recent-call-date { color: var(--text-light); font-size: 12px; }

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 { margin-bottom: 0; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-label { font-size: 13px; color: var(--text-light); font-weight: 500; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 { font-size: 20px; }

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: rgba(108,92,231,0.04);
}

.upload-icon { margin-bottom: 12px; }
.upload-area p { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.upload-hint { color: var(--text-light) !important; font-size: 12px !important; }

.upload-progress { margin-top: 16px; text-align: center; }
.progress-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; width: 0%; }
#upload-status { font-size: 14px; color: var(--text-light); margin-top: 8px; }

/* WhatsApp card */
.whatsapp-card {
  margin-bottom: 20px;
  border-left: 4px solid #25D366;
}

.whatsapp-form { max-width: 600px; }
.whatsapp-form .form-group { margin-bottom: 12px; }
.whatsapp-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text-light); }
.whatsapp-form input, .whatsapp-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.whatsapp-form input:focus, .whatsapp-form textarea:focus { border-color: #25D366; }

/* Reports - Daily chart */
.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-top: 10px;
}

.daily-bar {
  flex: 1;
  min-width: 16px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.daily-bar:hover { background: var(--primary-dark); }

.daily-bar .bar-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  margin-bottom: 4px;
}

.daily-bar:hover .bar-tooltip { display: block; }

.report-coverage-pct {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .logo h2, .logo .subtitle, .nav-link { font-size: 0; }
  .nav-link { padding: 16px 0; text-align: center; }
  .content { margin-left: 60px; padding: 20px; }
  .dashboard-row, .detail-row { grid-template-columns: 1fr; }
}
