/* ============================================================
   Abby Intelligence — Interface V3 Modern AI
   Inspiree Claude web / ChatGPT — light, airy, premium
   Charte Abby : Inter, Bleu #0075EB
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Abby brand */
  --abby-blue: #0075EB;
  --abby-blue-hover: #0063C8;
  --abby-blue-light: #EBF4FF;
  --abby-blue-50: #EBF4FF;
  --abby-blue-100: #D6E9FE;
  --abby-blue-200: #A8D1FC;
  --abby-navy: #25385E;
  --abby-navy-deep: #1B2A47;
  --abby-navy-darker: #131E35;

  /* Semantic */
  --success: #22C55E;
  --success-light: #DCFCE7;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --purple: #8B5CF6;
  --purple-light: #EDE9FE;

  /* Layout — refined light palette */
  --bg-start: #F6F4FB;
  --bg-end: #FFFFFF;
  --surface: #FFFFFF;
  --surface-hover: #FAFBFD;
  --border: #E8EAF0;
  --border-light: #F0F2F7;
  --border-subtle: #ECEEF4;
  --text: #1A2332;
  --text-secondary: #5B6B82;
  --text-muted: #94A3B8;
  --text-faint: #B8C4D4;

  /* Sidebar compact */
  --sidebar-width: 64px;
  --sidebar-expanded-width: 240px;
  --chat-max-width: 680px;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 100px;
  --radius-input: 26px;

  /* Shadows — ultra soft */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.07);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);
  --shadow-input: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-input-focus: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-glow-blue: 0 0 0 3px rgba(0, 117, 235, 0.1);

  /* Transitions */
  --transition-fast: 0.12s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ============================================================
   Reset
   ============================================================ */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(170deg, var(--bg-start) 0%, var(--bg-end) 60%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  letter-spacing: -0.01em;
}

/* ============================================================
   Auth Screens
   ============================================================ */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(170deg, var(--bg-start) 0%, var(--bg-end) 60%);
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow-md);
  max-width: 400px;
  width: 90%;
}

.auth-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: block;
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.auth-card p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--abby-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: background 0.15s;
}

.auth-btn:hover {
  background: var(--abby-blue-hover);
}

/* ============================================================
   Utilities
   ============================================================ */

.hidden { display: none !important; }

/* ============================================================
   Onboarding Overlay
   ============================================================ */

#onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--abby-navy-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInOverlay 0.4s ease;
}

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

.onboarding-container {
  display: flex;
  width: 94vw;
  max-width: 1060px;
  height: 82vh;
  max-height: 680px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 80px rgba(0, 117, 235, 0.08);
  overflow: hidden;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-left {
  width: 340px;
  flex-shrink: 0;
  background: linear-gradient(165deg, var(--abby-navy-darker) 0%, var(--abby-navy-deep) 50%, #1E3A5F 100%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 36px 28px;
  position: relative;
  overflow: hidden;
}

.onboarding-left::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(0, 117, 235, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.onboarding-brand h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.onboarding-subtitle {
  font-size: 13px;
  opacity: 0.55;
  margin-bottom: 36px;
  font-weight: 500;
}

.onboarding-progress {
  margin-bottom: 28px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--abby-blue), #3B9EFF);
  border-radius: 2px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  opacity: 0.5;
  transition: opacity var(--transition-normal);
  font-weight: 500;
}

.progress-field.done {
  opacity: 0.95;
}

.progress-field-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: all var(--transition-normal);
}

.progress-field.done .progress-field-icon {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.profile-preview {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.6;
}

.profile-preview-item {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.profile-preview-label {
  opacity: 0.45;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* Onboarding chat (right side) — modern gradient */
.onboarding-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, var(--bg-start) 0%, var(--bg-end) 60%);
}

.onboarding-chat-header {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
}

.agent-chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.onboarding-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.onboarding-input {
  padding: 16px 24px 24px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.onboarding-input textarea {
  flex: 1;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-input);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 120px;
  transition: all var(--transition-fast);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-input);
}

.onboarding-input textarea:focus {
  box-shadow: var(--shadow-input-focus);
}

.onboarding-input textarea::placeholder {
  color: var(--text-faint);
}

/* ============================================================
   Main App Layout
   ============================================================ */

#app {
  display: flex;
  height: 100vh;
}

/* ============================================================
   Sidebar — Ultra compact, icons only
   ============================================================ */

aside#sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: center;
  padding: 12px 0;
  transition: width var(--transition-slow);
  overflow: hidden;
}

aside#sidebar.sidebar-expanded {
  width: var(--sidebar-expanded-width);
  align-items: stretch;
}

aside#sidebar.sidebar-expanded .sidebar-header {
  padding: 8px 12px 0;
  justify-content: space-between;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 0;
  gap: 6px;
}

/* Sidebar logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.sidebar-logo-img {
  height: 22px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-logo-text {
  display: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* Compact mode: hide logo, only show toggle */
aside#sidebar:not(.sidebar-expanded) .sidebar-logo {
  display: none;
}

/* Expanded mode: show logo + text */
aside#sidebar.sidebar-expanded .sidebar-logo {
  display: flex;
  flex: 1;
}

aside#sidebar.sidebar-expanded .sidebar-logo-img {
  height: 24px;
}

aside#sidebar.sidebar-expanded .sidebar-logo-text {
  display: inline;
}

.btn-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.btn-sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
}

/* New chat button — icon only, top of sidebar */
.sidebar-new-chat {
  padding: 8px 0 4px;
  display: flex;
  justify-content: center;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--abby-blue-50);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--abby-blue);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  padding: 0;
}

