/* ClawHub Dashboard — Discord-like dark theme */

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

:root {
  --bg: #1a1a2e;
  --bg-dark: #151525;
  --bg-darker: #12121f;
  --surface: #1e1e35;
  --surface-2: #252542;
  --surface-3: #2a2a4a;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --text: #e8e8f0;
  --text-muted: #9898b0;
  --text-dim: #686888;
  --accent: #a78bfa;
  --accent-dim: #7c3aed;
  --accent-glow: rgba(167, 139, 250, 0.15);
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.12);
  --orange: #fb923c;
  --orange-dim: rgba(251, 146, 60, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --pink: #f472b6;
  --cyan: #22d3ee;
  --yellow: #facc15;
  --radius: 12px;
  --radius-sm: 8px;
}

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

/* ─── Login screen ─────────────────────────────────────────────────────────── */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-darker);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-logo span { color: var(--text); }

.login-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

.login-card label {
  display: block;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-card input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.2s;
}

.login-card input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 16px;
}

.login-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.login-message.success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.login-message.error {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent-dim);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.btn-primary:hover { background: #6d28d9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-secondary:hover { background: var(--surface-3); }

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

.btn-green { background: #16a34a; }
.btn-green:hover { background: #15803d; }

.btn-red {
  background: var(--surface-2);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}
.btn-red:hover { background: var(--red-dim); }

/* ─── App layout ───────────────────────────────────────────────────────────── */

.app-layout {
  display: none;
  flex-direction: column;
  height: 100vh;
}

.app-layout.active {
  display: flex;
}

/* Top bar */
.topbar {
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.topbar-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

.topbar-logo span { color: var(--text); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-business {
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-plan {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--accent-glow);
  color: var(--accent);
  text-transform: capitalize;
}

.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.topbar-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* App body: 3-column */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Left sidebar ─────────────────────────────────────────────────────────── */

.sidebar {
  width: 240px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px 0;
}

.sidebar-section { margin-bottom: 8px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 8px 16px 4px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.channel-item:hover { background: rgba(255, 255, 255, 0.03); }

.channel-item.active {
  background: var(--accent-glow);
  color: var(--text);
}

.channel-item-hash {
  color: var(--text-dim);
  font-weight: 500;
  flex-shrink: 0;
}

.channel-item-name { flex: 1; }

.channel-item-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--red);
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.agent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.agent-dot.offline { background: var(--text-dim); }

.agent-item-name { font-weight: 500; }
.agent-item-role { color: var(--text-dim); font-size: 11px; }

/* ─── Main panel ───────────────────────────────────────────────────────────── */

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.channel-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg);
}

.channel-hash {
  color: var(--text-dim);
  font-size: 18px;
  font-weight: 500;
}

.channel-name {
  font-size: 15px;
  font-weight: 600;
}

.channel-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 8px;
}

/* Message feed */
.message-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scroll-behavior: smooth;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* Message bubbles */
.message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 4px 0;
  animation: msgSlideIn 0.3s ease;
}

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

.message:hover { background: rgba(255, 255, 255, 0.01); border-radius: 8px; }

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: white;
}

.msg-avatar.user { background: var(--accent-dim); }
.msg-avatar.sam { background: var(--blue); }
.msg-avatar.maya { background: var(--pink); }
.msg-avatar.iris { background: var(--accent); }
.msg-avatar.felix { background: var(--green); }
.msg-avatar.nora { background: var(--orange); }
.msg-avatar.rex { background: var(--cyan); }
.msg-avatar.dash { background: var(--yellow); color: #333; }

.msg-body { flex: 1; min-width: 0; }

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.msg-name { font-size: 13px; font-weight: 600; }
.msg-role { font-size: 11px; color: var(--text-dim); }
.msg-time { font-size: 11px; color: var(--text-dim); margin-left: auto; }

/* Conversational messages */
.msg-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  word-break: break-word;
}

.msg-text strong { color: var(--text); font-weight: 600; }

.msg-text .msg-heading {
  display: block;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  margin-top: 8px;
  margin-bottom: 2px;
}

.msg-text .msg-heading-lg { font-size: 15px; }

.msg-text .msg-list-item {
  display: block;
  padding-left: 16px;
  position: relative;
}

