/* Dashboard-specific styles */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: #f6f6f7;
  position: relative;
}

/* Low Intent Orders Table Styles */
.low-intent-section {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  border-left: 4px solid #dc3545;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.low-intent-section h3 {
  margin: 0 0 15px 0;
  color: #dc3545;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.low-intent-section .table-container {
  border: 1px solid #e9ecef;
  border-radius: 6px;
  overflow: hidden;
}

.low-intent-section .orders-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.low-intent-section .orders-table th {
  background: #f8f9fa;
  color: #495057;
  font-weight: 600;
  padding: 12px 8px;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  font-size: 14px;
}

.low-intent-section .orders-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e9ecef;
  font-size: 14px;
  vertical-align: middle;
}

.low-intent-section .orders-table tbody tr:hover {
  background-color: #f8f9fa;
}

.retry-count-badge {
  background: #dc3545 !important;
  color: white !important;
  padding: 2px 6px !important;
  border-radius: 3px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

body {
  margin: 0;
  padding: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}


/* Sidebar Styles */
.sidebar {
  width: 240px;
  background: #202223;
  color: #ffffff;
  padding: 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  top: 0;
  left: 0;
  border-radius: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #3a3b3c;
  margin: 0;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.sidebar-nav {
  padding: 0;
  margin: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.nav-item:hover {
  background: #3a3b3c;
  color: #ffffff !important;
}

.nav-item.active {
  background: #3a3b3c;
  color: #ffffff !important;
  border-left-color: #5c6ac4;
}

.nav-icon {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  transition: all 0.2s ease;
}

.nav-item:hover .nav-icon svg {
  stroke: #5c6ac4;
  transform: scale(1.1);
}

.nav-item.active .nav-icon svg {
  stroke: #5c6ac4;
}

.nav-section {
  margin-top: 24px;
}

.nav-section-title {
  display: block;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: #8c9196;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

/* Ensure all text in sidebar is visible */
/* .sidebar * {
  color: inherit;
} */

.sidebar a {
  color: #ffffff !important;
  text-decoration: none;
}

.sidebar a:hover {
  color: #ffffff !important;
}

.sidebar a:visited {
  color: #ffffff !important;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 0;
  background: #ffffff;
  min-height: 100vh;
}

.main-header {
  background: #ffffff;
  border-bottom: 1px solid #e1e3e5;
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #202223;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #6d7175;
}

/* Wallet Balance Component */
.wallet-balance {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #495057;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wallet-balance:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.wallet-icon {
  width: 16px;
  height: 16px;
  color: #28a745;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-amount {
  font-weight: 600;
  color: #28a745;
}

.wallet-amount.negative {
  color: #dc3545;
}

.wallet-amount.low {
  color: #ffc107;
}

.logout-btn {
  color: #5c6ac4;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background: #f6f6f7;
}

/* Store Selector */
.store-selector {
  background: #ffffff;
  border-bottom: 1px solid #e1e3e5;
  padding: 24px 32px;
}

.store-controls {
  display: flex;
  gap: 32px;
  align-items: end;
}

.store-select, .store-connect {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-select label, .store-connect label {
  font-size: 14px;
  font-weight: 500;
  color: #202223;
}

.store-select select {
  padding: 8px 12px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px;
}

.connect-inputs {
  display: flex;
  gap: 8px;
}

.connect-inputs input {
  padding: 8px 12px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  padding: 24px 32px;
  background: #f6f6f7;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: #202223;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  font-weight: 500;
  color: #6d7175;
  margin-bottom: 2px;
}

.stat-subtitle {
  font-size: 12px;
  color: #8c9196;
}

/* Orders Section */
.orders-section {
  padding: 24px 32px;
  background: #ffffff;
}

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

.orders-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #202223;
}

.orders-actions {
  display: flex;
  gap: 12px;
}

/* Orders Controls */
.orders-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 16px;
  background: #f6f6f7;
  border-radius: 8px;
  gap: 20px;
}

.filters-section {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  flex: 1;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 500;
  color: #202223;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 14px;
  min-width: 150px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.search-box {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-box input {
  padding: 8px 12px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 14px;
  min-width: 200px;
}

.bulk-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.bulk-actions label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #202223;
}

/* Table Container */
.table-container {
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.orders-table {
  width: 100%;
  min-width: 1400px;
  border-collapse: collapse;
  font-size: 14px;
}

.orders-table th {
  background: #f6f6f7;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #202223;
  border-bottom: 1px solid #e1e3e5;
  white-space: nowrap;
}

.orders-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f2f3;
  vertical-align: top;
}

.orders-table tr:hover {
  background: #f6f6f7;
}

.orders-table .order-row:hover {
  background: #e3f2fd !important;
  transition: background-color 0.2s ease;
}

.address-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #666;
}

.order-row {
  transition: all 0.2s ease;
}

.order-row:hover {
  background: #f0f9ff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.orders-table tr:last-child td {
  border-bottom: none;
}

/* Order Link */
.order-link {
  color: #5c6ac4;
  text-decoration: none;
  font-weight: 500;
}

.order-link:hover {
  text-decoration: underline;
}

/* Payment Badge */
.payment-badge {
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* Address Analysis Icons */
.address-analysis {
  display: flex;
  gap: 4px;
}

.analysis-icon {
  font-size: 12px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.analysis-icon.filled {
  color: #4caf50;
}

.analysis-icon.empty {
  color: #c9cccf;
}

/* Score Badge */
.score-badge {
  background: #e8f5e8;
  color: #2e7d32;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* Address Cell */
.address-cell {
  max-width: 200px;
  word-wrap: break-word;
  line-height: 1.4;
}

/* Status Badges */
.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.status-not-called {
  background: #f5f5f5;
  color: #6d7175;
}

.status-queued {
  background: #fff3e0;
  color: #f57c00;
}

.status-in-progress {
  background: #e3f2fd;
  color: #1976d2;
}

.status-completed {
  background: #e8f5e8;
  color: #2e7d32;
}

.status-failed {
  background: #ffebee;
  color: #d32f2f;
}

.status-cancelled {
  background: #fafafa;
  color: #9e9e9e;
}

.status-unknown {
  background: #f5f5f5;
  color: #6d7175;
}

/* Script Select */
.script-select {
  padding: 6px 8px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 12px;
  background: #ffffff;
}

/* Actions Dropdown */
.actions-dropdown {
  position: relative;
}

.action-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #6d7175;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.action-btn:hover {
  background: #f6f6f7;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 120px;
  z-index: 1000;
  display: none;
}

.dropdown-menu a {
  display: block;
  padding: 8px 12px;
  color: #202223;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s;
}

.dropdown-menu a:hover {
  background: #f6f6f7;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-top: 16px;
}

.pagination-info {
  font-size: 14px;
  color: #6d7175;
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

.pagination-btn {
  padding: 8px 12px;
  border: 1px solid #c9cccf;
  background: #ffffff;
  color: #202223;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background: #f6f6f7;
  border-color: #8c9196;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button Styles */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: #1e3a8a;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #6d7175;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #5a5d61;
  transform: translateY(-1px);
}

.btn-warning {
  background: #f59e0b;
  color: #ffffff;
}

.btn-warning:hover {
  background: #d97706;
  transform: translateY(-1px);
}

.btn-success {
  background: #10b981;
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  
  .store-controls {
    flex-direction: column;
    gap: 16px;
  }
  
  .filters-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    min-width: 200px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }
  
  .main-content {
    margin-left: 200px;
  }
  
  .main-header,
  .store-selector,
  .orders-section {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
  }
  
  .orders-controls {
    flex-direction: column;
    gap: 12px;
  }
  
  .filters-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    min-width: 100%;
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  .orders-table {
    min-width: 1400px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .app-layout {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Scripts Page Styles */
.scripts-section {
  padding: 24px 32px;
  background: #ffffff;
}

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

.scripts-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #202223;
}

.scripts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.scripts-column h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
}

.script-card {
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.script-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.script-card.default-script {
  border-color: #5c6ac4;
  background: #f8f9ff;
}

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

.script-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #202223;
}

.script-actions {
  display: flex;
  gap: 8px;
}

.default-badge {
  background: #5c6ac4;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.script-content {
  margin-bottom: 16px;
}

.script-content p {
  margin: 0;
  color: #6d7175;
  line-height: 1.5;
}

.script-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.script-date {
  font-size: 12px;
  color: #8c9196;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: #ffffff;
  border-radius: 8px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #6d7175;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #202223;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #202223;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #c9cccf;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* AI Calls Page Styles */
.ai-calls-section {
  padding: 24px 32px;
  background: #ffffff;
}

.ai-calls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.ai-calls-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #202223;
}

.ai-calls-actions {
  display: flex;
  gap: 12px;
}

.store-status-section {
  margin: 24px 0;
}

.store-status-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
}

.store-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.store-status-card {
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s ease;
}

.store-status-card.active {
  border-color: #4caf50;
  background: #f8fff8;
}

.store-status-card.inactive {
  border-color: #f44336;
  background: #fff8f8;
}

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

.store-name {
  font-size: 16px;
  font-weight: 600;
  color: #202223;
}

.status-badge.active {
  background: #4caf50;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.inactive {
  background: #f44336;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.store-status-actions {
  display: flex;
  gap: 8px;
}

.ai-calls-table-section {
  margin-top: 24px;
}

.ai-calls-table-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
}

/* Score Badge Styles */
.score-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.score-0 {
  background: #f5f5f5;
  color: #6d7175;
}

.score-1 {
  background: #ffebee;
  color: #d32f2f;
}

.score-2 {
  background: #fff3e0;
  color: #f57c00;
}

.score-3 {
  background: #fff8e1;
  color: #f57f17;
}

.score-4 {
  background: #e8f5e8;
  color: #2e7d32;
}

.score-5 {
  background: #e3f2fd;
  color: #1976d2;
}

/* Popup Modal Styles */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.popup-modal {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0 24px;
  border-bottom: 1px solid #e1e5e9;
  margin-bottom: 24px;
}

.popup-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #202223;
}

.popup-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6d7175;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.popup-close:hover {
  background: #f6f6f7;
  color: #202223;
}

.popup-content {
  padding: 0 24px 24px 24px;
}

.popup-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.popup-section {
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 20px;
  background: #fafbfc;
}

.popup-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item label {
  font-size: 12px;
  font-weight: 600;
  color: #6d7175;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item .value {
  font-size: 14px;
  font-weight: 500;
  color: #202223;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
}

.calls-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.calls-table th,
.calls-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e1e5e9;
}

.calls-table th {
  background: #f6f6f7;
  font-weight: 600;
  color: #202223;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calls-table td {
  font-size: 14px;
  color: #6d7175;
}

.audio-link {
  color: #5c6ac4;
  text-decoration: none;
  font-weight: 500;
}

.audio-link:hover {
  text-decoration: underline;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  font-size: 16px;
  color: #6d7175;
}

/* Professional Order Popup Styles */
.order-popup-container {
  max-width: 1000px;
  margin: 0 auto;
}

.popup-header-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px;
  border-radius: 12px 12px 0 0;
  margin-bottom: 24px;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: white;
}

.order-date {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
  display: block;
}

.order-status-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-status-badge.status-success {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.order-status-badge.status-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.order-status-badge.status-error {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.popup-main-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 0 24px 24px 24px;
}

.info-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.card-header {
  background: #f8fafc;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  font-size: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e7ff;
  border-radius: 8px;
  color: #4f46e5;
}

.card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  flex: 1;
}

.call-count {
  background: #e0e7ff;
  color: #4f46e5;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.card-content {
  padding: 20px;
}

.customer-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  min-width: 80px;
}