.btn-new-chat span {
  display: none;
}

.sidebar-expanded .sidebar-new-chat {
  padding: 8px 12px 4px;
  justify-content: stretch;
}

.sidebar-expanded .btn-new-chat {
  width: 100%;
  justify-content: center;
  gap: 8px;
}

.sidebar-expanded .btn-new-chat span {
  display: inline;
  white-space: nowrap;
}

.btn-new-chat:hover {
  background: var(--abby-blue);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 117, 235, 0.2);
}

.btn-new-chat:active {
  transform: scale(1);
}

/* ============================================================
   Sidebar Menu Link — Agents button
   ============================================================ */

.sidebar-menu-link {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  margin: 0 auto 4px;
}

aside#sidebar:not(.sidebar-expanded) .sidebar-menu-link {
  display: flex;
}

.sidebar-menu-link span {
  display: none;
}

.sidebar-menu-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
}

.sidebar-menu-link:active {
  background: rgba(0, 0, 0, 0.07);
}

.sidebar-menu-link.active {
  background: var(--abby-blue-50);
  color: var(--abby-blue);
}

.sidebar-menu-link.active:hover {
  background: var(--abby-blue-50);
}

.sidebar-expanded .sidebar-menu-link {
  display: flex;
  width: auto;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 14px;
  margin: 0 8px 4px;
  height: 38px;
}

.sidebar-expanded .sidebar-menu-link span {
  display: inline;
}

/* ============================================================
   Page Containers — standalone pages (not injected in chat)
   ============================================================ */

.page-container {
  flex: 1;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.page-container.hidden {
  display: none !important;
}

/* ============================================================
   Agents Hub — standalone page
   ============================================================ */

.agents-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 12px;
  padding: 40px 20px;
  animation: fadeIn 0.3s ease;
}

.agents-hub h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.agents-hub p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 440px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.agents-hub .welcome-agents {
  max-width: 600px;
  width: 100%;
}

/* ============================================================
   Business Hub — "Mon business AI" page
   ============================================================ */

.business-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  overflow-y: auto;
  padding: 40px 20px 60px;
  animation: fadeIn 0.3s ease;
}

.business-hub-inner {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.business-hub h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-align: center;
  margin-bottom: 4px;
}

/* Sections */
.biz-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
}

.biz-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Profile rows */
.biz-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.biz-row:last-of-type {
  border-bottom: none;
}

.biz-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.biz-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.biz-value.empty {
  color: var(--text-faint);
  font-weight: 400;
  font-style: italic;
}

/* Stat cards row */
.biz-stats-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.biz-stat-card {
  flex: 1;
  background: var(--bg-start);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}

.biz-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

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

/* Agent usage bars */
.biz-agent-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}

.biz-agent-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.biz-agent-avatar svg {
  width: 11px;
  height: 11px;
}

.biz-agent-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  width: 60px;
  flex-shrink: 0;
}

.biz-agent-track {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.biz-agent-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.biz-agent-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* Edit profile button */
.biz-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 12px;
}

.biz-edit-btn:hover {
  background: var(--abby-blue-50);
  border-color: var(--abby-blue-200);
  color: var(--abby-blue);
}

/* Loading state */
.biz-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-faint);
  font-size: 13px;
}

@media (max-width: 640px) {
  .biz-stats-row {
    flex-direction: column;
  }
}

/* ============================================================
   Conversations History — sidebar scrollable list
   ============================================================ */

.conversations-history {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 0;
}

.sidebar-expanded .conversations-history {
  display: flex;
  padding: 0 8px;
}

/* Section labels — hidden when sidebar collapsed */
.sidebar-section-label {
  display: none;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 18px 4px;
}

.sidebar-section-label + .agents-nav {
  padding-top: 0;
}

.sidebar-expanded .sidebar-section-label {
  display: block;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
  min-height: 36px;
}

.convo-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.convo-item.active {
  background: var(--abby-blue-50);
}

.convo-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--abby-blue);
  border-radius: 0 3px 3px 0;
}

.convo-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.convo-item-icon svg {
  width: 14px;
  height: 14px;
}

.convo-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.convo-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.convo-item-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.convo-item-delete {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.convo-item:hover .convo-item-delete {
  display: flex;
}

.convo-item-delete:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.conversations-empty {
  padding: 12px 10px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* Agents nav — vertical icon stack */
.agents-nav {
  flex-shrink: 0;
  padding: 8px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.agent-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.agent-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.agent-item.active {
  background: var(--abby-blue-50);
}

/* Active indicator dot */
.agent-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--abby-blue);
  border-radius: 0 3px 3px 0;
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  transition: transform var(--transition-fast);
}

.agent-item:hover .agent-avatar {
  transform: scale(1.08);
}

.agent-avatar svg {
  width: 15px;
  height: 15px;
}

/* Hidden text in compact mode */
.agent-info {
  display: none;
  flex-direction: column;
  min-width: 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.sidebar-expanded .agents-nav {
  align-items: stretch;
  padding: 8px 8px;
}

.sidebar-expanded .agent-item {
  width: 100%;
  justify-content: flex-start;
  padding: 0 10px;
  gap: 10px;
}

.sidebar-expanded .agent-info {
  display: flex;
  opacity: 1;
}

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

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

/* Agent locked — onboarding en cours */
.agent-item.agent-locked {
  cursor: not-allowed;
  opacity: 0.38;
}

.agent-item.agent-locked:hover {
  background: transparent;
}

.agent-item.agent-locked .agent-avatar {
  filter: grayscale(0.6);
}

.agent-item.agent-locked:hover .agent-avatar {
  transform: none;
}

.agent-lock-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--surface);
  border-radius: 50%;
  padding: 2px;
  color: var(--text-muted);
}