.msg-text .msg-list-bullet::before {
  content: '\2022';
  position: absolute;
  left: 4px;
  color: var(--accent);
}

.msg-text .msg-list-num { color: var(--accent); font-weight: 600; }

.msg-text .msg-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.msg-text .msg-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.msg-text .msg-table td {
  padding: 6px 12px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

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

.msg-text .msg-table td strong {
  color: var(--text);
}

/* Draft messages */
.message-draft {
  background: rgba(167, 139, 250, 0.04);
  border-radius: 8px;
  padding: 4px 8px;
}

.msg-draft-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 6px;
}

.msg-draft {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.msg-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 8px;
  display: inline-block;
}

.msg-status.approved { background: var(--green-dim); color: var(--green); }
.msg-status.rejected { background: var(--red-dim); color: var(--red); }
.msg-status.edited { background: var(--blue-dim); color: var(--blue); }

/* Approvals view */
.approvals-header {
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.approvals-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.approval-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.approval-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.approval-agent { font-size: 13px; font-weight: 600; }

.approval-channel {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

.approval-prompt {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 8px;
}

/* Message input */
.message-input-area {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.message-input-row {
  display: flex;
  gap: 8px;
}

#message-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

#message-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

#message-input::placeholder { color: var(--text-dim); }

.send-btn {
  background: var(--accent-dim);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.send-btn:hover { background: #6d28d9; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Right panel ──────────────────────────────────────────────────────────── */

.right-panel {
  width: 260px;
  background: var(--bg-dark);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 16px;
}

.panel-section { margin-bottom: 20px; }

.ai-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
}

.ai-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: aiPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes aiPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

.panel-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.panel-stat {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.panel-stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 13px; font-weight: 700; color: var(--accent); }

/* Pending list in right panel */
.pending-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.pending-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.pending-item-agent {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.pending-item-time {
  font-size: 10px;
  color: var(--text-dim);
}

.pending-item-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-item-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

/* ─── Modals ───────────────────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; }

.modal-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Form elements in modals */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
}

.modal textarea:focus {
  border-color: var(--accent);
}

.settings-saved {
  padding: 10px 14px;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
}

/* ─── Add App Modal ────────────────────────────────────────────────────────── */

.modal-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 12px;
  color: var(--text);
}
.modal-label:first-of-type { margin-top: 0; }

.modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
}
.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ─── Custom Apps ──────────────────────────────────────────────────────────── */

.app-iframe {
  width: 100%;
  height: calc(100vh - 120px);
  border: none;
  border-radius: 8px;
  background: var(--surface);
}

.app-remove-btn {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0 4px;
}
.tool-item:hover .app-remove-btn { opacity: 1; }
.app-remove-btn:hover { color: #f87171; }

.add-app-btn { border-top: 1px solid var(--border-dim); margin-top: 4px; padding-top: 8px; }

/* ─── Loading ──────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-bar {
  height: 2px;
  background: var(--accent);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 300;
  animation: loading 1.5s ease-in-out infinite;
  display: none;
}

.loading-bar.active { display: block; }

@keyframes loading {
  0% { width: 0; }
  50% { width: 60%; }
  100% { width: 100%; opacity: 0; }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-dim);
}

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

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing 1.2s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ─── Welcome screen (HQ empty state) ─────────────────────────────────────── */

.welcome-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 36px 20px;
}

.welcome-hero {
  text-align: center;
  margin-bottom: 32px;
}

.welcome-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.welcome-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}

.welcome-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

.welcome-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.welcome-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.welcome-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.welcome-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.welcome-card-agent {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.welcome-card-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.welcome-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.welcome-card-prompt {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.5;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.welcome-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 20px;
}

/* ─── Agent empty state ───────────────────────────────────────────────────── */

.agent-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px 40px;
}

.agent-empty-name {
  font-size: 20px;
  font-weight: 800;
  margin-top: 12px;
}

.agent-empty-role {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.agent-empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 20px;
}

.agent-empty-try {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 500px;
}

.suggestion-chip {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-2);
}

/* ─── Onboarding screen ───────────────────────────────────────────────────── */

.onboarding-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg-darker);
}

.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 44px;
  width: 100%;
  max-width: 580px;
  text-align: center;
}

.onboard-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 20px 0 10px;
  line-height: 1.3;
}

