/* ═══════════════════════════════════════════════════════════
   Home Credit LAP Voice Agent — Design System
   ═══════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Brand Colors */
  --brand-primary: #6366f1;
  --brand-primary-light: #818cf8;
  --brand-primary-dark: #4f46e5;
  --brand-accent: #06b6d4;
  --brand-accent-light: #22d3ee;

  /* Semantic Colors */
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-success-bg: rgba(16, 185, 129, 0.08);
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-warning-bg: rgba(245, 158, 11, 0.08);
  --color-error: #ef4444;
  --color-error-light: #fee2e2;
  --color-error-bg: rgba(239, 68, 68, 0.08);
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;
  --color-info-bg: rgba(59, 130, 246, 0.08);

  /* Surface Colors */
  --bg-primary: #0f0f1a;
  --bg-secondary: #161625;
  --bg-tertiary: #1e1e32;
  --bg-card: rgba(30, 30, 50, 0.7);
  --bg-card-hover: rgba(40, 40, 65, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);

  /* Text Colors */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;
  --text-inverse: #0f172a;

  /* Border Colors */
  --border-primary: rgba(255, 255, 255, 0.06);
  --border-secondary: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-success: rgba(16, 185, 129, 0.3);
  --border-error: rgba(239, 68, 68, 0.3);

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #0c1220 100%);
  --gradient-card: linear-gradient(145deg, rgba(99, 102, 241, 0.05) 0%, rgba(6, 182, 212, 0.03) 100%);
  --gradient-success: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.02));
  --gradient-error: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.02));

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
  --shadow-glow-success: 0 0 20px rgba(16, 185, 129, 0.2);
  --shadow-glow-error: 0 0 20px rgba(239, 68, 68, 0.2);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background Ambience ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 15% 10%, rgba(99, 102, 241, 0.08), transparent),
    radial-gradient(ellipse 500px 350px at 85% 80%, rgba(6, 182, 212, 0.06), transparent),
    radial-gradient(ellipse 800px 600px at 50% 50%, rgba(99, 102, 241, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border-primary);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  max-width: 1280px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.logo-text span {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  gap: var(--space-xs);
  list-style: none;
}

.nav-tab {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  background: transparent;
  position: relative;
}

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

.nav-tab.active {
  color: var(--brand-primary-light);
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.15);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--brand-primary);
  border-radius: 2px;
}

/* ── Main Content ── */
.main {
  flex: 1;
  padding: var(--space-xl) 0;
}

/* ── Page / Tab Panel ── */
.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* ── Hero Section ── */
.hero {
  text-align: center;
  padding: var(--space-3xl) 0 var(--space-2xl);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-primary-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
}

.hero h1 .gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-xl);
  line-height: 1.7;
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  transition: all var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Chat Simulator ── */
.simulator-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-lg);
  align-items: start;
}

.chat-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 620px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-primary);
  background: rgba(99, 102, 241, 0.03);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  font-weight: 700;
}

.chat-header-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.chat-header-info span {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.chat-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.chat-status-badge.active {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--border-success);
}

.chat-status-badge.ended {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid var(--border-error);
}

.chat-status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chat-status-badge.active .dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 10px;
}

/* Message bubbles */
.message {
  display: flex;
  gap: var(--space-sm);
  max-width: 85%;
  animation: messageIn 0.3s var(--transition-spring);
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.agent {
  align-self: flex-start;
}

.message.customer {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

.message.agent .message-avatar {
  background: var(--gradient-brand);
  color: white;
}

.message.customer .message-avatar {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.message-bubble {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.6;
  position: relative;
}

.message.agent .message-bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message.customer .message-bubble {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
}

.message-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 2px;
}

.message.customer .message-time {
  text-align: right;
}

/* System messages */
.system-message {
  text-align: center;
  padding: var(--space-sm);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.system-message.disqualified {
  color: var(--color-error);
  background: var(--color-error-bg);
  border-radius: var(--radius-md);
  font-style: normal;
  font-weight: 500;
}

.system-message.qualified {
  color: var(--color-success);
  background: var(--color-success-bg);
  border-radius: var(--radius-md);
  font-style: normal;
  font-weight: 500;
}

.system-message.transfer {
  color: var(--color-warning);
  background: var(--color-warning-bg);
  border-radius: var(--radius-md);
  font-style: normal;
  font-weight: 500;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  align-self: flex-start;
}

.typing-indicator .dots {
  display: flex;
  gap: 4px;
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Chat input */
.chat-input-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-primary);
  background: rgba(15, 15, 26, 0.5);
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.chat-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-brand);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 16px;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Side Panel (State) ── */
.state-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.state-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-primary);
  background: rgba(99, 102, 241, 0.03);
}