.agent-item.agent-locked .agent-info-role {
  font-style: italic;
  color: var(--text-faint);
}

/* Disable tooltips when sidebar is expanded */
.sidebar-expanded .agent-item[data-tooltip]:hover::after {
  display: none;
}

/* Tooltip on hover */
.agent-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--abby-navy);
  color: white;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  animation: tooltipFade 0.15s ease;
}

@keyframes tooltipFade {
  from { opacity: 0; transform: translateY(-50%) translateX(-4px); }
  to { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* Sidebar bottom — compact */
.sidebar-bottom {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.sidebar-expanded .sidebar-bottom {
  align-items: stretch;
  padding: 8px 12px;
}

.sidebar-expanded .profile-status {
  justify-content: flex-start;
  padding: 0 4px;
}

.sidebar-expanded .profile-status span {
  display: inline;
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.profile-status {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-status span {
  display: none;
}

.profile-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.profile-dot.complete {
  background: var(--success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

/* ============================================================
   Chat Main
   ============================================================ */

main#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
  position: relative;
}

/* Chat header — agent selector dropdown */
.chat-header {
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-header-agent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Agent selector button */
.agent-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: all var(--transition-fast);
  letter-spacing: -0.01em;
}

.agent-selector-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--border-light);
}

.agent-selector-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  background: var(--text-muted);
}

.agent-selector-avatar svg {
  width: 12px;
  height: 12px;
}

.agent-selector-name {
  white-space: nowrap;
}

.agent-selector-chevron {
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.agent-selector-btn.open .agent-selector-chevron {
  transform: rotate(180deg);
}

/* Agent selector dropdown */
.agent-selector-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  z-index: 200;
  animation: dropdownFadeIn 0.15s ease;
  padding: 4px;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.agent-selector-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.agent-selector-option:hover {
  background: rgba(0, 0, 0, 0.04);
}

.agent-selector-option.active {
  background: var(--abby-blue-50);
}

.agent-selector-opt-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.agent-selector-opt-avatar svg {
  width: 14px;
  height: 14px;
}

.agent-selector-opt-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.agent-selector-opt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.agent-selector-opt-role {
  font-size: 11px;
  color: var(--text-muted);
}

.agent-selector-check {
  color: var(--abby-blue);
  flex-shrink: 0;
  display: none;
}

.agent-selector-option.active .agent-selector-check {
  display: block;
}

.agent-selector-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 8px;
}

.chat-header-actions {
  position: absolute;
  right: 28px;
  display: flex;
  gap: 4px;
}

.btn-ghost {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-faint);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
}

.btn-ghost:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-secondary);
}

/* Messages area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 28px;
  scroll-behavior: smooth;
}

.messages-area.hidden {
  display: none !important;
}

/* ============================================================
   Welcome Screen — Large, centered, elegant
   ============================================================ */

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 12px;
  padding: 40px 20px;
  animation: fadeIn 0.6s ease;
}

.welcome-icon {
  display: none;
}

.welcome-logo {
  margin-bottom: 8px;
}

.welcome-logo img {
  height: 42px;
  width: auto;
  object-fit: contain;
  opacity: 0.85;
}

.welcome-screen h2 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.welcome-screen p {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 440px;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Agent cards — 2-column grid */
.welcome-agents {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 600px;
  width: 100%;
}

.agent-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-xs);
}

.agent-card:hover {
  border-color: var(--abby-blue-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.agent-card:active {
  transform: translateY(0);
}

.agent-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.agent-card-icon svg {
  width: 18px;
  height: 18px;
}

.agent-card-text {
  flex: 1;
  min-width: 0;
}

.agent-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.agent-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 640px) {
  .welcome-agents {
    grid-template-columns: 1fr;
  }
}

/* Welcome suggestions — action prompts */
.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 560px;
  margin-top: 16px;
}

.suggestion-card {
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
  letter-spacing: -0.01em;
}