.onboard-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

.onboard-input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.2s;
}

.onboard-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.onboard-input::placeholder { color: var(--text-dim); }

.onboard-continue-btn {
  width: 100%;
  margin-top: 16px;
  padding: 13px 24px;
  font-size: 15px;
}

/* Research animation */
.research-progress {
  width: 100%;
  height: 3px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 28px;
}

.research-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.research-lines {
  text-align: left;
  min-height: 200px;
}

.research-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  opacity: 0;
  transform: translateY(8px);
  animation: researchFadeIn 0.4s ease forwards;
}

.research-line-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  margin-top: 1px;
}

.research-line-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.research-line-text.highlight {
  color: var(--text);
  font-weight: 600;
}

.research-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.6s step-end infinite;
}

@keyframes researchFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Team reveal */
.onboard-industry-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.onboard-industry-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.onboard-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  display: none;
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 28px;
  text-align: left;
}

.team-grid-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(6px);
  animation: teamCardIn 0.3s ease forwards;
}

.team-grid-item:nth-child(1) { animation-delay: 0.05s; }
.team-grid-item:nth-child(2) { animation-delay: 0.1s; }
.team-grid-item:nth-child(3) { animation-delay: 0.15s; }
.team-grid-item:nth-child(4) { animation-delay: 0.2s; }
.team-grid-item:nth-child(5) { animation-delay: 0.25s; }
.team-grid-item:nth-child(6) { animation-delay: 0.3s; }
.team-grid-item:nth-child(7) { animation-delay: 0.35s; }

@keyframes teamCardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.team-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.team-avatar.sam { background: var(--blue); }
.team-avatar.maya { background: var(--pink); }
.team-avatar.iris { background: var(--accent); }
.team-avatar.felix { background: var(--green); }
.team-avatar.nora { background: var(--orange); }
.team-avatar.rex { background: var(--cyan); }
.team-avatar.dash { background: var(--yellow); color: #333; }

.team-info { flex: 1; min-width: 0; }

.team-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.team-role {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.team-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.launch-btn {
  width: 100%;
  padding: 15px 24px;
  font-size: 16px;
  font-weight: 700;
  background: var(--accent-dim);
  letter-spacing: 0.3px;
}

.launch-btn:hover {
  background: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.3);
}

/* Industry picker (non-known companies) */
.onboard-picker-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-align: left;
}

.onboard-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  margin-bottom: 16px;
}

.onboard-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ─── Table toolbar ────────────────────────────────────────────────────────── */

.table-toolbar {
  display: flex;
  gap: 6px;
  margin: 10px 0 4px;
}

.table-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.table-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--accent);
}

/* ─── Checkboxes ──────────────────────────────────────────────────────────── */

.msg-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
}

.msg-checkbox input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s;
}

.msg-checkbox input[type="checkbox"]:checked {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

.msg-checkbox input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  top: -1px;
  left: 2px;
  font-size: 11px;
  color: white;
  font-weight: 700;
}

.msg-checkbox.checked .msg-checkbox-text {
  text-decoration: line-through;
  opacity: 0.5;
}

/* ─── Code blocks ─────────────────────────────────────────────────────────── */

.code-block-wrapper {
  position: relative;
  margin: 10px 0;
}

.code-lang {
  position: absolute;
  top: 6px;
  left: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.code-copy-btn:hover {
  background: var(--accent-glow);
  color: var(--text);
}

.msg-code {
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 14px 12px;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  white-space: pre;
}

/* ─── Message toolbar ─────────────────────────────────────────────────────── */

.msg-toolbar {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.message:hover .msg-toolbar {
  opacity: 1;
}

.msg-toolbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.msg-toolbar-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}

/* ─── Channel header button ───────────────────────────────────────────────── */

.channel-header-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.channel-header-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}

/* ─── Chart modal ─────────────────────────────────────────────────────────── */

.chart-type-toggle {
  display: flex;
  gap: 4px;
  margin-left: 16px;
}

.chart-type-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.chart-type-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.chart-type-btn.active {
  background: var(--accent-dim);
  color: white;
  border-color: var(--accent-dim);
}

/* ─── Attachment thumbnail ────────────────────────────────────────────────── */

.attach-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ─── Inline image preview ────────────────────────────────────────────────── */