.state-panel-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.state-panel-body {
  padding: var(--space-md) var(--space-lg);
}

/* State items */
.state-group {
  margin-bottom: var(--space-lg);
}

.state-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-primary);
}

.state-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.82rem;
}

.state-item-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.state-item-value {
  font-weight: 600;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.state-item-value.unknown {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.state-item-value.captured {
  color: var(--color-success);
  background: var(--color-success-bg);
}

.state-item-value.failed {
  color: var(--color-error);
  background: var(--color-error-bg);
}

.state-item-value.warning {
  color: var(--color-warning);
  background: var(--color-warning-bg);
}

/* Progress bar */
.progress-container {
  margin-bottom: var(--space-lg);
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.progress-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  min-width: 0;
}

/* Reset button */
.reset-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-secondary);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.reset-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--border-error);
  color: var(--color-error);
}

/* ── System Prompt Tab ── */
.prompt-container {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-primary);
  background: rgba(99, 102, 241, 0.03);
}

.prompt-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-secondary);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--brand-primary-light);
}

.copy-btn.copied {
  background: var(--color-success-bg);
  border-color: var(--border-success);
  color: var(--color-success);
}

.prompt-content {
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 70vh;
  overflow-y: auto;
}

.prompt-content::-webkit-scrollbar {
  width: 6px;
}

.prompt-content::-webkit-scrollbar-track {
  background: transparent;
}

.prompt-content::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 10px;
}

.prompt-section-header {
  color: var(--brand-primary-light);
  font-weight: 600;
  display: block;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

/* ── Test Scenarios Tab ── */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-md);
}

.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.scenario-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.scenario-card:hover {
  border-color: var(--border-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.scenario-card:hover::before {
  opacity: 1;
}

.scenario-card.running {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-glow);
}

.scenario-card.passed {
  border-color: var(--border-success);
}

.scenario-card.passed::before {
  opacity: 1;
  background: var(--color-success);
}

.scenario-card.failed {
  border-color: var(--border-error);
}

.scenario-card.failed::before {
  opacity: 1;
  background: var(--color-error);
}

.scenario-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.scenario-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-primary-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scenario-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.scenario-badge.expected-pass {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.scenario-badge.expected-fail {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.scenario-badge.expected-transfer {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.scenario-badge.expected-callback {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.scenario-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.scenario-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.scenario-expected {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border-secondary);
}

.scenario-result {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.scenario-result.pass {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--border-success);
}

.scenario-result.fail {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid var(--border-error);
}

/* Run All Button */
.run-all-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-brand);
  color: white;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-xl);
}

.run-all-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.run-all-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Architecture Tab ── */
.arch-content {
  display: grid;
  gap: var(--space-lg);
}

.arch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.arch-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.arch-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.arch-card pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

.decision-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: var(--space-md);
}

.decision-table th {
  text-align: left;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.06);
  border-bottom: 1px solid var(--border-secondary);
  color: var(--brand-primary-light);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.decision-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-secondary);
}

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

.eligible-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.eligible-tag.yes {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.eligible-tag.no {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.eligible-tag.conditional {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* ── Quick Scenario Buttons ── */
.quick-scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-primary);
  background: rgba(15, 15, 26, 0.3);
}

.quick-scenario-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-primary);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.quick-scenario-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--brand-primary-light);
}

/* ── Footer ── */
.footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-primary);
  text-align: center;
}

.footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .simulator-container {
    grid-template-columns: 1fr;
  }

  .state-panel {
    order: -1;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: var(--space-md);
  }

  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-panel {
    height: 500px;
  }

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

  .container {
    padding: 0 var(--space-md);
  }
}

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

  .nav-tab {
    padding: var(--space-sm) 10px;
    font-size: 0.8rem;
  }
}

/* ── Focus / Accessibility ── */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Tooltip ── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