.detail-value {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  text-align: right;
  flex: 1;
  margin-left: 16px;
}

.address-value {
  text-align: left;
  font-weight: 500;
  line-height: 1.4;
}

.order-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.detail-item {
  text-align: center;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.detail-number {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.detail-label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.stat-item {
  text-align: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.stat-number.success {
  color: #059669;
}

.stat-number.failed {
  color: #dc2626;
}

.stat-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calls-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

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

.calls-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calls-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #6b7280;
}

.calls-table tr:last-child td {
  border-bottom: none;
}

.call-row:hover {
  background: #f9fafb;
}

.call-date-main {
  font-weight: 500;
  color: #374151;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-success {
  background: #dcfce7;
  color: #166534;
}

.status-badge.status-error {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.status-warning {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-info {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.status-cancelled {
  background: #f3f4f6;
  color: #374151;
}

.status-badge.status-unknown {
  background: #f3f4f6;
  color: #6b7280;
}

.outcome-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.outcome-badge.outcome-success {
  background: #dcfce7;
  color: #166534;
}

.outcome-badge.outcome-error {
  background: #fee2e2;
  color: #991b1b;
}

.outcome-badge.outcome-warning {
  background: #fef3c7;
  color: #92400e;
}

.outcome-badge.outcome-cancelled {
  background: #f3f4f6;
  color: #374151;
}

.outcome-badge.outcome-unknown {
  background: #f3f4f6;
  color: #6b7280;
}

.audio-link {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
}

.audio-link:hover {
  text-decoration: underline;
}

.no-calls {
  text-align: center;
  color: #9ca3af;
  font-style: italic;
  padding: 24px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .popup-main-content {
    grid-template-columns: 1fr;
    padding: 0 16px 16px 16px;
  }
  
  .order-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .order-title h1 {
    font-size: 24px;
  }
  
  .calls-table {
    font-size: 12px;
  }
  
  .calls-table th,
  .calls-table td {
    padding: 8px 12px;
  }
}

/* Audio Player Styles */
.audio-player {
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 16px;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.play-btn {
  background: #008060;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.play-btn:hover {
  background: #006b52;
}

/* Enhanced Popup Styles - Professional Design */
.popup-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.popup-header-summary {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 24px;
  border-radius: 12px 12px 0 0;
}

.order-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-main-info h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.order-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  opacity: 0.9;
}

.customer-name {
  font-weight: 600;
}

.order-status-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
}

/* Tab Navigation */
.popup-tabs {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tab-navigation {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9;
  padding: 0 24px;
}

.tab-btn {
  padding: 16px 24px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #6d7175;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #1e3a8a;
  background: #f1f3f4;
}

.tab-btn.active {
  color: #1e3a8a;
  border-bottom-color: #1e3a8a;
  background: white;
}

.tab-content {
  display: none;
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

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

/* Overview Tab */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.info-card {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
  background: #f8f9fa;
  padding: 16px 20px;
  border-bottom: 1px solid #e1e5e9;
}

.card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #202223;
}

.card-content {
  padding: 20px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f4;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  font-size: 14px;
  color: #6d7175;
  font-weight: 500;
}

.info-row .value {
  font-size: 14px;
  color: #202223;
  font-weight: 600;
}

.info-row .value.price {
  color: #10b981;
}

.info-row .value.score {
  color: #1e3a8a;
}

/* Enhanced Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 4px;
}

.stat-number.success {
  color: #10b981;
}

.stat-number.failed {
  color: #ef4444;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #6d7175;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Call History Tab */
.calls-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calls-header {
  background: #f8f9fa;
  padding: 20px;
  border-bottom: 1px solid #e1e5e9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calls-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.calls-count {
  font-size: 14px;
  color: #6d7175;
  font-weight: 500;
}

.calls-table-wrapper {
  overflow-x: auto;
}

/* Address Tab */
.address-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.address-header {
  background: #f8f9fa;
  padding: 20px;
  border-bottom: 1px solid #e1e5e9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.address-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.address-form {
  padding: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #6d7175;
}

/* Actions Tab */
.actions-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.actions-header {
  background: #f8f9fa;
  padding: 20px;
  border-bottom: 1px solid #e1e5e9;
}

.actions-header h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
}

.actions-header p {
  margin: 0;
  color: #6d7175;
  font-size: 14px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  padding: 20px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-btn.primary {
  border-color: #1e3a8a;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
}

.action-btn.warning {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: white;
}

.action-btn.success {
  border-color: #10b981;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
}

.action-btn.info {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: white;
}

.action-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.action-content h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
}

.action-content p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

/* Popup Footer */
.popup-footer {
  padding: 20px 24px;
  border-top: 1px solid #e1e5e9;
  background: #f8f9fa;
  display: flex;
  justify-content: flex-end;
}

/* Loading Spinner */
.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.loading-spinner {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #1e3a8a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced Popup Header */
.popup-header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.popup-title-section h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: #202223;
}

.popup-subtitle {
  margin: 0;
  color: #6d7175;
  font-size: 14px;
}

.popup-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Script Management Styles */
.scripts-section {
  padding: 24px;
}

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

.scripts-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #202223;
}

.scripts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.scripts-column h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
  padding-bottom: 8px;
  border-bottom: 2px solid #e1e5e9;
}

.script-card {
  background: white;
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.script-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.script-card.used {
  opacity: 0.7;
  background: #f8f9fa;
  border-color: #d1d5db;
}

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

.script-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #202223;
}

.script-actions {
  display: flex;
  gap: 8px;
}

.default-badge {
  background: #1e3a8a;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.used-badge {
  background: #10b981;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.script-content {
  margin-bottom: 16px;
}

.script-content p {
  margin: 0;
  color: #6d7175;
  font-size: 14px;
  line-height: 1.5;
}

.script-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.script-date {
  font-size: 12px;
  color: #6d7175;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e5e9;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #202223;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6d7175;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #f6f6f7;
  color: #202223;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #202223;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e1e5e9;
}

/* Retry Flow Chart Styles */
.retry-flow-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
  width: 100%;
}

.total-orders-header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.number-sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px 0;
}