.suggestion-card:hover {
  background: var(--abby-blue-50);
  border-color: var(--abby-blue-200);
  color: var(--abby-blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.suggestion-card:active {
  transform: translateY(0);
}

/* ============================================================
   Message Bubbles — Modern AI chat style
   ============================================================ */

.msg {
  margin-bottom: 24px;
  max-width: var(--chat-max-width);
  margin-left: auto;
  margin-right: auto;
  animation: msgFadeIn 0.25s ease;
}

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

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

/* User messages — dark bubble, right-aligned */
.msg-user {
  display: flex;
  justify-content: flex-end;
}

.msg-user .msg-bubble {
  background: var(--abby-navy);
  color: white;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-xs) var(--radius-xl);
  padding: 12px 18px;
  max-width: 85%;
}

/* Assistant messages — transparent, avatar left */
.msg-assistant {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  margin-top: 2px;
}

.msg-avatar svg {
  width: 14px;
  height: 14px;
}

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

.msg-header {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.msg-header .msg-agent-name {
  color: var(--text-secondary);
}

.msg-bubble {
  padding: 0;
  font-size: 14.5px;
  line-height: 1.65;
  word-break: break-word;
}

.msg-assistant .msg-bubble {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 2px 0;
  color: var(--text);
}

/* System messages */
.msg-system {
  text-align: center;
  max-width: 500px;
}

.msg-system .msg-bubble {
  background: rgba(0,0,0,0.03);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 20px;
  display: inline-block;
  font-weight: 500;
}

.msg-system.msg-success .msg-bubble {
  background: var(--success-light);
  color: #15803D;
}

.msg-system.msg-error .msg-bubble {
  background: var(--danger-light);
  color: var(--danger);
}

/* ============================================================
   Choices Picker — Claude web style (replaces input area)
   ============================================================ */

.choices-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: pickerSlideUp 0.25s ease;
  max-width: var(--chat-max-width);
  margin: 0 auto;
}

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

.choices-picker-header {
  display: flex;
  align-items: center;
  padding: 16px 20px 12px;
  gap: 12px;
}

.choices-picker-question {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.choices-picker-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.choices-picker-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

.choices-picker-list {
  padding: 0 8px;
}

.choices-picker-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 12px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  gap: 14px;
  border-bottom: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  text-align: left;
}

.choices-picker-item:last-child {
  border-bottom: none;
}

.choices-picker-item:hover {
  background: rgba(0,0,0,0.03);
}

.choices-picker-item:hover .choices-picker-arrow {
  opacity: 1;
  transform: translateX(0);
}

.choices-picker-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.choices-picker-text {
  flex: 1;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.choices-picker-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
}

.choices-picker-footer {
  display: flex;
  align-items: center;
  padding: 8px 12px 12px;
  gap: 8px;
  border-top: 1px solid var(--border-light);
}

.choices-picker-custom {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
}

.choices-picker-custom svg {
  flex-shrink: 0;
}

.choices-picker-input {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  padding: 8px 0;
}

.choices-picker-input::placeholder {
  color: var(--text-faint);
}

.choices-picker-skip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.choices-picker-skip:hover {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
}

/* --- Picker header text + navigation --- */
.choices-picker-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.choices-picker-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.choices-picker-counter {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 56px;
  text-align: center;
}

.choices-picker-prev,
.choices-picker-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.choices-picker-prev:hover:not(:disabled),
.choices-picker-next:hover:not(:disabled) {
  background: rgba(0,0,0,0.04);
  color: var(--text);
  border-color: var(--text-muted);
}

.choices-picker-prev:disabled,
.choices-picker-next:disabled {
  opacity: 0.3;
  cursor: default;
}

/* --- Selected state (single, revisiting) --- */
.choices-picker-item.selected {
  background: var(--abby-blue-50);
  border-color: var(--abby-blue-200);
}

.choices-picker-item.selected .choices-picker-num {
  background: var(--abby-blue);
  color: white;
}

.choices-picker-item.selected .choices-picker-arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--abby-blue);
}

/* --- Send all button (multi-question) --- */
.choices-picker-send {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--success);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.choices-picker-send:hover {
  background: #1aab50;
}

.choices-picker-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

/* --- Multi select (checkbox) --- */
.choices-picker-check {
  position: relative;
}

.choices-picker-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  background: transparent;
}

.choices-picker-checkbox .check-icon {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.choices-picker-check.checked .choices-picker-checkbox {
  background: var(--abby-blue);
  border-color: var(--abby-blue);
}

.choices-picker-check.checked .choices-picker-checkbox .check-icon {
  opacity: 1;
}

.choices-picker-check.checked {
  background: var(--abby-blue-50);
}

/* --- Rank (drag & drop) --- */
.choices-picker-drag {
  cursor: grab;
  user-select: none;
  position: relative;
}

.choices-picker-drag:active {
  cursor: grabbing;
}

.choices-picker-drag.dragging {
  opacity: 0.5;
  background: var(--abby-blue-50);
  box-shadow: 0 2px 8px rgba(0, 117, 235, 0.15);
}

.choices-picker-rank-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--abby-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.choices-picker-grip {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
  transition: color var(--transition-fast);
}

.choices-picker-drag:hover .choices-picker-grip {
  color: var(--text-muted);
}

/* --- Validate button (multi + rank) --- */
.choices-picker-validate {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--abby-blue);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.choices-picker-validate:hover {
  background: var(--abby-blue-hover);
}

/* --- Search select (scrollable + filter) --- */
.choices-picker-list[data-type="search"],
.choices-picker-list[data-type="search_multi"] {
  max-height: 268px;
  overflow-y: auto;
}

.choices-picker-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-muted);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.choices-picker-search-input {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  padding: 4px 0;
}

.choices-picker-search-input::placeholder {
  color: var(--text-faint);
}

/* --- Free input --- */
.choices-picker-free {
  padding: 12px;
}

.choices-picker-free-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition-fast);
  box-sizing: border-box;
}

.choices-picker-free-input:focus {
  border-color: var(--abby-blue);
}

.choices-picker-free-input::placeholder {
  color: var(--text-faint);
}

/* --- Send Email card --- */
.choices-picker-email-card {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choices-picker-email-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.choices-picker-email-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: right;
  flex-shrink: 0;
}

.choices-picker-email-field input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition-fast);
}

.choices-picker-email-field input:focus {
  border-color: var(--abby-blue);
}

.choices-picker-email-body-field {
  align-items: flex-start;
}

.choices-picker-email-body-field label {
  padding-top: 8px;
}

.choices-picker-email-body {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition-fast);
}

.choices-picker-email-body:focus {
  border-color: var(--abby-blue);
}

.choices-picker-email-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-left: 52px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.choices-picker-email-attachment svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.choices-picker-email-send-btn {
  background: var(--success) !important;
}

.choices-picker-email-send-btn:hover {
  background: #1aab50 !important;
}

