:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(22, 32, 54, 0.75);
  --bg-card-hover: rgba(30, 43, 72, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --badge-green: #10b981;
  --badge-yellow: #f59e0b;
  --badge-blue: #3b82f6;
  --badge-purple: #8b5cf6;
  --badge-red: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Glassmorphism containers */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* Layout */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  position: sticky;
  top: 12px;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.role-badge.admin {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.role-badge.first_voice {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.role-badge.second_voice {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.shift-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.shift-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shift-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.shift-indicator.active {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.shift-indicator.inactive {
  background: #ef4444;
}

/* Tabs Navigation */
.nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* Views */
.view-content {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-content.active {
  display: block;
}

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

/* Lead Card (Conveyor) */
.lead-card-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.lead-hero-card {
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.lead-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

.lead-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.lead-client-name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.lead-meta-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lead-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Call Button - Focal Point */
.call-action-box {
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.phone-display {
  display: flex;
  flex-direction: column;
}

.phone-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.phone-number {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-secondary);
}

.call-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--success-gradient);
  color: white;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.call-btn-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
}

.call-btn-link:active {
  transform: scale(0.98);
}

/* Extra Details Grid */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.detail-item {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-item .label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.detail-item .value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2px;
}

.detail-item.full-width {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent-secondary);
}

/* Objection Preset Chips */
.chips-section {
  margin-bottom: 20px;
}

.chips-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Comment Box */
.comment-input-box {
  margin-bottom: 24px;
}

.comment-textarea {
  width: 100%;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border-color 0.2s;
}

.comment-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Action Buttons Bar */
.action-buttons-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  flex: 2;
  min-width: 220px;
  background: var(--accent-gradient);
  border: none;
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-2px);
}

.btn-secondary {
  flex: 1;
  min-width: 140px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Empty State / Pull Lead Hero */
.empty-queue-hero {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.pull-lead-hero-btn {
  margin-top: 24px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 18px 40px;
  border-radius: var(--radius-full);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
}

.pull-lead-hero-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

/* History Timeline */
.history-section {
  padding: 24px;
  margin-top: 20px;
}

.timeline {
  position: relative;
  padding-left: 28px;
  margin-top: 16px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 8px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-item.transferred .timeline-dot {
  border-color: #34d399;
}

.timeline-header {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
  align-items: center;
}

.timeline-author {
  font-weight: 600;
  color: var(--text-muted);
}

.timeline-content {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  font-size: 0.92rem;
  border-left: 3px solid var(--accent-primary);
}

/* Admin KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  font-weight: 600;
}

.kpi-card .kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -1px;
}

.kpi-card .kpi-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 26px;
  opacity: 0.25;
}

/* Drag & Drop Excel Box */
.dropzone-box {
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  background: rgba(99, 102, 241, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.08);
}

.dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  padding: 12px 16px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

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

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

.modal-content {
  width: 100%;
  max-width: 520px;
  padding: 28px;
  border-radius: var(--radius-lg);
  position: relative;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .user-panel {
    justify-content: space-between;
  }
  .call-action-box {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .call-btn-link {
    justify-content: center;
  }
  .action-buttons-bar {
    flex-direction: column;
  }
  .btn-primary, .btn-secondary, .btn-danger {
    width: 100%;
    flex: none;
  }
}
