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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-elevated: #252525;
  --text: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #2e2e2e;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 600px; margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand span { color: var(--primary); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { color: var(--text-secondary); font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-elevated); }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
}
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { min-height: 120px; resize: vertical; }
.form-hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-title { font-size: 18px; font-weight: 600; }

/* Hero */
.hero {
  padding: 100px 0;
  text-align: center;
}
.hero h1 {
  font-size: 64px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
}
.hero p {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}
.hero-cta { display: flex; gap: 16px; justify-content: center; }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  padding: 80px 0;
}
.feature {
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.feature-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}
.feature h3 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.feature p { color: var(--text-secondary); }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}
.auth-header h1 { font-size: 28px; margin-bottom: 8px; }
.auth-header p { color: var(--text-secondary); }
.auth-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-secondary);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Dashboard */
.dashboard { padding: 40px 0; }
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.dashboard-header h1 { font-size: 32px; font-weight: 700; }
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.stat-card .value { font-size: 32px; font-weight: 700; }

/* Agent list */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
  cursor: pointer;
}
.agent-card:hover { border-color: var(--primary); }
.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.agent-name { font-size: 18px; font-weight: 600; }
.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.agent-status.active { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.agent-status.pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.agent-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.agent-stats {
  display: flex;
  gap: 24px;
  color: var(--text-secondary);
  font-size: 14px;
}
.agent-stats span { display: flex; align-items: center; gap: 6px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}
.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--bg-elevated);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 24px;
}
.empty-state h3 { font-size: 20px; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 24px; }

/* Wizard */
.wizard { padding: 40px 0; }
.wizard-header { text-align: center; margin-bottom: 48px; }
.wizard-header h1 { font-size: 36px; margin-bottom: 12px; }
.wizard-header p { color: var(--text-secondary); font-size: 18px; }
.wizard-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 48px;
}
.wizard-step {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
}
.wizard-step.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.wizard-step.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.wizard-step-line {
  width: 60px;
  height: 2px;
  background: var(--border);
  align-self: center;
}
.wizard-step-line.done { background: var(--success); }
.wizard-content { max-width: 600px; margin: 0 auto; }
.wizard-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Code block */
.code-block {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
}
.code-block code { color: var(--text-secondary); }

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
  z-index: 1000;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { font-size: 20px; font-weight: 600; }
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-elevated);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Boardroom */
.boardroom { display: flex; height: calc(100vh - 73px); overflow: hidden; }
.br-sidebar { width: 280px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.br-sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.br-sidebar-header h2 { font-size: 16px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.br-sidebar-header p { font-size: 12px; color: var(--text-muted); }
.br-agents { flex: 1; overflow-y: auto; padding: 8px; }
.br-agent { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s; border: 1px solid transparent; margin-bottom: 4px; }
.br-agent:hover { background: var(--bg-elevated); }
.br-agent.active { background: var(--bg-elevated); border-color: var(--primary); }
.br-agent.speaking { border-color: var(--success); box-shadow: 0 0 12px rgba(16,185,129,0.15); }
.br-agent-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; font-weight: 700; color: white; }
.br-agent-info { flex: 1; min-width: 0; }
.br-agent-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-agent-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.br-agent-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.br-agent-status.online { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.br-agent-status.offline { background: var(--text-muted); }

.br-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.br-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-card); }
.br-header h1 { font-size: 18px; font-weight: 700; }
.br-loop-indicator { display: flex; gap: 6px; align-items: center; }
.br-loop-step { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; background: var(--bg-elevated); color: var(--text-muted); transition: all 0.3s; }
.br-loop-step.active { background: var(--primary); color: white; }
.br-loop-step.done { background: var(--success); color: white; }

.br-chat { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.br-msg { display: flex; gap: 12px; max-width: 85%; animation: brFadeIn 0.3s ease; }
.br-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.br-msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0; }
.br-msg-body { display: flex; flex-direction: column; gap: 4px; }
.br-msg-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.br-msg-meta .agent-tag { padding: 2px 6px; border-radius: 4px; font-weight: 600; font-size: 10px; }
.br-msg-content { padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.6; }
.br-msg.user .br-msg-content { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.br-msg.agent .br-msg-content { background: var(--bg-elevated); color: var(--text); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.br-msg.system .br-msg-content { background: transparent; color: var(--text-muted); font-size: 12px; text-align: center; font-style: italic; padding: 8px; }
.br-msg.system { align-self: center; max-width: 100%; }
.br-msg-content strong { font-weight: 600; }
.br-msg-content code { background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 13px; }
.br-msg-content ul, .br-msg-content ol { margin: 8px 0; padding-left: 20px; }
.br-msg-content li { margin: 4px 0; }
.br-msg-action { margin-top: 8px; padding: 10px 14px; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); border-radius: var(--radius-sm); font-size: 13px; }
.br-msg-action .action-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--success); font-weight: 700; margin-bottom: 4px; }
.br-msg-handoff { margin-top: 8px; padding: 8px 12px; background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.3); border-radius: var(--radius-sm); font-size: 12px; color: var(--primary-light); }