/* Mobile adjustments for picker */
@media (max-width: 480px) {
  .choices-picker {
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }
  .choices-picker-header {
    padding: 14px 16px 10px;
  }
  .choices-picker-question {
    font-size: 14px;
  }
  .choices-picker-item {
    padding: 12px 10px;
    font-size: 13.5px;
    gap: 10px;
  }
  .choices-picker-num {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

/* ============================================================
   Message Markdown
   ============================================================ */

.msg-bubble p {
  margin: 4px 0;
}

.msg-bubble p:first-child { margin-top: 0; }
.msg-bubble p:last-child { margin-bottom: 0; }

.msg-bubble li > p {
  margin: 0;
}

.msg-bubble strong { font-weight: 700; }
.msg-bubble code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  color: var(--text);
}

.msg-user .msg-bubble code {
  background: rgba(255,255,255,0.15);
  color: white;
}

.msg-bubble pre {
  background: var(--abby-navy-darker);
  color: #E2E8F0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 10px 0;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  line-height: 1.6;
}

.msg-bubble pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.msg-bubble h1, .msg-bubble h2, .msg-bubble h3,
.msg-bubble h4, .msg-bubble h5, .msg-bubble h6 {
  margin: 8px 0 4px;
  line-height: 1.3;
}

.msg-bubble h1:first-child, .msg-bubble h2:first-child, .msg-bubble h3:first-child { margin-top: 0; }

.msg-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.msg-bubble ul, .msg-bubble ol {
  padding-left: 20px;
  margin: 4px 0;
}

.msg-bubble li {
  margin-bottom: 2px;
}

.msg-bubble li:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Thinking / Tool Calls Block — Rich status display
   ============================================================ */

.thinking-container {
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 280px;
}

.thinking-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.thinking-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--abby-blue);
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 117, 235, 0.4); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(0, 117, 235, 0); }
}

.thinking-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: opacity 0.2s ease;
}

.thinking-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}

.thinking-progress {
  height: 2px;
  background: var(--border-light);
  overflow: hidden;
}

.thinking-progress-bar {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--abby-blue), var(--abby-blue-200));
  border-radius: 1px;
  animation: progressSlide 2s ease-in-out infinite;
}

@keyframes progressSlide {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 50%; }
  100% { transform: translateX(400%); width: 30%; }
}

.thinking-steps {
  overflow: hidden;
}

.thinking-container.expanded .thinking-steps:not(:empty) {
  border-top: 1px solid var(--border-light);
}

.thinking-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  animation: stepFadeIn 0.3s ease;
}

@keyframes stepFadeIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.thinking-step:last-child {
  border-bottom: none;
}

.step-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-icon.step-running { color: var(--abby-blue); }
.step-icon.step-done { color: var(--success); }
.step-icon.step-error { color: var(--danger); }

.step-name {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.step-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-status.step-running { color: var(--abby-blue); }
.step-status.step-done { color: var(--success); }
.step-status.step-error { color: var(--danger); }

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

.thinking-spinner {
  animation: spin 1s linear infinite;
}

.msg-thinking-block .msg-content {
  flex: 1;
  min-width: 0;
}

/* Thinking tip — subtle hint below the thinking block */
.thinking-tip {
  max-width: var(--chat-max-width);
  margin: 4px auto 0;
  padding: 0 60px;
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 5px;
  animation: tipFadeIn 0.5s ease;
}

.thinking-tip-icon {
  font-size: 11px;
  flex-shrink: 0;
}

.thinking-tip-text {
  transition: opacity 0.3s ease;
}

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

/* ============================================================
   Typing Indicator
   ============================================================ */

.typing-bar {
  padding: 8px 28px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  max-width: var(--chat-max-width);
  margin: 0 auto;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Onboarding typing indicator */
.typing-indicator {
  padding: 12px 24px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.typing-text {
  color: var(--text-muted);
}

/* ============================================================
   Input Area — Floating pill, centered
   ============================================================ */

.input-area {
  padding: 0 28px 24px;
  background: transparent;
}

.input-area.hidden {
  display: none !important;
}

.chat-form {
  display: flex;
  flex-direction: column;
  max-width: var(--chat-max-width);
  margin: 0 auto;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-input);
  padding: 6px 6px 6px 20px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-input);
}

.input-wrapper:focus-within {
  box-shadow: var(--shadow-input-focus);
}

.input-wrapper textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  resize: none;
  outline: none;
  padding: 8px 0;
  max-height: 150px;
  color: var(--text);
}

.input-wrapper textarea::placeholder {
  color: var(--text-faint);
}

.btn-send-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--abby-blue);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
  color: white;
}

.btn-send-round svg {
  width: 14px;
  height: 14px;
}

.btn-send-round:hover {
  background: var(--abby-blue-hover);
  transform: scale(1.06);
  box-shadow: 0 2px 10px rgba(0, 117, 235, 0.25);
}

.btn-send-round:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input-hint {
  font-size: 11px;
  color: var(--text-faint);
  padding: 6px 6px 0;
  text-align: center;
}

/* ============================================================
   Inline MCP Preview (replaces right panel)
   ============================================================ */

.msg-preview {
  max-width: var(--chat-max-width);
  margin: 16px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  animation: msgFadeIn 0.25s ease;
}

