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

:root {
  --primary: #0066ff;
  --primary-dark: #0052cc;
  --primary-light: #e6f0ff;
  --secondary: #6b7280;
  --success: #10b981;
  --success-light: #d1fae5;
  --error: #ef4444;
  --error-light: #fee2e2;
  --background: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header {
  padding: 1.5rem 0;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
}

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  margin: 2rem 0;
  color: white;
  text-align: center;
}

.hero h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero > .hero-content > p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.feature {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.feature-icon svg {
  width: 24px;
  height: 24px;
}

.feature h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.feature p {
  font-size: 0.9rem;
  opacity: 0.8;
}

.demo-business {
  margin: 2rem 0;
}

.demo-business h2 {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-align: center;
}

.business-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.business-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.business-avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.business-info h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.business-category {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.business-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: var(--text-secondary);
}

.detail-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}

.business-number {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.business-number p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.phone-number {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  font-family: 'SF Mono', Monaco, monospace;
}

.webhook-info {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  border: 1px solid var(--border);
  text-align: center;
}

.webhook-info h2 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.webhook-info.disabled {
  background: #fef3c7;
  border-color: #f59e0b;
}

.webhook-info.disabled h2 {
  color: #92400e;
}

.webhook-info.disabled p {
  color: #78350f;
}

.webhook-card {
  background: var(--background);
  border-radius: var(--radius);
  padding: 1rem;
}

.webhook-url {
  display: block;
  background: var(--text-primary);
  color: #10b981;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  word-break: break-all;
}

.webhook-method {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cta-section {
  text-align: center;
  margin: 2rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-full {
  width: 100%;
}

.footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.dashboard .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.dashboard .header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--primary);
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.business-name {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}

.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
}

.alert-error {
  background: var(--error-light);
  color: #991b1b;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.profile-form {
  padding: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

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

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group textarea,
.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.stats-panel .panel-header + div {
  padding: 1.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1.25rem;
}

.stat-card {
  text-align: center;
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.webhook-mini {
  padding: 0 1.25rem 1.25rem;
}

.webhook-mini p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.webhook-mini code {
  display: block;
  background: var(--text-primary);
  color: #10b981;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  word-break: break-all;
}

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

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

.calls-table th,
.calls-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.calls-table th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--background);
}

.calls-table tbody tr:hover {
  background: var(--background);
}

.cell-date .date {
  display: block;
  font-weight: 500;
}

.cell-date .time {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cell-from {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.9rem;
}

.cell-speech {
  max-width: 300px;
  color: var(--text-secondary);
  font-style: italic;
}

.cell-speech .empty {
  color: var(--text-muted);
  font-style: normal;
}

.cell-confidence {
  min-width: 100px;
}

.confidence-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

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

.confidence-value {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cell-intent {
  min-width: 80px;
}

.intent-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.intent-hours,
.intent-HOURS {
  background: #dbeafe;
  color: #1e40af;
}

.intent-address,
.intent-ADDRESS {
  background: #dcfce7;
  color: #166534;
}

.intent-price,
.intent-PRICE {
  background: #fef3c7;
  color: #92400e;
}

.intent-other,
.intent-OTHER {
  background: #f3e8ff;
  color: #6b21a8;
}

.intent-human,
.intent-HUMAN {
  background: #fce7f3;
  color: #be185d;
}

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

.cell-response {
  max-width: 200px;
}

.response-text {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.password-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.password-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.password-header {
  margin-bottom: 1.5rem;
}

.lock-icon {
  width: 48px;
  height: 48px;
  color: var(--primary);
  margin-bottom: 1rem;
}

.password-header h1 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.password-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.password-form {
  text-align: left;
}

.password-form .form-group {
  margin-bottom: 1.5rem;
}

.back-home {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-home:hover {
  color: var(--primary);
}

@media (max-width: 640px) {
  .hero {
    padding: 2rem 1rem;
  }
  
  .hero h2 {
    font-size: 1.5rem;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
  
  .dashboard .header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .header-left,
  .header-right {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  
  .calls-table {
    font-size: 0.85rem;
  }
  
  .calls-table th,
  .calls-table td {
    padding: 0.625rem 0.5rem;
  }
  
  .cell-speech {
    max-width: 150px;
  }
}

.landing .hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
}

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

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--background);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

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

.auth-header h1 {
  font-size: 1.5rem;
  margin: 0;
}

.auth-header .back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--background);
  color: var(--text-secondary);
  text-decoration: none;
}

.auth-header .back-link:hover {
  background: var(--border);
}

.auth-header .back-link svg {
  width: 18px;
  height: 18px;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.btn-block {
  display: block;
  width: 100%;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.alert-error {
  background: var(--error-light);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.alert-error svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.onboarding-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--background);
}

.onboarding-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 600px;
}

.onboarding-header {
  text-align: center;
  margin-bottom: 2rem;
}

.onboarding-header h1 {
  margin-bottom: 1.5rem;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.step.active {
  background: var(--primary);
  color: white;
}

.step.done {
  background: var(--success);
  color: white;
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
}

.onboarding-form h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.form-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.upload-info {
  margin-bottom: 1.5rem;
}

.info-card {
  background: var(--background);
  border-radius: var(--radius);
  padding: 1rem;
}

.info-card h4 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.info-card ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.info-card li {
  margin-bottom: 0.25rem;
}

.pending-notice {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pending-notice svg {
  width: 24px;
  height: 24px;
  color: #d97706;
  flex-shrink: 0;
}

.pending-notice p {
  margin: 0;
  font-size: 0.875rem;
  color: #92400e;
}

.admin-page {
  padding: 2rem 1rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-header h1 {
  margin: 0;
}

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

.admin-table th,
.admin-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--background);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-active {
  background: var(--success-light);
  color: #166534;
}

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

.status-suspended {
  background: var(--error-light);
  color: var(--error);
}

.inline-form {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.small-input {
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 140px;
}

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

.btn-success {
  background: var(--success);
  color: white;
  border: none;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--error);
  color: white;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
}

.actions-cell {
  white-space: nowrap;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.stats-summary .stat-card {
  text-align: center;
}

@media (max-width: 768px) {
  .stats-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

.onboarding-complete-notice {
  background: var(--success-light);
  color: #166534;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.onboarding-complete-notice svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.twilio-info {
  padding: 1rem;
  background: var(--background);
  border-radius: var(--radius);
  margin-top: 1rem;
}

.twilio-info p {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
}

.twilio-info code {
  display: block;
  font-size: 0.9rem;
}

.text-muted {
  color: var(--text-secondary);
  font-style: italic;
}
