/* Voice Agent Hub - ElevenLabs-Inspired Professional Design */

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

:root {
  /* ElevenLabs-inspired color palette - Clean, Light, Professional */
  --primary-color: #000000;
  --primary-accent: #0066ff;
  --secondary-color: #6366f1;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  
  /* Text colors - Dark on light */
  --text-primary: #000000;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  
  /* Background colors - Light theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-card: #ffffff;
  --bg-hover: #f9fafb;
  
  /* Border colors */
  --border-color: #e5e7eb;
  --border-light: #d1d5db;
  
  /* Shadows - Subtle and clean */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
  
  /* Gradients - ElevenLabs style with color */
  --gradient-primary: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #dbeafe 100%);
  --gradient-accent: linear-gradient(135deg, #0066ff 0%, #6366f1 50%, #8b5cf6 100%);
  --gradient-card: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  --gradient-hero: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 30%, #dbeafe 60%, #f0f9ff 100%);
  --gradient-section: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--gradient-section);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  flex: 1;
}

/* Header - ElevenLabs Style with Gradient */
.header {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  color: var(--text-primary);
  padding: 1.25rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.nav {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-primary);
  padding: 0.625rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 400;
  font-size: 0.9375rem;
  background: transparent;
  border: none;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 0;
  margin: 0;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
  .main-content {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
  }
  .session-data-card {
    padding: 1rem !important;
  }
  .dashboard-table-wrap {
    margin-left: -0.5rem !important;
    margin-right: -0.5rem !important;
  }
}

/* Buttons - ElevenLabs Style */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient-accent);
  color: var(--bg-primary);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: var(--success-color);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

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

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-tiny {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* Agent Cards Grid */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.agent-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.agent-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.1);
  border-color: rgba(0, 102, 255, 0.2);
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.agent-card:hover::before {
  transform: scaleX(1);
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--bg-tertiary);
}

.agent-card-header h3 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.badge {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border: none;
  box-shadow: 0 1px 3px rgba(30, 64, 175, 0.1);
}

.badge-green {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
  border: none;
  box-shadow: 0 1px 3px rgba(6, 95, 70, 0.1);
}

.badge-purple {
  background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%);
  color: #6b21a8;
  border: none;
  box-shadow: 0 1px 3px rgba(107, 33, 168, 0.1);
}

.badge-red {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #b91c1c;
  border: none;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.1);
}

.badge-orange {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  color: #c2410c;
  border: none;
  box-shadow: 0 1px 3px rgba(194, 65, 12, 0.1);
}

.agent-card-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.agent-purpose {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  min-height: 3em;
}

.agent-link-section {
  margin: 0.5rem 0;
}

.agent-link-section label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
}

.link-display {
  display: flex;
  gap: 0.5rem;
}

.link-input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.8125rem;
  background: var(--bg-secondary);
  transition: all 0.2s;
}

.link-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.link-input-small {
  width: 250px;
  padding: 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.75rem;
  background: var(--bg-secondary);
}

.agent-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bg-tertiary);
}

.agent-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Dashboard Link */
.dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.dashboard-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Forms */
.agent-form {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

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

.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.form-group {
  margin-bottom: 2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
  letter-spacing: -0.2px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
}

.form-group input[type="radio"] {
  width: auto;
  margin-right: 0.75rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  background: var(--bg-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-group .form-readonly-value {
  margin: 0;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-secondary, #f5f5f5);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

/* QR code next to agent link */
.qr-code-wrap {
  line-height: 0;
}
.qr-code-wrap canvas,
.qr-code-wrap img {
  display: block;
  border-radius: 8px;
}
.qr-code-wrap.qr-code-small canvas,
.qr-code-wrap.qr-code-small img {
  max-width: 64px;
  max-height: 64px;
}

.form-help {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--gradient-primary);
  border-left: 4px solid var(--primary-accent);
  border-radius: 10px;
  line-height: 1.7;
  border: 1px solid rgba(0, 102, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.05);
}

/* Wizard Progress - ElevenLabs with Gradient */
.wizard-progress {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding: 1.5rem 1rem 2.5rem 1rem;
  background: var(--gradient-primary);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 102, 255, 0.1);
  border: 1px solid rgba(0, 102, 255, 0.1);
  position: relative;
  overflow: visible;
  min-height: 120px;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.wizard-progress::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  z-index: 0;
  transform: translateY(-50%);
}

.progress-step {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 4.5rem;
  min-height: 100px;
  letter-spacing: 0.3px;
}

.progress-step::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  z-index: 1;
}

.progress-step::after {
  content: attr(data-step);
  position: absolute;
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.3s ease;
  z-index: 2;
}

.progress-step.active {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.progress-step.active::before {
  width: 60px;
  height: 60px;
  background: var(--bg-primary);
  border: 3px solid var(--primary-accent);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
  top: 5px;
}

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.1); }
}