.msg-image-preview {
  max-width: 320px;
  max-height: 240px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin: 8px 0;
  cursor: pointer;
  transition: opacity 0.15s;
}

.msg-image-preview:hover {
  opacity: 0.85;
}

/* ─── Email preview ───────────────────────────────────────────────────────── */

.email-preview-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 8px 0;
  color: #333;
  font-size: 14px;
  line-height: 1.7;
}

.email-preview-header {
  border-bottom: 1px solid #e8e8e8;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.email-preview-field {
  display: flex;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 4px;
}

.email-preview-label {
  font-weight: 600;
  color: #666;
  min-width: 60px;
}

.email-preview-value {
  color: #333;
}

.email-preview-body {
  white-space: pre-wrap;
  color: #333;
}

.email-preview-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.email-toggle-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.email-toggle-btn.active {
  background: var(--accent-dim);
  color: white;
  border-color: var(--accent-dim);
}

.email-toggle-btn:hover:not(.active) {
  background: var(--surface-3);
  color: var(--text);
}

/* ─── Toast notification ──────────────────────────────────────────────────── */

.table-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.table-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Onboarding upload zone ───────────────────────────────────────────────── */

.onboard-upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.onboard-upload-zone:hover,
.onboard-upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-icon {
  font-size: 36px;
  font-weight: 300;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1;
}

.upload-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.onboard-file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.onboard-step4-actions {
  display: flex;
  gap: 10px;
}

.onboard-step4-actions .btn-secondary {
  flex: 1;
}

.onboard-step4-actions .launch-btn {
  flex: 2;
}

/* ─── Attachment upload ────────────────────────────────────────────────────── */

.attach-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
}

.attach-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--accent);
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.attachment-info {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.attachment-remove:hover {
  color: var(--red);
}

/* ─── Response time badge ──────────────────────────────────────────────────── */

.msg-resp-time {
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 4px;
}

/* ─── Bookmark star ───────────────────────────────────────────────────────── */

.msg-bookmark-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
  transition: color 0.15s;
  opacity: 0;
}

.message:hover .msg-bookmark-btn { opacity: 1; }

.msg-bookmark-btn:hover { color: var(--yellow); }

/* Filled star for bookmarked */
.msg-bookmark-btn[data-bookmark] { color: var(--yellow); }

/* ─── Bookmarks panel ─────────────────────────────────────────────────────── */

.bookmark-item {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.bookmark-item:hover { background: var(--surface); }

.bookmark-agent {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.bookmark-text {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Files panel ─────────────────────────────────────────────────────────── */

.files-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}

.files-upload-btn {
  width: 100%;
  padding: 8px 0;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-bottom: 8px;
}

.files-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.file-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  transition: background 0.15s;
  margin-bottom: 2px;
}

.file-item:hover { background: var(--surface); }

.file-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.file-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.file-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  font-size: 10px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.file-item:hover .file-actions { opacity: 1; }

.file-action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.file-action-btn:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

.file-action-btn.disabled {
  color: var(--text-dim);
  opacity: 0.4;
  cursor: not-allowed;
}

.file-action-btn.disabled:hover {
  color: var(--text-dim);
  background: none;
}

.file-session-tag {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--orange-dim);
  color: var(--orange);
  margin-left: 4px;
  white-space: nowrap;
}

.panel-label-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.panel-label-toggle:hover { color: var(--text-muted); }

/* ─── Search bar ──────────────────────────────────────────────────────────── */

.search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  animation: searchSlideIn 0.2s ease;
}

@keyframes searchSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.search-input {
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 220px;
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.search-close:hover { color: var(--text); }

/* ─── Collapsible messages ────────────────────────────────────────────────── */

.msg-collapsible {
  max-height: 300px;
  overflow: hidden;
  position: relative;
}

.msg-collapsible::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.msg-collapsible.expanded {
  max-height: none;
}

.msg-collapsible.expanded::after {
  display: none;
}

.msg-expand-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  margin-top: 6px;
  font-family: inherit;
  transition: all 0.15s;
}

.msg-expand-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ─── Follow-up suggestions ───────────────────────────────────────────────── */

.msg-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.message:hover .msg-followups { opacity: 1; }

