@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Serif+Display&display=swap');

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

:root {
  --navy: #1B2A4A;
  --navy-light: #243558;
  --navy-dark: #131f38;
  --gold: #C9A84C;
  --gold-light: #d4ba6a;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --white: #ffffff;
  --grey-100: #f5f6f8;
  --grey-200: #e8eaef;
  --grey-300: #c5c9d3;
  --grey-500: #7a8194;
  --grey-700: #3d4559;
  --green: #34c759;
  --red: #ff3b30;
  --amber: #ff9500;
  --blue: #007aff;
  --sidebar-width: 240px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--grey-100);
  color: var(--navy);
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'DM Serif Display', serif; font-weight: 400; }

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo h1 {
  color: var(--gold);
  font-size: 22px;
  letter-spacing: 0.5px;
}

.sidebar-logo span {
  color: var(--grey-300);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  display: block;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--grey-300);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.nav-item.active { background: rgba(201,168,76,0.12); color: var(--gold); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.nav-icon { width: 20px; text-align: center; font-size: 16px; }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px;
}

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

.page-header h2 { font-size: 28px; color: var(--navy); }

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

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-card .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-500);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--navy);
}

.stat-card .stat-value.gold { color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--gold); color: var(--navy); }
.btn-primary:hover { background: var(--gold-light); }
.btn-secondary { background: var(--navy); color: white; }
.btn-secondary:hover { background: var(--navy-light); }
.btn-outline { background: transparent; border: 1.5px solid var(--grey-200); color: var(--grey-700); }
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--grey-500); padding: 6px 10px; }
.btn-ghost:hover { color: var(--navy); background: var(--grey-100); }

/* Tier badges */
.tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tier-1 { background: rgba(255,59,48,0.12); color: var(--red); }
.tier-2 { background: rgba(255,149,0,0.12); color: var(--amber); }
.tier-3 { background: var(--grey-200); color: var(--grey-500); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-new { background: var(--grey-200); color: var(--grey-500); }
.status-contacted { background: rgba(0,122,255,0.12); color: var(--blue); }
.status-replied { background: rgba(52,199,89,0.12); color: var(--green); }
.status-meeting_booked { background: var(--gold-dim); color: var(--gold); }
.status-dead { background: rgba(255,59,48,0.08); color: var(--red); }
.status-dnc { background: rgba(255,59,48,0.12); color: var(--red); }

/* Sentiment */
.sentiment { font-size: 14px; margin-left: 6px; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-500);
  border-bottom: 2px solid var(--grey-200);
  font-weight: 600;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-100);
  font-size: 14px;
}

.data-table tr:hover { background: var(--grey-100); }
.data-table tr.clickable { cursor: pointer; }

.data-table tr.row-new td:first-child { border-left: 3px solid var(--grey-300); }
.data-table tr.row-contacted td:first-child { border-left: 3px solid var(--blue); }
.data-table tr.row-replied td:first-child { border-left: 3px solid var(--green); }
.data-table tr.row-meeting_booked td:first-child { border-left: 3px solid var(--gold); }
.data-table tr.row-dead td:first-child { border-left: 3px solid var(--red); }
.data-table tr.row-dnc td:first-child { border-left: 3px solid var(--red); }

/* Form inputs */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--grey-200);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--navy);
  background: white;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

textarea { resize: vertical; min-height: 80px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 6px;
}

.form-group { margin-bottom: 20px; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--grey-200);
  border-radius: 12px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.upload-zone .upload-icon { font-size: 48px; margin-bottom: 16px; }
.upload-zone h3 { font-size: 18px; margin-bottom: 8px; color: var(--navy); }
.upload-zone p { color: var(--grey-500); font-size: 14px; }

/* Kanban */
.kanban-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  overflow-x: auto;
}

.kanban-column {
  background: var(--grey-100);
  border-radius: 12px;
  padding: 16px;
  min-height: 400px;
}

.kanban-column-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-500);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column-count {
  background: var(--grey-200);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.kanban-card {
  background: white;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  cursor: grab;
  transition: box-shadow 0.2s;
}

.kanban-card:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.1); }
.kanban-card.dragging { opacity: 0.5; }