.progress-step.active::after {
  width: 44px;
  height: 44px;
  background: var(--gradient-accent);
  color: var(--bg-primary);
  font-size: 1.125rem;
  font-weight: 600;
  top: 13px;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}


.progress-step.completed {
  color: var(--text-primary);
  font-weight: 700;
}

.progress-step.completed::before {
  background: var(--bg-primary);
  border-color: var(--success-color);
}

.progress-step.completed::after {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  content: '✓';
  font-size: 1.25rem;
  top: 13px;
  color: var(--bg-primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Connecting line overlay */
.wizard-progress::after {
  content: '';
  position: absolute;
  top: 35px;
  left: 8%;
  right: 8%;
  height: 3px;
  background: linear-gradient(90deg, 
    rgba(0, 102, 255, 0.2) 0%, 
    rgba(0, 102, 255, 0.4) 25%,
    rgba(0, 102, 255, 0.4) 75%,
    rgba(0, 102, 255, 0.2) 100%);
  z-index: 0;
  border-radius: 2px;
  pointer-events: none;
}

/* Schema Builder */
.schema-builder {
  margin: 1.5rem 0;
}

.schema-field {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  border: 2px solid var(--border-color);
  transition: all 0.2s;
}

.schema-field:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.field-row {
  display: grid;
  grid-template-columns: 2fr 1fr auto auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.code-preview {
  background: #1f2937;
  color: #f9fafb;
  padding: 1.5rem;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 0.875rem;
  font-family: 'Monaco', 'Courier New', monospace;
  margin-top: 1rem;
}

/* Test Call Container */
.test-call-container {
  border: 2px solid var(--primary-color);
  border-radius: 16px;
  padding: 2rem;
  margin: 1.5rem 0;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

/* Tables */
.agents-table {
  width: 100%;
  background: var(--bg-primary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.agents-table th,
.agents-table td {
  padding: 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--bg-tertiary);
}

.agents-table th {
  background: var(--bg-secondary);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agents-table tbody tr {
  transition: all 0.2s;
}

.agents-table tbody tr:hover {
  background: var(--bg-secondary);
}

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

/* Dashboard Tables */
.dashboard-table {
  width: 100%;
  background: var(--bg-primary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-top: 1.5rem;
}

.dashboard-table th,
.dashboard-table td {
  padding: 1.25rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--bg-tertiary);
}

.dashboard-table th {
  background: var(--bg-secondary);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.dashboard-table tbody tr:hover {
  background: var(--bg-secondary);
}

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

/* Session Data: Location column and mobile layout */
.dashboard-table .session-location-cell {
  font-size: 0.8125rem;
  word-break: break-all;
  max-width: 120px;
}

.dashboard-table .session-location-cell a {
  text-decoration: none;
  color: var(--color-accent, #667eea);
}

@media (max-width: 768px) {
  .dashboard-table th,
  .dashboard-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8125rem;
  }
  .dashboard-table .session-location-cell {
    max-width: 100px;
    font-size: 0.75rem;
  }
  .dashboard-table .session-user-cell {
    max-width: 140px;
    word-break: break-word;
    font-size: 0.8125rem;
  }
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.1);
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card h3 {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.5rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Workflow Options - Elegant Card Selection */
.workflow-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.workflow-option {
  position: relative;
  cursor: pointer;
  display: block;
}

.workflow-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.workflow-card {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.workflow-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.workflow-option:hover .workflow-card {
  border-color: rgba(0, 102, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.15);
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.workflow-option input[type="radio"]:checked + .workflow-card {
  border-color: var(--primary-accent);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.2);
}

.workflow-option input[type="radio"]:checked + .workflow-card::before {
  transform: scaleX(1);
}

.workflow-option input[type="radio"]:checked + .workflow-card .workflow-icon {
  transform: scale(1.1);
  background: var(--gradient-accent);
  color: var(--bg-primary);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.workflow-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.workflow-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.workflow-title {
  flex: 1;
}

.workflow-title strong {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  letter-spacing: -0.3px;
}

.workflow-description {
  margin-top: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.workflow-description p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin: 0;
}

/* Radio button indicator */
.workflow-option input[type="radio"]:checked + .workflow-card::after {
  content: '✓';
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: var(--gradient-accent);
  color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}

/* Step 1 single-page compact (no scrollbar) */
.step-1-single .form-help-compact {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}
.step-1-single .workflow-options-compact {
  margin: 1rem 0 1.25rem;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
  max-width: 100%;
}
.step-1-single .workflow-card-compact {
  padding: 1rem 1.25rem;
}
.step-1-single .workflow-card-compact .workflow-header {
  margin-bottom: 0.5rem;
}
.step-1-single .workflow-icon {
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}
.step-1-single .workflow-title strong {
  font-size: 1.05rem;
}
.step-1-single .workflow-description {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}
.step-1-single .workflow-description p {
  font-size: 0.875rem;
}
.step-1-single .step-navigation {
  margin-top: 1rem;
}
@media (max-width: 768px) {
  .step-1-single .workflow-options-compact {
    grid-template-columns: 1fr;
  }
}

/* Compact step layout: smaller headings and containers */
.agent-form .form-step h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.agent-form .form-help-compact {
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}
.agent-form .form-group-compact {
  margin-bottom: 1rem;
}
.agent-form .form-group-compact label {
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
}
.agent-form .form-group-compact input,
.agent-form .form-group-compact textarea,
.agent-form .form-group-compact select {
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
}
.agent-form .form-group-compact textarea {
  min-height: 80px;
}
.step-compact .step-navigation {
  margin-top: 1rem;
}
.recording-fields-block .recording-fields-heading {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #1e40af;
}

/* Create Agent page: smaller header, page title, steps container and text */
.page-create-agent .header .logo h1 {
  font-size: 1.15rem;
  font-weight: 600;
}
.page-create-agent .header .logo-icon {
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
}
.page-create-agent .page-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom-width: 1px;
}
.page-create-agent .page-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
}
.page-create-agent .page-header .btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
}
.page-create-agent .wizard-progress {
  margin-bottom: 1.5rem;
  padding: 0.75rem 0.5rem 1rem;
  min-height: 72px;
  border-radius: 10px;
}
.page-create-agent .wizard-progress::before {
  height: 3px;
}
.page-create-agent .wizard-progress::after {
  top: 28px;
  height: 2px;
}
.page-create-agent .progress-step {
  font-size: 0.8rem;
  font-weight: 600;
  padding-top: 3rem;
  min-height: 64px;
}
.page-create-agent .progress-step::before {
  width: 36px;
  height: 36px;
  top: 4px;
}
.page-create-agent .progress-step::after {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
  top: 10px;
}
.page-create-agent .progress-step.active {
  font-size: 0.9rem;
}
.page-create-agent .progress-step.active::before {
  width: 44px;
  height: 44px;
  top: 2px;
}
.page-create-agent .progress-step.active::after {
  width: 34px;
  height: 34px;
  font-size: 0.875rem;
  top: 8px;
}
.page-create-agent .progress-step.completed::after {
  font-size: 0.9rem;
  top: 10px;
}
.page-create-agent .agent-form .form-step h2 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}
.page-create-agent .agent-form .form-help-compact,
.page-create-agent .agent-form .form-help {
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
}
.page-create-agent .agent-form .form-group-compact {
  margin-bottom: 0.75rem;
}
.page-create-agent .agent-form .form-group-compact label {
  font-size: 0.8125rem;
}
.page-create-agent .agent-form .form-group-compact input,
.page-create-agent .agent-form .form-group-compact textarea,
.page-create-agent .agent-form .form-group-compact select {
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
}
.page-create-agent .agent-form .form-group-compact textarea {
  min-height: 64px;
}
.page-create-agent .step-navigation .btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
}
.page-create-agent .step-1-single .workflow-options-compact {
  margin: 0.75rem 0 1rem;
  gap: 0.75rem;
}
.page-create-agent .step-1-single .workflow-card-compact {
  padding: 0.75rem 1rem;
}
.page-create-agent .step-1-single .workflow-card-compact .workflow-header {
  margin-bottom: 0.35rem;
}
.page-create-agent .step-1-single .workflow-icon {
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
}
.page-create-agent .step-1-single .workflow-title strong {
  font-size: 0.95rem;
}
.page-create-agent .step-1-single .workflow-description p {
  font-size: 0.8125rem;
}
.page-create-agent .step-1-single .workflow-description {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
}

/* Step 2: shrink containers; one section visible (Live = purpose, Recording = messages) */
.page-create-agent #step-2.step-2-purpose {
  padding: 0.5rem 0;
  max-width: 720px;
}
.page-create-agent #step-2 .step-2-section {
  margin-top: 0;
}
.page-create-agent #step-2 .form-group-compact {
  margin-bottom: 0.6rem;
}
.page-create-agent #step-2 .form-group-compact textarea {
  min-height: 56px;
  padding: 0.35rem 0.5rem;
}
.page-create-agent #step-2 .recording-fields-block {
  margin-top: 0 !important;
  padding: 0.6rem !important;
  border-radius: 6px !important;
}
.page-create-agent #step-2 .recording-fields-block .form-group-compact {
  margin-bottom: 0.5rem;
}
.page-create-agent #step-2 .recording-fields-block .form-group-compact:last-of-type {
  margin-bottom: 0;
}
.page-create-agent #step-2 .recording-fields-heading {
  font-size: 0.9375rem;
  margin-bottom: 0.35rem;
}
.page-create-agent #step-2 .step-navigation {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
}