.msg-preview .preview-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-preview .preview-badge-area {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.msg-preview .preview-message {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.5;
}

.msg-preview .preview-data {
  background: var(--abby-navy-darker);
  color: #E2E8F0;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  max-height: 250px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.msg-preview .preview-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================
   Badges — Refined
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-tool { background: var(--purple-light); color: var(--purple); }
.badge-mock { background: rgba(0,0,0,0.04); color: var(--text-muted); }
.badge-destructive { background: var(--danger-light); color: var(--danger); }
.badge-read { background: var(--success-light); color: #15803D; }
.badge-create { background: var(--abby-blue-50); color: var(--abby-blue); }

/* ============================================================
   Buttons — Modern
   ============================================================ */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-confirm { background: var(--success); color: white; flex: 1; justify-content: center; border-radius: var(--radius); }
.btn-confirm:hover { background: #16A34A; box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25); }
.btn-cancel { background: rgba(0,0,0,0.04); color: var(--text); flex: 1; justify-content: center; border: none; border-radius: var(--radius); }
.btn-cancel:hover { background: rgba(0,0,0,0.07); }

/* ============================================================
   Scrollbar — Minimal
   ============================================================ */

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.06);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.12);
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */

@media (max-width: 768px) {
  aside#sidebar {
    width: 56px;
  }
  aside#sidebar.sidebar-expanded {
    width: 200px;
  }
  .agent-item {
    width: 36px;
    height: 36px;
  }
  .agent-avatar {
    width: 28px;
    height: 28px;
  }
  .btn-new-chat {
    width: 36px;
    height: 36px;
  }
  .messages-area {
    padding: 0 16px 16px;
  }
  .input-area {
    padding: 0 16px 16px;
  }
  .welcome-screen h2 {
    font-size: 28px;
  }
  .welcome-screen p {
    font-size: 14px;
  }

  /* Onboarding — stack vertically */
  .onboarding-container {
    flex-direction: column;
    height: 92vh;
    max-height: none;
  }
  .onboarding-left {
    width: 100%;
    padding: 24px 20px 16px;
    flex-shrink: 0;
    min-height: auto;
    max-height: 160px;
  }
  .onboarding-brand h1 {
    font-size: 18px;
  }
  .onboarding-subtitle {
    margin-bottom: 16px;
    font-size: 12px;
  }
  .progress-fields {
    display: none;
  }
  .profile-preview {
    display: none;
  }
  .onboarding-right {
    flex: 1;
    min-height: 0;
  }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */

@media (max-width: 480px) {
  /* Hide sidebar entirely on small mobile */
  aside#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    width: var(--sidebar-expanded-width);
    align-items: stretch;
    box-shadow: var(--shadow-xl);
  }
  aside#sidebar.sidebar-mobile-open {
    transform: translateX(0);
  }
  /* When sidebar is open on mobile, always show expanded style */
  aside#sidebar.sidebar-mobile-open .sidebar-logo { display: flex; flex: 1; }
  aside#sidebar.sidebar-mobile-open .sidebar-logo-img { height: 24px; }
  aside#sidebar.sidebar-mobile-open .sidebar-logo-text { display: inline; }
  aside#sidebar.sidebar-mobile-open .sidebar-header { padding: 8px 12px 0; justify-content: space-between; }
  aside#sidebar.sidebar-mobile-open .sidebar-new-chat { padding: 8px 12px 4px; justify-content: stretch; }
  aside#sidebar.sidebar-mobile-open .btn-new-chat { width: 100%; justify-content: center; gap: 8px; }
  aside#sidebar.sidebar-mobile-open .btn-new-chat span { display: inline; white-space: nowrap; }
  aside#sidebar.sidebar-mobile-open .conversations-history { display: flex; padding: 0 8px; }
  aside#sidebar.sidebar-mobile-open .sidebar-section-label { display: block; }
  aside#sidebar.sidebar-mobile-open .agents-nav { align-items: stretch; padding: 8px 8px; }
  aside#sidebar.sidebar-mobile-open .agent-item { width: 100%; justify-content: flex-start; padding: 0 10px; gap: 10px; }
  aside#sidebar.sidebar-mobile-open .agent-info { display: flex; opacity: 1; }
  aside#sidebar.sidebar-mobile-open .sidebar-bottom { align-items: stretch; padding: 8px 12px; }
  aside#sidebar.sidebar-mobile-open .profile-status { justify-content: flex-start; padding: 0 4px; }
  aside#sidebar.sidebar-mobile-open .profile-status span { display: inline; margin-left: 8px; font-size: 12px; color: var(--text-muted); font-weight: 500; }

  /* Mobile overlay backdrop */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 499;
  }
  .sidebar-backdrop.visible {
    display: block;
  }

  /* Mobile hamburger button floating */
  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 498;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
  }

  /* Chat main takes full width */
  main#chat-main {
    width: 100%;
  }

  /* Chat header */
  .chat-header {
    padding: 12px 16px;
    padding-left: 56px; /* space for hamburger */
  }
  .chat-header-actions {
    right: 16px;
  }

  /* Messages */
  .messages-area {
    padding: 0 12px 12px;
  }

  /* Welcome screen */
  .welcome-screen {
    padding: 20px 16px;
    gap: 10px;
  }
  .welcome-screen h2 {
    font-size: 24px;
  }
  .welcome-screen p {
    font-size: 13px;
    margin-bottom: 4px;
  }
  .welcome-logo img {
    height: 32px;
  }

  /* Agent cards — single column on mobile */
  .welcome-agents {
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 100%;
  }
  .agent-card {
    padding: 12px 14px;
    gap: 12px;
  }
  .agent-card-icon {
    width: 36px;
    height: 36px;
  }
  .agent-card-name {
    font-size: 13px;
  }
  .agent-card-desc {
    font-size: 12px;
    -webkit-line-clamp: 1;
  }

  /* Suggestions — horizontal scroll on mobile */
  .welcome-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .welcome-suggestions::-webkit-scrollbar {
    display: none;
  }
  .suggestion-card {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12.5px;
  }

  /* Input area */
  .input-area {
    padding: 0 10px 12px;
  }
  .input-wrapper {
    padding: 4px 4px 4px 14px;
    border-radius: 22px;
  }
  .input-wrapper textarea {
    font-size: 14px;
    padding: 6px 0;
  }
  .btn-send-round {
    width: 34px;
    height: 34px;
  }
  .input-hint {
    font-size: 10px;
  }

  /* User message bubbles */
  .msg-user .msg-bubble {
    max-width: 92%;
    padding: 10px 14px;
    font-size: 14px;
  }

  /* MCP preview */
  .msg-preview {
    padding: 14px;
  }
  .msg-preview .preview-data {
    max-height: 180px;
    font-size: 11px;
    padding: 10px;
  }

  /* Onboarding on mobile */
  .onboarding-container {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    flex-direction: column;
  }
  .onboarding-left {
    width: 100%;
    padding: 20px 16px 12px;
    max-height: 120px;
  }
  .onboarding-brand h1 {
    font-size: 16px;
  }
  .onboarding-subtitle {
    margin-bottom: 10px;
    font-size: 11px;
  }
  .onboarding-messages {
    padding: 12px 16px;
  }
  .onboarding-input {
    padding: 12px 12px 16px;
    gap: 8px;
  }
  .onboarding-input textarea {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Typing bar */
  .typing-bar {
    padding: 6px 16px;
    font-size: 12px;
  }
}