.kanban-card-name { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.kanban-card-meta { font-size: 12px; color: var(--grey-500); display: flex; gap: 8px; align-items: center; }

/* Inbox */
.inbox-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  height: calc(100vh - 120px);
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.inbox-list {
  border-right: 1px solid var(--grey-200);
  overflow-y: auto;
}

.inbox-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey-100);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.inbox-item:hover { background: var(--grey-100); }
.inbox-item.active { background: var(--gold-dim); }

.inbox-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  margin-top: 6px;
}

.inbox-item-content { flex: 1; min-width: 0; }
.inbox-item-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.inbox-item-preview { font-size: 13px; color: var(--grey-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.inbox-item-time { font-size: 11px; color: var(--grey-300); flex-shrink: 0; }

.inbox-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.inbox-thread-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inbox-thread-header .lead-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inbox-thread-header .lead-name { font-weight: 600; font-size: 16px; }
.inbox-thread-header .lead-detail { font-size: 13px; color: var(--grey-500); }

.inbox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-bubble.outbound {
  align-self: flex-end;
  background: var(--navy);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.inbound {
  align-self: flex-start;
  background: var(--grey-100);
  color: var(--navy);
  border-bottom-left-radius: 4px;
}

.message-meta {
  font-size: 11px;
  color: var(--grey-300);
  margin-top: 4px;
}

.message-bubble.outbound .message-meta { text-align: right; }

.inbox-composer {
  padding: 16px 24px;
  border-top: 1px solid var(--grey-200);
}

.composer-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.composer-toggle .btn { flex: 1; text-align: center; justify-content: center; }
.composer-toggle .btn.active { background: var(--navy); color: white; }

.composer-area {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.composer-area textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
}

/* Approval cards */
.approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

.approval-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.approval-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--grey-100);
}

.approval-card-header h3 { font-size: 18px; }

.message-preview {
  margin-bottom: 16px;
}

.message-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--grey-500);
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.message-preview-label .word-count {
  font-weight: 400;
  font-size: 11px;
  color: var(--grey-300);
}

.message-preview-content {
  background: var(--grey-100);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Activity feed */
.activity-feed {
  max-height: 500px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grey-100);
  font-size: 13px;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-dot.outbound { background: var(--blue); }
.activity-dot.inbound { background: var(--green); }

.activity-time { color: var(--grey-300); font-size: 11px; margin-top: 4px; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input, .filter-bar select {
  width: auto;
  min-width: 160px;
}

/* Side drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed;
  right: -480px;
  top: 0;
  width: 480px;
  height: 100vh;
  background: white;
  z-index: 201;
  transition: right 0.3s;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}

.drawer.open { right: 0; }

.drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body { padding: 24px; }

/* Lead profile card in drawer */
.lead-profile {
  background: var(--grey-100);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.lead-profile-name { font-family: 'DM Serif Display', serif; font-size: 20px; margin-bottom: 8px; }
.lead-profile-row { display: flex; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.lead-profile-label { color: var(--grey-500); min-width: 100px; }

/* Batch card */
.batch-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow 0.2s;
  margin-bottom: 12px;
}

.batch-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.1); }

.batch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.batch-card-stats {
  display: flex;
  gap: 24px;
}

.batch-stat { text-align: center; }
.batch-stat-value { font-family: 'DM Serif Display', serif; font-size: 20px; color: var(--navy); }
.batch-stat-label { font-size: 11px; color: var(--grey-500); text-transform: uppercase; letter-spacing: 0.5px; }

.batch-remarks {
  font-size: 13px;
  color: var(--grey-500);
  margin-top: 12px;
  font-style: italic;
}

/* Settings form */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.settings-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.settings-section h3 {
  font-size: 18px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--grey-100);
}

.settings-section.full-width { grid-column: 1 / -1; }

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.connection-status.connected { color: var(--green); }
.connection-status.disconnected { color: var(--red); }

/* Checkbox */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--grey-500);
}

.empty-state h3 { color: var(--grey-700); margin-bottom: 8px; }

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--grey-200);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--grey-500);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--navy);
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--grey-200);
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Dashboard layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .kanban-container { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo h1, .sidebar-logo span, .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 14px; }
  .main-content { margin-left: 60px; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .inbox-container { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-300); }

/* Drag and drop highlight for kanban */
.kanban-column.drag-over {
  background: var(--gold-dim);
  border: 2px dashed var(--gold);
}