.followup-chip {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 4px 14px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.followup-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ─── Templates sidebar ───────────────────────────────────────────────────── */

.sidebar-label-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.sidebar-label-toggle:hover { color: var(--text-muted); }

.template-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
  color: var(--text-muted);
}

.template-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.template-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.template-label {
  font-size: 12px;
}

/* ─── Light theme ─────────────────────────────────────────────────────────── */

body.light-theme {
  --bg: #f5f5f7;
  --bg-dark: #eaeaef;
  --bg-darker: #e0e0e8;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --surface-3: #e8e8f0;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --text: #1a1a2e;
  --text-muted: #555570;
  --text-dim: #888898;
  --accent-glow: rgba(124, 58, 237, 0.08);
}

body.light-theme .login-card,
body.light-theme .onboarding-card,
body.light-theme .modal {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body.light-theme .msg-code {
  background: #f5f5f7;
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .msg-collapsible::after {
  background: linear-gradient(transparent, #f5f5f7);
}

body.light-theme .message:hover {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .email-preview-card {
  border-color: #ddd;
}

/* ─── Focus & accessibility ───────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Micro-interactions ──────────────────────────────────────────────────── */

.channel-item {
  transition: background 0.15s, padding-left 0.15s;
}

.channel-item.active {
  padding-left: 20px;
}

.msg-avatar {
  transition: transform 0.15s;
}

.message:hover .msg-avatar {
  transform: scale(1.05);
}

/* ─── Tool sidebar items ───────────────────────────────────────────────────── */

.tool-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--text-muted);
}

.tool-item:hover { background: rgba(255, 255, 255, 0.03); color: var(--text); }
.tool-item.active { background: var(--accent-glow); color: var(--text); }

.tool-item-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.tool-item-label { font-size: 13px; }

/* ─── Tool views ───────────────────────────────────────────────────────────── */

.tool-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}

.tool-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.tool-view-header h2 {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.tool-view-back {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.tool-view-back:hover { background: var(--surface-3); color: var(--text); }

.tool-view-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

/* ─── Mission Control ───────────────────────────────────────────────────── */

.mc-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.mc-metric-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.mc-metric-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.mc-metric-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.mc-section { min-width: 0; }
.mc-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.mc-agent-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mc-agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.mc-agent-card:hover {
  background: var(--surface-3);
  border-color: var(--accent-dim);
}
.mc-agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.mc-agent-info { flex: 1; min-width: 0; }
.mc-agent-name { font-size: 13px; font-weight: 600; }
.mc-agent-role { font-size: 11px; color: var(--text-dim); }
.mc-agent-status { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.mc-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.mc-status-text { font-size: 11px; color: var(--text-dim); }

.mc-feed { display: flex; flex-direction: column; gap: 2px; }
.mc-feed-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.mc-feed-item:hover { background: var(--surface-2); }
.mc-feed-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; padding-top: 1px; }
.mc-feed-body { flex: 1; min-width: 0; }
.mc-feed-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.mc-feed-agent { font-size: 12px; font-weight: 600; }
.mc-feed-time { font-size: 11px; color: var(--text-dim); }
.mc-feed-text { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ─── Content Pipeline ─────────────────────────────────────────────────── */

.pipeline-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 10px 0;
}
.pipeline-stat {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pipeline-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: start;
}
.pipeline-column {
  background: var(--surface-1, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
}
.pipeline-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}
.pipeline-col-icon { font-size: 14px; }
.pipeline-col-title { flex: 1; }
.pipeline-col-count {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.pipeline-col-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.pipeline-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px 0;
}
.pipeline-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  transition: all 0.15s;
}
.pipeline-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.pipeline-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.pipeline-card-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 3px;
}
.pipeline-card-time { font-size: 10px; color: var(--text-dim); }
.pipeline-card-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}
.pipeline-card-preview {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}
.pipeline-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pipeline-card-agent { font-size: 11px; font-weight: 600; }
.pipeline-card-actions { display: flex; gap: 4px; }
.pipeline-btn {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pipeline-btn:disabled { opacity: 0.5; cursor: default; }
.pipeline-btn-approve { color: var(--green); border-color: var(--green); }
.pipeline-btn-approve:hover:not(:disabled) { background: rgba(74,222,128,0.1); }
.pipeline-btn-reject { color: #ef4444; border-color: #ef4444; }
.pipeline-btn-reject:hover:not(:disabled) { background: rgba(239,68,68,0.1); }

/* ─── Activity Timeline ────────────────────────────────────────────────── */

.tl-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tl-filter {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tl-filter:hover { border-color: var(--text-dim); color: var(--text); }
.tl-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tl-feed { display: flex; flex-direction: column; }
.tl-item {
  display: grid;
  grid-template-columns: 60px 12px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  align-items: start;
}
.tl-item:hover { background: var(--surface-2); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius-sm); }
.tl-item:last-child { border-bottom: none; }
.tl-time {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  padding-top: 2px;
  white-space: nowrap;
}
.tl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.tl-content { min-width: 0; }
.tl-header { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.tl-agent { font-size: 12px; font-weight: 600; }
.tl-type {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border: 1px solid;
  border-radius: 3px;
}
.tl-real-badge {
  font-size: 9px;
  background: var(--accent);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.tl-text { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Responsive */
@media (max-width: 900px) {
  .mc-metrics { grid-template-columns: repeat(2, 1fr); }
  .mc-grid { grid-template-columns: 1fr; }
  .pipeline-board { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .mc-metrics { grid-template-columns: 1fr 1fr; }
  .pipeline-board { grid-template-columns: 1fr; }
}

/* Cert tracker */
.cert-grid {
  display: grid;
  gap: 12px;
}

.cert-card {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.2s;
}

.cert-card:hover { border-color: var(--border-light); }

.cert-status-bar {
  width: 4px;
  height: 100%;
  min-height: 32px;
  border-radius: 2px;
}

.cert-status-bar.green { background: var(--green); }
.cert-status-bar.orange { background: var(--orange); }
.cert-status-bar.red { background: var(--red); }

.cert-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.cert-info p { font-size: 12px; color: var(--text-dim); }

.cert-expiry {
  text-align: right;
  font-size: 13px;
}

.cert-expiry-date { font-weight: 600; }
.cert-expiry-days { font-size: 11px; color: var(--text-dim); }
.cert-expiry-days.warn { color: var(--orange); font-weight: 600; }
.cert-expiry-days.danger { color: var(--red); font-weight: 600; }

.cert-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.cert-badge.valid { background: var(--green-dim); color: var(--green); }
.cert-badge.expiring { background: var(--orange-dim); color: var(--orange); }
.cert-badge.expired { background: var(--red-dim); color: var(--red); }
.cert-badge.renewal { background: var(--blue-dim); color: var(--blue); }

.cert-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.cert-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.cert-summary-value {
  font-size: 28px;
  font-weight: 800;
}

.cert-summary-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Fleet dashboard */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.fleet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color 0.2s;
}

.fleet-card:hover { border-color: var(--border-light); }

.fleet-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fleet-card-name { font-size: 14px; font-weight: 700; }

.fleet-card-status {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.fleet-card-status.deployed { background: var(--green-dim); color: var(--green); }
.fleet-card-status.workshop { background: var(--orange-dim); color: var(--orange); }
.fleet-card-status.available { background: var(--blue-dim); color: var(--blue); }
.fleet-card-status.transit { background: var(--accent-glow); color: var(--accent); }

.fleet-card-detail {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.fleet-card-detail:last-child { border-bottom: none; }
.fleet-card-detail span:last-child { color: var(--text-muted); font-weight: 500; }

.fleet-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.fleet-util-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.fleet-util-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

/* Intel feed */
.intel-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.intel-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: border-color 0.2s;
}

.intel-item:hover { border-color: var(--border-light); }

.intel-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.intel-item-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.intel-item-type.award { background: var(--green-dim); color: var(--green); }
.intel-item-type.competitor { background: var(--red-dim); color: var(--red); }
.intel-item-type.market { background: var(--blue-dim); color: var(--blue); }
.intel-item-type.opportunity { background: var(--orange-dim); color: var(--orange); }
.intel-item-type.regulation { background: var(--accent-glow); color: var(--accent); }

.intel-item-date { font-size: 11px; color: var(--text-dim); margin-left: auto; }

.intel-item-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.intel-item-body { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.intel-item-action {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.intel-item-action:hover { text-decoration: underline; }

.intel-item-relevance {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
}

.intel-relevance-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.intel-relevance-dot.high { background: var(--green); }
.intel-relevance-dot.medium { background: var(--orange); }
.intel-relevance-dot.low { background: var(--text-dim); }

/* Bid analytics */
.bid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.bid-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.bid-stat-value { font-size: 28px; font-weight: 800; }
.bid-stat-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.bid-stat-trend { font-size: 11px; font-weight: 600; margin-top: 4px; }
.bid-stat-trend.up { color: var(--green); }
.bid-stat-trend.down { color: var(--red); }

.bid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bid-table th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

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

.bid-table tr:last-child td { border-bottom: none; }
.bid-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.bid-result {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.bid-result.won { background: var(--green-dim); color: var(--green); }
.bid-result.lost { background: var(--red-dim); color: var(--red); }
.bid-result.pending { background: var(--orange-dim); color: var(--orange); }

.bid-insight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.bid-insight-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
}

@media (max-width: 768px) {
  .cert-summary, .fleet-summary, .bid-stats { grid-template-columns: 1fr 1fr; }
  .fleet-grid { grid-template-columns: 1fr; }
  .cert-card { grid-template-columns: 4px 1fr; }
  .cert-card > :nth-child(3), .cert-card > :nth-child(4) { grid-column: 2; }
}

/* ─── Toast notifications ──────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
  max-width: 340px;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: opacity 0.2s;
}

.toast:hover { opacity: 0.8; }

.toast.leaving {
  animation: toastOut 0.3s ease forwards;
}

.toast-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.toast-body { flex: 1; min-width: 0; }
.toast-agent { font-weight: 600; font-size: 12px; }
.toast-text { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-channel { font-size: 10px; color: var(--text-dim); margin-top: 1px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* ─── Unread badge ─────────────────────────────────────────────────────────── */

.channel-item-unread {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  animation: unreadPop 0.3s ease;
}

.channel-item.has-unread .channel-item-name {
  color: var(--text);
  font-weight: 600;
}

@keyframes unreadPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ─── Mobile hamburger ─────────────────────────────────────────────────────── */

.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.hamburger-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}

.sidebar-overlay.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Command palette ──────────────────────────────────────────────────────── */

.cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
  animation: fadeIn 0.15s ease;
}

.cmd-palette-overlay.active {
  display: flex;
}

.cmd-palette {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: cmdSlideDown 0.15s ease;
}

@keyframes cmdSlideDown {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cmd-palette-input {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.cmd-palette-input::placeholder { color: var(--text-dim); }

.cmd-palette-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}

.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 14px;
  color: var(--text);
}

.cmd-palette-item:hover,
.cmd-palette-item.active {
  background: var(--accent-glow);
}

.cmd-palette-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.cmd-palette-item-label { flex: 1; }
.cmd-palette-item-hint { font-size: 11px; color: var(--text-dim); }

.cmd-palette-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 10px 20px 4px;
}

.cmd-palette-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.cmd-palette-footer {
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 16px;
}

.cmd-palette-footer kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 10px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text-muted);
}

/* ─── Agent status pulse animations ───────────────────────────────────────── */

.agent-dot {
  animation: agentPulse 3s ease-in-out infinite;
}

@keyframes agentPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0); }
}

