:root {
  --bg: #0f1117;
  --surface: #1a1d2e;
  --surface2: #242740;
  --border: #2e3150;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --radius: 12px;
}

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

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

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-section {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 8px;
  margin-bottom: 8px;
  margin-top: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(108, 99, 255, 0.15); color: var(--accent2); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }

.bot-status {
  margin-top: auto;
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px;
}

.bot-status-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.bot-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

.dot.off { background: var(--red); box-shadow: 0 0 8px var(--red); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* MAIN CONTENT */
.main {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  max-width: 1200px;
}

.page { display: none; }
.page.active { display: block; }

/* HEADER */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

.stat-card.green::before { background: var(--green); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.blue::before { background: var(--blue); }

.stat-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-today {
  font-size: 11px;
  color: var(--accent2);
  margin-top: 8px;
}

/* PROGRESS BARS */
.progress-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.progress-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-item {
  margin-bottom: 14px;
}

.progress-item:last-child { margin-bottom: 0; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.progress-count { color: var(--text-muted); }

.progress-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.5s ease;
}

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-action {
  font-size: 12px;
  color: var(--accent2);
  cursor: pointer;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(108, 99, 255, 0.1);
  transition: background 0.15s;
}

.card-action:hover { background: rgba(108, 99, 255, 0.2); }

/* TABLE */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid rgba(46, 49, 80, 0.5);
  vertical-align: middle;
}

tr:hover td { background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }

.prospect-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.prospect-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* BADGES */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-pending   { background: rgba(148,163,184,0.1); color: var(--text-muted); }
.badge-contacted { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-replied   { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-interested{ background: rgba(108,99,255,0.2);  color: var(--accent2); }
.badge-call_booked { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-client    { background: rgba(16,185,129,0.3);  color: var(--green); font-weight: 700; }
.badge-call_proposed { background: rgba(108,99,255,0.2); color: var(--accent2); }

.interest-high   { color: var(--green); font-weight: 700; }
.interest-medium { color: var(--yellow); }
.interest-low    { color: var(--red); }

/* ACTIVITY LOG */
.activity-list { list-style: none; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(46,49,80,0.4);
  font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

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

.activity-dot.message_sent    { background: var(--blue); }
.activity-dot.reply_generated { background: var(--accent); }
.activity-dot.call_booked     { background: var(--green); }
.activity-dot.error           { background: var(--red); }

.activity-text { color: var(--text); flex: 1; }
.activity-time { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

/* CONVERSATION DETAIL */
.conversation-messages {
  max-height: 400px;
  overflow-y: auto;
  padding: 16px 0;
}

.msg {
  margin-bottom: 14px;
  max-width: 80%;
}

.msg.sent { margin-left: auto; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.msg.sent .msg-bubble {
  background: rgba(108, 99, 255, 0.2);
  border-bottom-right-radius: 4px;
}

.msg.received .msg-bubble {
  background: var(--surface2);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.msg.sent .msg-time { text-align: right; }

/* SETTINGS */
.settings-group {
  margin-bottom: 24px;
}

.settings-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: #5b52e0; }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--red);
}

.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* LOGIN */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  text-align: center;
}

.login-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 16px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-error {
  background: rgba(239,68,68,0.1);
  color: var(--red);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

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

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 13px;
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
}

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

.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }

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

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 13px; }