/* Step 2: Translate & Speak buttons at end of each field */
.field-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}
.field-actions .btn-tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}
.step-2-toolbar .step2-lang-select {
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
}

/* Step Navigation */
.step-navigation {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--bg-tertiary);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border-radius: 16px;
  border: 2px dashed var(--border-color);
}

.empty-state p {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

/* Footer - Elegant */
.footer {
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 2rem 0;
  text-align: center;
  margin-top: auto;
  font-size: 0.875rem;
  border-top: 1px solid var(--border-color);
}

.footer .container {
  padding: 0 2rem;
}

/* Agent Runtime - single viewport, no page scroll */
.agent-runtime-page {
  background: var(--gradient-section);
  height: 100vh;
  max-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  overflow: hidden;
}

.agent-container {
  background: white;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  max-width: 520px;
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.agent-header {
  text-align: center;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.agent-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.agent-purpose {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.agent-interface {
  text-align: center;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.audio-visualizer {
  flex-shrink: 0;
  margin: 0;
}

.visualizer-circle {
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-status {
  flex-shrink: 0;
  margin: 0;
}

.agent-status h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.agent-status p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.transcript-container {
  flex: 1;
  min-height: 0;
  margin: 0.5rem 0;
  max-height: 120px;
  overflow-y: auto;
  text-align: left;
  width: 100%;
}

.transcript {
  background: var(--bg-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
}

.transcript-item {
  margin-bottom: 0.35rem;
  padding: 0.25rem 0;
}

.transcript-user {
  color: var(--primary-color);
}

.transcript-agent {
  color: var(--success-color);
}

.recording-playback {
  flex-shrink: 0;
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--primary-accent);
  width: 100%;
}

.recording-playback h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.playback-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.playback-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.playback-controls .btn {
  min-width: 4.5rem;
}

.recording-audio-el {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  border-radius: 6px;
  height: 32px;
}

.language-step {
  flex-shrink: 0;
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  width: 100%;
}

.language-step h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.language-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.language-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-lang {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-lang:hover {
  background: var(--bg-hover);
  border-color: var(--primary-accent);
}

.btn-lang:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.15);
}

.agent-controls {
  flex-shrink: 0;
  margin-top: 0.5rem;
  width: 100%;
}

.agent-controls .btn-large {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
}

/* Error Page */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}

.error-container {
  text-align: center;
  background: var(--bg-primary);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.error-container h1 {
  font-size: 2rem;
  color: var(--danger-color);
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }

  .container {
    padding: 1rem;
  }

  .agents-grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .wizard-progress {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 2rem 0.5rem;
  }

  .progress-step {
    font-size: 0.85rem;
    padding: 0.5rem;
    padding-top: 3.5rem;
    min-height: 80px;
  }

  .progress-step.active {
    font-size: 1.1rem;
  }

  .progress-step::before {
    width: 40px !important;
    height: 40px !important;
    top: 5px !important;
  }

  .progress-step.active::before {
    width: 50px !important;
    height: 50px !important;
    top: 0px !important;
  }

  .progress-step::after {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.85rem !important;
    top: 12px !important;
  }

  .progress-step.active::after {
    width: 38px !important;
    height: 38px !important;
    font-size: 1rem !important;
    top: 6px !important;
  }

  .agent-form {
    padding: 1.5rem;
  }

  .workflow-options {
    grid-template-columns: 1fr;
  }

  .workflow-card {
    padding: 1.5rem;
  }
}

/* Loading States */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Breadcrumb Navigation */
.breadcrumb-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
}

.breadcrumb-item {
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
  border: 2px solid var(--border-color);
}

.breadcrumb-item:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.breadcrumb-item.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