.br-input-area { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg-card); display: flex; gap: 12px; align-items: flex-end; }
.br-input-area textarea { flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: 16px; font-size: 14px; outline: none; background: var(--bg); color: var(--text); font-family: inherit; resize: none; min-height: 44px; max-height: 120px; line-height: 1.5; }
.br-input-area textarea:focus { border-color: var(--primary); }
.br-input-area button { padding: 12px 20px; background: var(--primary); color: white; border: none; border-radius: 16px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background 0.15s; }
.br-input-area button:hover { background: var(--primary-dark); }
.br-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }

.br-typing { display: flex; gap: 4px; padding: 12px 16px; background: var(--bg-elevated); border-radius: 16px; border-bottom-left-radius: 4px; align-self: flex-start; border: 1px solid var(--border); }
.br-typing span { width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%; animation: brBounce 1.4s infinite ease-in-out; }
.br-typing span:nth-child(2) { animation-delay: 0.16s; }
.br-typing span:nth-child(3) { animation-delay: 0.32s; }

.br-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 16px; color: var(--text-muted); }
.br-empty-icon { font-size: 48px; opacity: 0.5; }
.br-empty h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.br-empty p { font-size: 14px; max-width: 400px; text-align: center; }

.br-confirm { display: flex; gap: 8px; margin-top: 8px; }
.br-confirm button { padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; }
.br-confirm .approve { background: var(--success); color: white; }
.br-confirm .deny { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }

@keyframes brFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes brBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* Hamburger button */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 10;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .hamburger span:nth-child(2) { opacity: 0; }
.nav-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Responsive — 1024px (tablets) */
@media (max-width: 1024px) {
  .hero h1 { font-size: 52px; }
  .hero { padding: 72px 0; }
  .features { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .agents-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* Responsive — 768px (small tablets / large phones) */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav { flex-wrap: wrap; }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding: 12px 0 4px;
  }
  .nav-links a {
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }
  .nav-open .nav-links { display: flex; }
  .hero h1 { font-size: 40px; }
  .hero p { font-size: 17px; }
  .hero { padding: 60px 0; }
  .hero-cta { flex-direction: column; align-items: center; }
  .features { grid-template-columns: 1fr; gap: 16px; padding: 48px 0; }
  .dashboard-header { flex-direction: column; gap: 16px; align-items: stretch; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .agents-grid { grid-template-columns: 1fr; }
  .br-sidebar { width: 220px; }
  .wizard-header h1 { font-size: 28px; }
  .stat-card .value { font-size: 26px; }
}

/* Responsive — 480px (small phones) */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 15px; max-width: 100%; }
  .hero { padding: 40px 0; }
  .hero-cta .btn-lg { padding: 14px 24px; font-size: 15px; }
  .btn-lg { padding: 14px 24px; font-size: 15px; }
  .feature { padding: 20px; }
  .feature h3 { font-size: 17px; }
  .feature p { font-size: 14px; }
  .card { padding: 16px; }
  .dashboard-header h1 { font-size: 24px; }
  .dashboard-stats { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 24px; }
  .wizard-header h1 { font-size: 24px; }
  .wizard-header p { font-size: 15px; }
  .wizard-steps { gap: 4px; }
  .wizard-step { width: 32px; height: 32px; font-size: 13px; }
  .wizard-step-line { width: 32px; }
  .auth-header h1 { font-size: 24px; }
  .auth-page { padding: 20px 12px; }
  .auth-card { max-width: 100%; }
  .nav-brand { font-size: 13px; flex-wrap: wrap; gap: 4px; }
  .nav-brand span[style*="margin-left"] { display: none; }
  .br-sidebar { display: none; }
  .br-header h1 { font-size: 15px; }
  .br-input-area { padding: 12px 16px; }
  .modal { max-width: calc(100vw - 32px); }
  .code-block { font-size: 11px; padding: 12px; }
}