/* ============================================================
   Document Preview Panel — Side panel droit (style Claude artifacts)
   ============================================================ */

.document-panel {
  width: 0;
  min-width: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.document-panel.open {
  width: 45%;
  min-width: 380px;
  max-width: 600px;
}

.document-panel.hidden {
  display: none;
}

.document-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.document-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.document-panel-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-panel-title svg {
  flex-shrink: 0;
  color: var(--abby-blue);
}

.document-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.document-panel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

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

.document-panel-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #F5F5F5;
}

.document-panel-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #F5F5F5;
}

.document-panel-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  z-index: 1;
}

.document-panel-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--abby-blue);
  border-radius: 50%;
  animation: doc-spin 0.8s linear infinite;
}

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

/* Dashboard panel — HTML content instead of iframe */
.document-panel-dashboard {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: var(--surface);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text);
  box-sizing: border-box;
}

.document-panel-dashboard.hidden {
  display: none;
}

/* Dashboard components */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard-kpi {
  background: var(--bg-start);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.dashboard-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dashboard-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--abby-navy);
  line-height: 1.2;
}

.dashboard-kpi-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.dashboard-kpi-change.up { color: var(--success); }
.dashboard-kpi-change.down { color: var(--danger); }
.dashboard-kpi-change.neutral { color: var(--text-muted); }

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

.dashboard-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--abby-navy);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

/* Bar chart */
.dashboard-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-bar-label {
  width: 80px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-bar-track {
  flex: 1;
  height: 22px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.dashboard-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--abby-blue);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}

.dashboard-bar-fill.alt1 { background: var(--abby-blue-200); }
.dashboard-bar-fill.alt2 { background: var(--purple); }
.dashboard-bar-fill.alt3 { background: var(--success); }
.dashboard-bar-fill.danger { background: var(--danger); }

.dashboard-bar-value {
  width: 70px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

/* Horizontal line chart via SVG */
.dashboard-chart-svg {
  width: 100%;
  height: auto;
}

.dashboard-chart-svg text {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  fill: var(--text-muted);
}

.dashboard-chart-svg .chart-line {
  fill: none;
  stroke: var(--abby-blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-chart-svg .chart-area {
  fill: var(--abby-blue-light);
  opacity: 0.4;
}

.dashboard-chart-svg .chart-grid {
  stroke: var(--border-light);
  stroke-width: 1;
}

.dashboard-chart-svg .chart-dot {
  fill: var(--abby-blue);
  stroke: white;
  stroke-width: 2;
}

/* Table in dashboard */
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dashboard-table th {
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.dashboard-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

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

.dashboard-table .amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Donut / pie via SVG */
.dashboard-donut-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dashboard-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.dashboard-donut-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Alert / callout */
.dashboard-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.dashboard-alert.info { background: var(--abby-blue-50); color: var(--abby-navy); border-left: 3px solid var(--abby-blue); }
.dashboard-alert.warning { background: var(--warning-light); color: #92400E; border-left: 3px solid var(--warning); }
.dashboard-alert.danger { background: var(--danger-light); color: #991B1B; border-left: 3px solid var(--danger); }
.dashboard-alert.success { background: var(--success-light); color: #166534; border-left: 3px solid var(--success); }

/* When panel is open, chat area adapts */
#app.has-document-panel main#chat-main {
  /* Chat shrinks naturally via flex */
}

/* ============================================================
   Document Card — Inline chat attachment (style Claude artifacts)
   ============================================================ */

.msg-document-card {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--chat-max-width);
  margin: 8px auto;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.msg-document-card:hover {
  border-color: var(--abby-blue);
  box-shadow: 0 0 0 1px var(--abby-blue-200);
}

.document-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--abby-blue-50);
  border-radius: var(--radius-sm);
  color: var(--abby-blue);
  flex-shrink: 0;
}

.document-card-icon-dashboard {
  background: var(--purple-light);
  color: var(--purple);
}

.document-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.document-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.document-card-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.document-card-download:hover {
  background: var(--abby-blue-50);
  color: var(--abby-blue);
}

/* ============================================================
   Company Search Results — cards entreprise SIRENE
   ============================================================ */

.company-results-container {
  max-width: var(--chat-max-width);
  margin: 12px auto;
}

.company-results-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.company-results-query {
  font-weight: 400;
  color: var(--text-muted);
}

.company-results-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
}

.company-results-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.company-card:hover {
  border-color: var(--abby-blue-200);
  box-shadow: 0 0 0 1px var(--abby-blue-100);
}

.company-card-selected {
  border-color: var(--abby-blue);
  box-shadow: 0 0 0 2px var(--abby-blue-200);
  background: var(--abby-blue-50);
}

.company-card-inactive {
  opacity: 0.6;
}

.company-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

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

.company-card-commercial {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.company-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

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

.company-status-inactive {
  background: var(--danger-light);
  color: var(--danger);
}

.company-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.company-card-detail {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.company-detail-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 60px;
  flex-shrink: 0;
}

.company-card-detail > span:last-child {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-card-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--abby-blue);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.company-card-select:hover {
  background: var(--abby-blue-hover);
  transform: translateY(-1px);
}

.company-card-selected .company-card-select {
  background: var(--success);
}

.company-search-again {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 0 2px;
}

.company-search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}

.company-search-input:focus {
  border-color: var(--abby-blue);
}

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

.company-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.company-search-btn:hover {
  border-color: var(--abby-blue);
  color: var(--abby-blue);
}

/* ============================================================
   Data Card — Styled key-value tables (invoices, summaries)
   ============================================================ */

.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
}

.data-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--abby-blue-50);
  border-bottom: 1px solid var(--border-light);
}