/* ─── Payment gate ─────────────────────────────────────────────────────────── */

.payment-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}

.payment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 900px;
  width: 100%;
  text-align: center;
}

.payment-title {
  font-size: 24px;
  font-weight: 700;
  margin: 16px 0 8px;
}

.payment-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.payment-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
}

.payment-plan {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  position: relative;
}

.payment-plan.featured {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.payment-plan-tag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-dim);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.payment-plan h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.payment-plan-price {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 16px;
}

.payment-plan-price span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
}

.payment-plan ul {
  list-style: none;
  margin-bottom: 20px;
}

.payment-plan li {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0;
}

.payment-plan li::before {
  content: '\2713 ';
  color: var(--green);
  margin-right: 4px;
}

.payment-plan-btn {
  width: 100%;
}

/* ─── Plan badges ──────────────────────────────────────────────────────────── */

.plan-badge-business {
  background: var(--green-dim) !important;
  color: var(--green) !important;
  border: 1px solid var(--green) !important;
  padding: 2px 10px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.plan-badge-enterprise {
  background: var(--accent-glow) !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  padding: 2px 10px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.plan-badge-starter {
  background: var(--blue-dim) !important;
  color: var(--blue) !important;
  border: 1px solid var(--blue) !important;
  padding: 2px 10px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

.plan-badge-trial {
  background: var(--orange-dim) !important;
  color: var(--orange) !important;
  border: 1px solid var(--orange) !important;
  padding: 2px 10px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

/* ─── System toast ─────────────────────────────────────────────────────────── */

.system-toast .toast-avatar {
  font-size: 14px;
  line-height: 32px;
  text-align: center;
}

/* ─── ClipFarmer Dashboard ─────────────────────────────────────────────────── */

.cf-header-icon {
  font-size: 20px;
  margin-right: 4px;
}

.cf-sync-indicator {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  margin-right: 8px;
}

.cf-auto-refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: 8px;
  animation: cf-dot-pulse 2s ease-in-out infinite;
}

@keyframes cf-dot-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.cf-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 0;
  justify-content: center;
}

/* Stats cards */
.cf-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.cf-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  border-left: 3px solid var(--text-dim);
}

.cf-stat-card.cf-stat-amber { border-left-color: var(--orange); }
.cf-stat-card.cf-stat-blue { border-left-color: var(--blue); }
.cf-stat-card.cf-stat-green { border-left-color: var(--green); }
.cf-stat-card.cf-stat-gray { border-left-color: var(--text-dim); }

.cf-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.cf-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.cf-pulse {
  animation: cf-value-pulse 2s ease-in-out infinite;
}

@keyframes cf-value-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Sections */
.cf-section {
  margin-bottom: 32px;
}

.cf-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.cf-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

/* Filter bar */
.cf-filter-bar {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cf-channel-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cf-tab {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.cf-tab:hover { background: var(--surface-3); color: var(--text); }
.cf-tab.active { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }

.cf-status-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cf-pill {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.cf-pill:hover { border-color: var(--text-muted); color: var(--text-muted); }
.cf-pill.active { background: var(--surface-3); border-color: var(--accent); color: var(--accent); }

/* Badges */
.cf-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
  line-height: 1.4;
}

.cf-badge-amber { background: var(--orange-dim); color: var(--orange); }
.cf-badge-green { background: var(--green-dim); color: var(--green); }
.cf-badge-blue { background: var(--blue-dim); color: var(--blue); }
.cf-badge-purple { background: rgba(167, 139, 250, 0.12); color: var(--accent); }
.cf-badge-red { background: var(--red-dim); color: var(--red); }
.cf-badge-gray { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }
.cf-badge-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-dim);
}

/* Topic list */
.cf-topic-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cf-topic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.15s;
}