.number-box {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px;
  text-align: center;
  height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.number-label {
  font-size: 10px;
  font-weight: 500;
  color: #666;
  margin-bottom: 4px;
}

.number-value {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.retry-tables-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
}

.retry-table-section {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 15px;
  align-items: start;
}

.retry-table {
  flex: 1;
  background: white;
  border: 1px solid #ddd;
  overflow: hidden;
  min-width: 0;
}

.retry-table-header {
  background: #f5f5f5;
  color: #333;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
}

.retry-table-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.retry-count-badge {
  background: #e5e5e5;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  color: #333;
}

.outcomes-panel {
  width: 180px;
  min-width: 180px;
  background: #f9f9f9;
  padding: 12px;
  border: 1px solid #ddd;
  margin-right: 15px;
}

.outcomes-title {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
  text-align: center;
}

.outcome-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #e5e5e5;
}

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

.outcome-label {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  flex: 1;
  margin-right: 8px;
}

.outcome-count {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  background: #e5e5e5;
  padding: 2px 8px;
  border-radius: 2px;
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.retry-table-content {
  max-height: 300px;
  overflow-y: auto;
}

.retry-table table {
  width: 100%;
  border-collapse: collapse;
}

.retry-table th,
.retry-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}

.retry-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.retry-table tr:hover {
  background: #f8fafc;
}

