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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0A0F1C;
  color: #F9FAFB;
  font-size: 13px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111827; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4B5563; }

/* ── Header ── */
.header {
  background: linear-gradient(135deg, #0D1117 0%, #161B22 100%);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #F9FAFB;
}
.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.header select, .header button {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 13px;
  cursor: pointer;
}
.header select option { color: #F9FAFB; background: #1E293B; }
.header button:hover { background: rgba(255,255,255,0.15); }
.btn-refresh { background: #0f3460 !important; border-color: #0f3460 !important; }
.btn-refresh:hover { background: #1a508b !important; }
.btn-export { background: #059669 !important; border-color: #059669 !important; }
.btn-export:hover { background: #047857 !important; }

/* ── View Toggle ── */
.view-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}
.view-toggle button {
  border: none;
  border-radius: 0;
  padding: 6px 16px;
}
.view-toggle button.active {
  background: #02C3C1 !important;
  border-color: #02C3C1 !important;
  color: #0A0F1C;
  font-weight: 700;
}

/* ── Date Range Bar ── */
.date-range-bar {
  padding: 10px 24px;
  background: #111827;
  border-bottom: 1px solid #1F2937;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.date-range-bar label {
  font-weight: 600;
  font-size: 13px;
  color: #9CA3AF;
}
.date-range-bar input[type="date"] {
  padding: 5px 10px;
  border: 1px solid #374151;
  border-radius: 4px;
  font-size: 12px;
  background: #1E293B;
  color: white;
  color-scheme: dark;
}
.date-range-bar span {
  color: #6B7280;
  font-weight: 600;
}
.btn-clear-date {
  background: #1C0A0A !important;
  color: #F87171 !important;
  border: 1px solid #7F1D1D !important;
}
.btn-clear-date:hover {
  background: #2D1111 !important;
}
.date-info {
  font-size: 12px;
  color: #9CA3AF;
  background: #1E293B;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
}

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 60px;
  font-size: 16px;
  color: #9CA3AF;
}
.loading .spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid #374151;
  border-top-color: #02C3C1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress Bar ── */
.progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: #111827;
  border-top: 1px solid #1F2937;
  z-index: 999;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #02C3C1, #059669);
  transition: width 0.3s ease;
  width: 0%;
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: #F9FAFB;
}

/* ── Client Block ── */
.client-block {
  background: #111827;
  border: 1px solid #1F2937;
  margin: 0 16px 2px;
  border-radius: 4px;
  overflow: hidden;
}
.client-block:first-child { margin-top: 16px; }
.client-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #1A1F2E;
  border-bottom: 1px solid #1F2937;
  cursor: pointer;
  user-select: none;
}
.client-header:hover { background: #222837; }
.client-name {
  font-weight: 700;
  font-size: 14px;
  min-width: 160px;
  color: #F9FAFB;
}
.client-badges {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.badge-meeting {
  background: #065F46;
  color: #34D399;
  border: 1px solid #047857;
}
.badge-positive {
  background: #1E3A5F;
  color: #60A5FA;
  border: 1px solid #2563EB;
}
.badge-replies {
  background: #451A03;
  color: #FBBF24;
  border: 1px solid #D97706;
}
.badge.clickable {
  cursor: pointer;
  transition: all 0.2s;
}
.badge.clickable:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.client-toggle {
  font-size: 12px;
  color: #6B7280;
  transition: transform 0.2s;
}
.client-toggle.open { transform: rotate(90deg); }

/* ── Table Scroll ── */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

/* ── KPI Table ── */
.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.kpi-table th, .kpi-table td {
  padding: 5px 10px;
  text-align: right;
  border: 1px solid #1F2937;
  white-space: nowrap;
  color: #E2E8F0;
}
.kpi-table th {
  background: #1E293B;
  font-weight: 600;
  color: #94A3B8;
  position: sticky;
  top: 0;
  font-size: 11px;
}
.kpi-table th:first-child,
.kpi-table td:first-child {
  text-align: left;
  font-weight: 600;
  min-width: 180px;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}
.kpi-table td:first-child { background: #111827; }
.kpi-table th.col-total {
  background: #0D1117;
  color: #F9FAFB;
  font-size: 12px;
}
.kpi-table td.col-total {
  background: #0D1929;
  font-weight: 700;
  color: #F9FAFB;
}
.kpi-table td.has-data {
  font-weight: 600;
}

/* Clickable cells in table */
.clickable-cell {
  cursor: pointer;
  position: relative;
}
.clickable-cell:hover {
  background: #1E3A5F !important;
}
.drill-icon {
  font-size: 10px;
  opacity: 0.4;
  position: absolute;
  right: 4px;
  top: 4px;
}
.clickable-cell:hover .drill-icon {
  opacity: 1;
}

/* Row colors (dark) */
.row-meeting { background: #0D2818; }
.row-meeting td:first-child { background: #0D2818 !important; }
.row-meeting td { color: #4ADE80; }
.row-positive { background: #0C1929; }
.row-positive td:first-child { background: #0C1929 !important; }
.row-positive td { color: #60A5FA; }
.row-totali { background: #1C1608; }
.row-totali td:first-child { background: #1C1608 !important; }
.row-totali td { color: #FBBF24; }
.row-inviate { background: #1A0D24; }
.row-inviate td:first-child { background: #1A0D24 !important; }
.row-inviate td { color: #C084FC; }
.row-bounced { background: #1C0A0A; }
.row-bounced td:first-child { background: #1C0A0A !important; }
.row-bounced td { color: #F87171; }
.row-percent { background: #1E293B; font-style: italic; }
.row-percent td:first-child { background: #1E293B !important; }
.row-percent td { color: #94A3B8; }
.row-leads { background: #0D1F1C; }
.row-leads td:first-child { background: #0D1F1C !important; }
.row-leads td { color: #2DD4BF; }
.row-ratio { background: #1C1006; }
.row-ratio td:first-child { background: #1C1006 !important; }
.row-ratio td { color: #FB923C; }

/* Collapsed */
.client-body { display: none; }
.client-body.open { display: block; }

/* ── Summary Cards ── */
.summary-bar {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  background: #0A0F1C;
  border-bottom: 1px solid #1F2937;
  overflow-x: auto;
}
.summary-card {
  flex: 1;
  min-width: 120px;
  padding: 10px 14px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #1F2937;
}
.summary-card .label {
  font-size: 10px;
  color: #9CA3AF;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-card .value {
  font-size: 20px;
  font-weight: 700;
}
.sc-meetings { background: #0D2818; }
.sc-meetings .value { color: #4ADE80; }
.sc-positive { background: #0C1929; }
.sc-positive .value { color: #60A5FA; }
.sc-replies { background: #1C1608; }
.sc-replies .value { color: #FBBF24; }
.sc-sent { background: #1A0D24; }
.sc-sent .value { color: #C084FC; }
.sc-leads { background: #0D1F1C; }
.sc-leads .value { color: #2DD4BF; }
.sc-rate { background: #1C1006; }
.sc-rate .value { color: #FB923C; }
.sc-bounced { background: #1C0A0A; }
.sc-bounced .value { color: #F87171; }

/* ── Filter Bar ── */
.filter-bar {
  padding: 10px 24px;
  background: #111827;
  border-bottom: 1px solid #1F2937;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar label { font-weight: 600; font-size: 12px; color: #9CA3AF; }
.filter-bar select, .filter-bar input {
  padding: 5px 10px;
  border: 1px solid #374151;
  border-radius: 4px;
  font-size: 12px;
  background: #1E293B;
  color: white;
}
.filter-bar select option { background: #1E293B; color: #F9FAFB; }
.btn-sm {
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.btn-expand { background: #1E3A5F; color: #60A5FA; }
.btn-expand:hover { background: #254B77; }
.btn-collapse { background: #1E293B; color: #9CA3AF; }
.btn-collapse:hover { background: #2D3748; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: #1A1F2E;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  color: white;
  border: 1px solid #1F2937;
}
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: #374151;
  border: none;
  font-size: 18px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F9FAFB;
}
.modal-close:hover { background: #4B5563; }
.modal-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #1F2937;
}
.modal-header-content h2 {
  font-size: 18px;
  color: #F9FAFB;
}
.modal-count {
  background: #02C3C1;
  color: #0A0F1C;
  padding: 4px 14px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 14px;
}
.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.modal-table th {
  background: #0D1117;
  color: #94A3B8;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
}
.modal-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1F2937;
  color: #E2E8F0;
}
.modal-table tr:hover td {
  background: #222837;
}
.modal-table .campaign-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #9CA3AF;
}

/* ── No Data ── */
.no-data {
  text-align: center;
  padding: 20px;
  color: #6B7280;
  font-style: italic;
}

/* ── Sync Note ── */
.sync-note {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: #FBBF24;
  background: #1C1608;
  border: 1px solid #451A03;
  border-radius: 4px;
  margin: 8px 16px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .header { flex-direction: column; gap: 10px; }
  .header h1 { font-size: 15px; }
  .summary-bar { flex-wrap: wrap; }
  .summary-card { min-width: 100px; }
  .client-badges { flex-wrap: wrap; }
  .modal-content { width: 95%; padding: 16px; }
}