.data-card-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--abby-blue);
  border-radius: var(--radius-sm);
  color: white;
  flex-shrink: 0;
}

.data-card-header-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--abby-navy);
}

.data-card-rows {
  padding: 4px 0;
}

.data-card-row {
  display: flex;
  align-items: baseline;
  padding: 8px 16px;
  gap: 12px;
  transition: background var(--transition);
}

.data-card-row:hover {
  background: var(--surface-hover);
}

.data-card-row + .data-card-row {
  border-top: 1px solid var(--border-light);
}

.data-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 120px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-card-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  word-break: break-word;
}

.data-card-value.amount {
  font-weight: 700;
  color: var(--abby-navy);
  font-size: 14px;
}

.data-card-value.status-draft {
  color: var(--warning);
  font-weight: 600;
}

.data-card-value.status-sent {
  color: var(--abby-blue);
  font-weight: 600;
}

.data-card-value.status-paid,
.data-card-value.status-finalized {
  color: var(--success);
  font-weight: 600;
}

/* Multi-column table inside data-card */
.data-card-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-card-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-card-table thead th {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-card-table tbody td {
  padding: 8px 16px;
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--border-light);
}

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

.data-card-table tbody tr:hover td {
  background: var(--surface-hover);
}

.data-card-table td.amount {
  font-weight: 700;
  color: var(--abby-navy);
}

.data-card-table td.status-draft {
  color: var(--warning);
  font-weight: 600;
}

.data-card-table td.status-sent {
  color: var(--abby-blue);
  font-weight: 600;
}

.data-card-table td.status-paid {
  color: var(--success);
  font-weight: 600;
}

/* Mobile: document panel full-screen overlay */
@media (max-width: 480px) {
  .document-panel.open {
    position: fixed;
    inset: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    z-index: 200;
    border-left: none;
  }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 481px) {
  .mobile-menu-btn {
    display: none !important;
  }
  .sidebar-backdrop {
    display: none !important;
  }
}

/* ============================================================
   Integrations Hub — Marketplace
   ============================================================ */

.integrations-hub {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px;
}

.integrations-hub h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.integrations-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 32px;
}

.integrations-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.integrations-category {
  margin-bottom: 28px;
}

.integrations-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.integrations-category-header svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.integration-card:hover {
  border-color: var(--abby-blue-200);
  box-shadow: var(--shadow-sm);
}

.integration-card[data-status="connected"] {
  border-color: var(--success);
  border-left: 3px solid var(--success);
}

.integration-card[data-status="error"] {
  border-color: var(--danger);
  border-left: 3px solid var(--danger);
}

.integration-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.integration-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
}

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

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

.integration-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.integration-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.integration-email {
  font-size: 12px;
  color: var(--abby-blue);
  margin-top: 4px;
  font-weight: 500;
}

.integration-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-connected {
  background: var(--success-light);
  color: #16a34a;
}

.status-syncing {
  background: var(--abby-blue-50);
  color: var(--abby-blue);
}

.status-error {
  background: var(--danger-light);
  color: #dc2626;
}

.status-disconnected {
  background: var(--border-light);
  color: var(--text-muted);
}

.integration-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

.integration-features {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-actions {
  flex-shrink: 0;
  margin-left: 12px;
}

.btn-integration {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.btn-integration:active {
  transform: scale(0.97);
}

.btn-integration-connect {
  background: var(--abby-blue);
  color: #fff;
}

.btn-integration-connect:hover {
  background: var(--abby-blue-hover);
}

.btn-integration-disconnect {
  background: var(--border-light);
  color: var(--text-secondary);
}

.btn-integration-disconnect:hover {
  background: var(--danger-light);
  color: #dc2626;
}

.btn-integration-reconnect {
  background: var(--warning-light);
  color: #b45309;
}

.btn-integration-reconnect:hover {
  background: var(--warning);
  color: #fff;
}

@media (max-width: 480px) {
  .integrations-hub {
    padding: 24px 16px;
  }
  .integration-card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .integration-actions {
    margin-left: 0;
    width: 100%;
  }
  .btn-integration {
    width: 100%;
    text-align: center;
  }
}