.retry-table tr:last-child td {
  border-bottom: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .popup-modal {
    width: 95%;
    max-height: 95vh;
  }
  
  .tab-navigation {
    flex-wrap: wrap;
  }
  
  .tab-btn {
    flex: 1;
    min-width: 120px;
  }
  
  .overview-grid {
    grid-template-columns: 1fr;
  }
  
  .actions-grid {
    grid-template-columns: 1fr;
  }
  
  .scripts-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .scripts-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
}

/* Bulk Orders Styles */
.bulk-orders-section {
  padding: 24px;
}

.upload-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.upload-header {
  text-align: center;
  margin-bottom: 32px;
}

.upload-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
  color: #202223;
}

.upload-header p {
  margin: 0;
  color: #6d7175;
  font-size: 16px;
}

.upload-area {
  border: 2px dashed #e1e5e9;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #1e3a8a;
  background: #f8fafc;
}

.upload-content svg {
  color: #6d7175;
  margin-bottom: 16px;
}

.upload-content h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #202223;
}

.upload-content p {
  margin: 0 0 24px 0;
  color: #6d7175;
  font-size: 14px;
}

.upload-info {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
}

.upload-info h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: #202223;
}

.upload-info ul {
  margin: 0;
  padding-left: 20px;
  color: #6d7175;
  font-size: 14px;
  line-height: 1.6;
}