.cf-topic-item:hover { background: var(--surface-2); }

.cf-topic-main {
  flex: 1;
  min-width: 0;
}

.cf-topic-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-topic-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-topic-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cf-score {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

.cf-media-icon {
  font-size: 14px;
}

.cf-time {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Video grid */
.cf-video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cf-video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cf-video-card:hover { border-color: var(--border-light); }

.cf-video-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cf-video-details {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cf-video-duration {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cf-video-providers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cf-video-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.cf-yt-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--red-dim);
  border-radius: 4px;
  transition: background 0.15s;
}

.cf-yt-link:hover { background: var(--red-dim); }

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .right-panel { display: none; }
  .cf-video-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
    position: fixed;
    top: 48px;
    left: 0;
    bottom: 0;
    z-index: 100;
    width: 280px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }
  .sidebar.mobile-open { display: block; }
  .hamburger-btn { display: block; }
  .topbar-business { display: none; }
  .login-card { padding: 32px 24px; }
  .onboarding-card { padding: 32px 24px; }
  .team-grid { grid-template-columns: 1fr; }
  .payment-plans { grid-template-columns: 1fr; }
  .payment-card { padding: 32px 20px; }
  .welcome-cards { grid-template-columns: 1fr; }
  .toast-container { right: 10px; bottom: 10px; left: 10px; }
  .toast { max-width: 100%; }
  .cf-stats-row { grid-template-columns: repeat(2, 1fr); }
  .cf-video-grid { grid-template-columns: 1fr; }
  .cf-topic-item { flex-direction: column; align-items: flex-start; }
  .cf-topic-meta { margin-top: 6px; }
}