.upload-info li {
  margin-bottom: 4px;
}

.orders-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.orders-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e5e9;
}

.orders-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #202223;
}

.bulk-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-select {
  padding: 8px 12px;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  min-width: 200px;
}

.form-select:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.table-container {
  overflow-x: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.orders-table th {
  background: #f8f9fa;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #202223;
  border-bottom: 1px solid #e1e5e9;
}

.orders-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
}

.orders-table tr:hover {
  background: #f8f9fa;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-queued {
  background: #dbeafe;
  color: #1e40af;
}

.status-in_progress {
  background: #fef3c7;
  color: #92400e;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Enhanced Call History Styles */
.calls-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.call-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: all 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;
}

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

.call-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  background: #f8fafc;
  cursor: pointer;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 12px;
}

.call-header:hover {
  background: #f1f5f9;
}

.call-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.call-info > div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.call-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-number {
  font-weight: 600;
  color: #1e3a8a;
  font-size: 14px;
}

.call-date {
  color: #64748b;
  font-size: 13px;
}

.call-duration {
  background: #e2e8f0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.call-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.call-actions .btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 6px 12px;
  white-space: nowrap;
}

.no-audio {
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
}

.call-details {
  padding: 16px;
  background: #fff;
  overflow: hidden;
}

.call-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-item label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.detail-item span {
  font-size: 14px;
  color: #1e293b;
}

.address-change {
  color: #059669;
  font-weight: 500;
}

.new-address {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: #166534;
}

/* Audio Player Styles - Fixed for card containment */
.audio-player {
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  padding: 16px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audio-player audio {
  flex: 1;
  min-width: 200px;
  max-width: 100%;
}

.audio-player .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.play-btn {
  background: #008060;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.play-btn:hover {
  background: #006b52;
}

/* Call actions container fixes */
.call-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
}

.call-actions .btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 6px 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Responsive fixes for call cards */
@media (max-width: 768px) {
  .call-header {
  flex-direction: column;
    align-items: stretch;
  }
  
  .call-info {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .call-actions {
    justify-content: flex-start;
    margin-top: 8px;
    flex-wrap: wrap;
  }
  
  .audio-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .audio-player {
    flex-direction: column;
    align-items: stretch;
  }
  
  .audio-player audio {
    width: 100%;
    min-width: auto;
  }
}
