/* ═══════════════════════════════════════════════════════════════════════════
   SCAPBOT DESIGN SYSTEM - Clean Minimalism
   No build required - Works with Tailwind CDN

   COLOR ARCHITECTURE:
   - Single Source of Truth: :root CSS variables below
   - Format: RGB channels (for Tailwind opacity modifier support)
   - Usage:  rgb(var(--color-primary-600))         → solid color
             rgb(var(--color-primary-600) / 0.1)   → with alpha
   - Đổi brand color: chỉ sửa :root → toàn bộ website tự cập nhật
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES — :root (Single Source of Truth)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Primary — Indigo */
  --color-primary-50: 238 242 255;    /* #eef2ff */
  --color-primary-100: 224 231 255;   /* #e0e7ff */
  --color-primary-200: 199 210 254;   /* #c7d2fe */
  --color-primary-300: 165 180 252;   /* #a5b4fc */
  --color-primary-400: 129 140 248;   /* #818cf8 */
  --color-primary-500: 99 102 241;    /* #6366f1 */
  --color-primary-600: 79 70 229;     /* #4f46e5 */
  --color-primary-700: 67 56 202;     /* #4338ca */
  --color-primary-800: 55 48 163;     /* #3730a3 */
  --color-primary-900: 49 46 129;     /* #312e81 */
  --color-primary-950: 30 27 75;      /* #1e1b4b */

  /* Surface — Slate */
  --color-surface-50: 248 250 252;    /* #f8fafc */
  --color-surface-100: 241 245 249;   /* #f1f5f9 */
  --color-surface-200: 226 232 240;   /* #e2e8f0 */
  --color-surface-300: 203 213 225;   /* #cbd5e1 */
  --color-surface-400: 148 163 184;   /* #94a3b8 */
  --color-surface-500: 100 116 139;   /* #64748b */
  --color-surface-600: 71 85 105;     /* #475569 */
  --color-surface-700: 51 65 85;      /* #334155 */
  --color-surface-800: 30 41 59;      /* #1e293b */
  --color-surface-900: 15 23 42;      /* #0f172a */
  --color-surface-950: 2 6 23;        /* #020617 */

  /* Accent — Emerald */
  --color-accent-50: 236 253 245;     /* #ecfdf5 */
  --color-accent-100: 209 250 229;    /* #d1fae5 */
  --color-accent-200: 167 243 208;    /* #a7f3d0 */
  --color-accent-300: 110 231 183;    /* #6ee7b7 */
  --color-accent-400: 52 211 153;     /* #34d399 */
  --color-accent-500: 16 185 129;     /* #10b981 */
  --color-accent-600: 5 150 105;      /* #059669 */
  --color-accent-700: 4 120 87;       /* #047857 */
  --color-accent-800: 6 95 70;        /* #065f46 */
  --color-accent-900: 6 78 59;        /* #064e3b */

  /* Semantic — Error (Red) */
  --color-error-50: 254 242 242;      /* #fef2f2 */
  --color-error-300: 252 165 165;     /* #fca5a5 */
  --color-error-500: 239 68 68;       /* #ef4444 */
  --color-error-600: 220 38 38;       /* #dc2626 */
  --color-error-700: 185 28 28;       /* #b91c1c */
  --color-error-800: 153 27 27;       /* #991b1b */

  /* Semantic — Warning (Amber) */
  --color-warning-50: 255 251 235;    /* #fffbeb */
  --color-warning-800: 146 64 14;     /* #92400e */

  /* Semantic — Info (Blue) */
  --color-info-50: 239 246 255;       /* #eff6ff */
  --color-info-800: 30 64 175;        /* #1e40af */

  /* Decorative — Orbs */
  --color-violet-500: 139 92 246;     /* #8b5cf6 */
  --color-blue-500: 59 130 246;       /* #3b82f6 */
  --color-cyan-500: 6 182 212;        /* #06b6d4 */
  --color-pink-500: 236 72 153;       /* #ec4899 */
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  scroll-behavior: smooth;
}

/* Global thin scrollbar — consistent across entire site */
* {
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--color-surface-300)) transparent;
}
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgb(var(--color-surface-300));
  border-radius: 9999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-surface-400));
}
.dark *,
.dark {
  scrollbar-color: rgb(var(--color-surface-600)) transparent;
}
.dark *::-webkit-scrollbar-thumb {
  background: rgb(var(--color-surface-600));
}
.dark *::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--color-surface-500));
}

::selection {
  background-color: rgb(var(--color-primary-100));
  color: rgb(var(--color-primary-900));
}

/* Alpine.js cloak — hide elements until Alpine initializes */
[x-cloak] { display: none !important; }

/* Lottie FOUC Prevention — reserve space before web component loads */
dotlottie-player:not(:defined) {
  display: block;
  width: 120px;
  height: 120px;
}

/* Lucide Icon FOUC Prevention — <i> is inline (ignores width/height).
   inline-block makes Tailwind w-4/h-4 reserve 16×16px space BEFORE
   lucide.createIcons() replaces <i> with <svg>. No layout shift. */
i[data-lucide] {
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Base button styles - shared by all button variants */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease-out;
  cursor: pointer;
  border: none;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button - Indigo */
.btn-primary {
  background-color: rgb(var(--color-primary-600));
  color: white;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-primary:hover:not(:disabled) {
  background-color: rgb(var(--color-primary-700));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-primary:active:not(:disabled) {
  background-color: rgb(var(--color-primary-800));
}

/* Secondary Button - Outlined */
.btn-secondary {
  background-color: white;
  color: rgb(var(--color-surface-700));
  border: 1px solid rgb(var(--color-surface-200));
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgb(var(--color-surface-50));
  border-color: rgb(var(--color-surface-300));
}

/* Ghost Button - Transparent */
.btn-ghost {
  background-color: transparent;
  color: rgb(var(--color-surface-600));
}

.btn-ghost:hover:not(:disabled) {
  background-color: rgb(var(--color-surface-100));
  color: rgb(var(--color-surface-900));
}

/* Danger Button - Red */
.btn-danger {
  background-color: rgb(var(--color-error-600));
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: rgb(var(--color-error-700));
}

/* ═══════════════════════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════════════════════ */

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: white;
  border: 1px solid rgb(var(--color-surface-200));
  border-radius: 0.75rem;
  color: rgb(var(--color-surface-900));
  font-size: 1rem;
  transition: all 0.2s;
}

.input::placeholder {
  color: rgb(var(--color-surface-400));
}

.input:hover {
  border-color: rgb(var(--color-surface-300));
}

.input:focus {
  outline: none;
  border-color: rgb(var(--color-primary-500));
  box-shadow: 0 0 0 3px rgb(var(--color-primary-500) / 0.1);
}

.input-error {
  border-color: rgb(var(--color-error-300));
}

.input-error:focus {
  border-color: rgb(var(--color-error-500));
  box-shadow: 0 0 0 3px rgb(var(--color-error-500) / 0.1);
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(var(--color-surface-700));
  margin-bottom: 0.375rem;
}

.input-hint {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: rgb(var(--color-surface-500));
}

.input-error-text {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: rgb(var(--color-error-600));
}

/* --- Checkbox Custom --- */
.checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid rgb(var(--color-surface-300));
  border-radius: 0.375rem;
  background-color: white;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.checkbox:hover {
  border-color: rgb(var(--color-primary-400));
}

.checkbox:focus {
  outline: none;
  border-color: rgb(var(--color-primary-500));
  box-shadow: 0 0 0 3px rgb(var(--color-primary-500) / 0.1);
}

.checkbox:checked {
  background-color: rgb(var(--color-primary-600));
  border-color: rgb(var(--color-primary-600));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.checkbox:checked:hover {
  background-color: rgb(var(--color-primary-700));
  border-color: rgb(var(--color-primary-700));
}

.checkbox:indeterminate {
  background-color: rgb(var(--color-primary-600));
  border-color: rgb(var(--color-primary-600));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Crect x='3' y='7' width='10' height='2' rx='1'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  background-color: white;
  border-radius: 1rem;
}

.card-hover {
  transition: all 0.2s;
}

.card-hover:hover {
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LINKS
   ═══════════════════════════════════════════════════════════════════════════ */

.link {
  color: rgb(var(--color-primary-600));
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.link:hover {
  color: rgb(var(--color-primary-700));
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════════════════════════ */

.spinner {
  border-radius: 50%;
  border: 2px solid rgb(var(--color-surface-200));
  border-top-color: rgb(var(--color-primary-600));
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 1rem;
  height: 1rem;
}

.spinner-md {
  width: 1.5rem;
  height: 1.5rem;
}

.spinner-lg {
  width: 2rem;
  height: 2rem;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */

.alert,
.alert-info,
.alert-success,
.alert-warning,
.alert-error {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.75rem;
}

.alert-info {
  background-color: rgb(var(--color-info-50));
  color: rgb(var(--color-info-800));
}

.alert-success {
  background-color: rgb(var(--color-accent-50));
  color: rgb(var(--color-accent-800));
}

.alert-warning {
  background-color: rgb(var(--color-warning-50));
  color: rgb(var(--color-warning-800));
}

.alert-error {
  background-color: rgb(var(--color-error-50));
  color: rgb(var(--color-error-800));
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH PAGES - Modern Tech Background
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  /* Gradient background */
  background: linear-gradient(
    135deg,
    rgb(var(--color-surface-900)) 0%,
    rgb(var(--color-surface-800)) 50%,
    rgb(var(--color-surface-900)) 100%
  );
}

/* Animated mesh gradient overlay */
.auth-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgb(var(--color-primary-500) / 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgb(var(--color-violet-500) / 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgb(var(--color-blue-500) / 0.1) 0%, transparent 60%);
  animation: meshMove 15s ease-in-out infinite;
  pointer-events: none;
}

/* Grid pattern overlay */
.auth-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgb(var(--color-primary-500) / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--color-primary-500) / 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

@keyframes meshMove {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(-20px, 10px) scale(1.02);
  }
  66% {
    transform: translate(20px, -10px) scale(0.98);
  }
}

/* Floating orbs */
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
}

.auth-orb-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, rgb(var(--color-primary-500)), rgb(var(--color-violet-500)));
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.auth-orb-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, rgb(var(--color-blue-500)), rgb(var(--color-cyan-500)));
  bottom: -50px;
  right: -50px;
  animation-delay: -5s;
}

.auth-orb-3 {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, rgb(var(--color-violet-500)), rgb(var(--color-pink-500)));
  top: 50%;
  right: 20%;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(30px, -30px) rotate(5deg);
  }
  50% {
    transform: translate(-20px, 20px) rotate(-5deg);
  }
  75% {
    transform: translate(20px, 30px) rotate(3deg);
  }
}

/* Auth card - white background */
.auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 28rem;
  background: white;
  border-radius: 1.5rem;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 2.5rem;
  animation: cardSlideUp 0.5s ease-out;
}

/* Wider variant for onboarding (glassmorphism, fit-content) */
.centered-card-wide {
  max-width: fit-content;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 25px 60px -12px rgba(0, 0, 0, 0.2),
    0 8px 24px -4px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.dark .centered-card-wide {
  background: rgba(var(--color-surface-800), 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 25px 60px -12px rgba(0, 0, 0, 0.5),
    0 8px 24px -4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: rgb(var(--color-surface-900));
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.auth-subtitle {
  color: rgb(var(--color-surface-500));
  font-size: 0.95rem;
}

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

/* Dark mode support */
.dark .auth-container {
  background: linear-gradient(
    135deg,
    rgb(var(--color-surface-950)) 0%,
    rgb(var(--color-surface-900)) 50%,
    rgb(var(--color-surface-950)) 100%
  );
}

.dark .auth-card {
  background: rgb(var(--color-surface-800));
}

.dark .auth-title {
  color: rgb(var(--color-surface-50));
}

.dark .auth-subtitle {
  color: rgb(var(--color-surface-400));
}

/* ═══════════════════════════════════════════════════════════════════════════
   OTP INPUT
   ═══════════════════════════════════════════════════════════════════════════ */

.otp-input {
  width: 3rem;
  height: 3.5rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  background: white;
  border: 2px solid rgb(var(--color-surface-200));
  border-radius: 0.75rem;
  color: rgb(var(--color-surface-900));
  transition: all 0.2s;
}

.otp-input:focus {
  outline: none;
  border-color: rgb(var(--color-primary-500));
  box-shadow: 0 0 0 3px rgb(var(--color-primary-500) / 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   INDUSTRY CARDS (Onboarding)
   ═══════════════════════════════════════════════════════════════════════════ */

.industry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  border: 1.5px solid rgb(var(--color-surface-200));
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  aspect-ratio: 3 / 2;
}

.industry-card:hover {
  border-color: rgb(var(--color-primary-300));
  background: rgba(var(--color-primary-50), 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(var(--color-primary-500) / 0.1);
}

.industry-card.selected {
  border-color: rgb(var(--color-primary-500));
  background: rgba(var(--color-primary-50), 0.9);
  box-shadow:
    0 0 0 3px rgb(var(--color-primary-500) / 0.15),
    0 4px 16px rgb(var(--color-primary-500) / 0.12);
  transform: translateY(-2px);
}

.industry-card i,
.industry-card svg {
  transition: transform 0.2s ease;
}

.industry-card:hover i,
.industry-card:hover svg,
.industry-card.selected i,
.industry-card.selected svg {
  transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AVATAR PICKER (Onboarding)
   ═══════════════════════════════════════════════════════════════════════════ */

.avatar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

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

.avatar-option.selected {
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEMO CHAT PAGE - Uses auth background + glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */

.demo-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 56rem;
  height: 92vh;
  max-height: 900px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgb(var(--color-surface-200) / 0.8);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
}

.demo-card-body {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* demo-card-body scrollbar — handled by global * rule */

.demo-card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgb(var(--color-surface-200) / 0.8);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
}

/* Chat bubbles */
.chat-bubble-user {
  background: linear-gradient(135deg, rgb(var(--color-primary-500)), rgb(var(--color-primary-600)));
  color: white;
  border-radius: 1.25rem 1.25rem 0.375rem 1.25rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 8px rgb(var(--color-primary-500) / 0.3);
  animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-bubble-assistant {
  background: white;
  color: rgb(var(--color-surface-800));
  border-radius: 1.25rem 1.25rem 1.25rem 0.375rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgb(var(--color-surface-200));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Assistant card in selector */
.assistant-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border: 2px solid rgb(var(--color-surface-200));
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s ease-out;
  background: white;
}

.assistant-card:hover {
  border-color: rgb(var(--color-primary-300));
  background: rgb(var(--color-primary-50));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(var(--color-primary-500) / 0.12);
}

.assistant-card.selected {
  border-color: rgb(var(--color-primary-500));
  background: rgb(var(--color-primary-50));
  box-shadow: 0 0 0 3px rgb(var(--color-primary-500) / 0.15);
}

/* Typing dots */
.typing-dot {
  width: 0.375rem;
  height: 0.375rem;
  background: rgb(var(--color-surface-400));
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

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

/* Messaging composer — AI mode typing dots (smaller, subtle, inline with text) */
.msg-typing-dot {
  opacity: 0.5;
  animation: msgTypingBounce 1.4s ease-in-out infinite;
}
@keyframes msgTypingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-2.5px); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT DASHBOARD - ChatGPT-style chat inside layouts.User() wrapper
   ═══════════════════════════════════════════════════════════════════════════ */

/* Wrapper: offset user.templ <main> padding, fill full viewport (no topbar) */
.chat-dashboard-wrapper {
  margin: -1rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Top Action Bar — flex row, right-aligned */
.chat-top-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem 0.75rem;
  shrink: 0;
  z-index: 10;
}
/* Mobile: leave space for hamburger menu (fixed top-3 left-3 z-30) */
@media (max-width: 1023px) {
  .chat-top-bar {
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
  }
  .chat-top-bar::before {
    content: '';
    width: 2.5rem; /* spacer for hamburger */
  }
}
.chat-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  color: rgb(var(--color-surface-500));
  cursor: pointer;
  transition: all 0.15s;
}
.chat-top-btn:hover {
  background: rgb(var(--color-surface-100));
  color: rgb(var(--color-surface-700));
}
.chat-top-btn-primary {
  background: rgb(var(--color-surface-100));
  color: rgb(var(--color-surface-700));
}
.chat-top-btn-primary:hover {
  background: rgb(var(--color-surface-200));
}
@media (min-width: 640px) {
  .chat-dashboard-wrapper { margin: -1.5rem; }
}
@media (min-width: 1024px) {
  .chat-dashboard-wrapper { margin: -2rem; }
}

/* Scrollable messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
}

/* chat-messages scrollbar — handled by global * rule */

/* Input area: bottom of chat */
.chat-input-area {
  padding: 0.75rem 1.5rem 1.5rem;
  max-width: 48rem;
  margin: 0 auto;
  width: 100%;
}

/* Textarea container with rounded border */
.chat-textarea-container {
  border: 1px solid rgb(var(--color-surface-300));
  border-radius: 1.5rem;
  background: white;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-textarea-container:focus-within {
  border-color: rgb(var(--color-surface-400));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Auto-resize textarea */
.chat-textarea {
  resize: none;
  border: none;
  outline: none;
  width: 100%;
  min-height: 52px;
  max-height: 200px;
  padding: 0.875rem 1rem 0.25rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  background: transparent;
  font-family: inherit;
  color: rgb(var(--color-surface-900));
}
.chat-textarea::placeholder {
  color: rgb(var(--color-surface-400));
}

/* Toolbar row inside textarea container */
.chat-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.5rem 0.5rem;
}

/* Circular send button */
.chat-send-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  background: rgb(var(--color-surface-200));
  color: rgb(var(--color-surface-400));
}
.chat-send-btn.active {
  background: rgb(var(--color-primary-600));
  color: white;
}
.chat-send-btn.active:hover {
  background: rgb(var(--color-primary-700));
}

/* Attach button */
.chat-attach-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: rgb(var(--color-surface-400));
}
.chat-attach-btn:hover {
  background: rgb(var(--color-surface-100));
  color: rgb(var(--color-surface-600));
}

/* Compact Assistant Selector in input toolbar */
.chat-assistant-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  border: 1px solid rgb(var(--color-surface-200));
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-assistant-compact:hover {
  border-color: rgb(var(--color-surface-300));
  background: rgb(var(--color-surface-50));
}

/* Quick Prompt Cards — large, refined */
.chat-quick-card {
  min-height: 90px;
  border: 1px solid rgb(var(--color-surface-200));
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  text-align: left;
}
.chat-quick-card:hover {
  border-color: rgb(var(--color-surface-300));
  background: rgb(var(--color-surface-50));
}

/* History Drawer — slides from right */
.chat-history-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 100%;
  background: white;
  border-left: 1px solid rgb(var(--color-surface-200));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  z-index: 20;
  display: flex;
  flex-direction: column;
}
@media (max-width: 639px) {
  .chat-history-drawer {
    width: 100%;
    border-left: none;
  }
}

/* History Item */
.chat-history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-history-item:hover {
  background: rgb(var(--color-surface-50));
}

/* ═══════════════════════════════════════════════════════════════════════════
   QR SCANNER EFFECT
   Corner brackets + scan line animation for professional QR display
   ═══════════════════════════════════════════════════════════════════════════ */

.qr-scanner-frame {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  padding: 2px;
}

/* Corner brackets — 4 L-shaped borders */
.qr-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  z-index: 2;
}
.qr-corner-tl {
  top: 0; left: 0;
  border-top: 3px solid rgb(var(--color-primary-500));
  border-left: 3px solid rgb(var(--color-primary-500));
  border-top-left-radius: 0.75rem;
}
.qr-corner-tr {
  top: 0; right: 0;
  border-top: 3px solid rgb(var(--color-primary-500));
  border-right: 3px solid rgb(var(--color-primary-500));
  border-top-right-radius: 0.75rem;
}
.qr-corner-bl {
  bottom: 0; left: 0;
  border-bottom: 3px solid rgb(var(--color-primary-500));
  border-left: 3px solid rgb(var(--color-primary-500));
  border-bottom-left-radius: 0.75rem;
}
.qr-corner-br {
  bottom: 0; right: 0;
  border-bottom: 3px solid rgb(var(--color-primary-500));
  border-right: 3px solid rgb(var(--color-primary-500));
  border-bottom-right-radius: 0.75rem;
}

/* Scan line — ping-pong sweep (top ↓ bottom ↑ top, infinite loop) */
/* Note: Use hardcoded rgba() inside gradients for browser compatibility */
.qr-scan-line {
  position: absolute;
  top: 4px;
  left: 6px;
  right: 6px;
  height: 4px;
  z-index: 3;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(99, 102, 241, 0.2) 10%,
    rgba(99, 102, 241, 0.45) 50%,
    rgba(99, 102, 241, 0.2) 90%,
    transparent 100%
  );
  filter: blur(1.5px);
  box-shadow:
    0 0 10px rgba(99, 102, 241, 0.3),
    0 0 30px rgba(99, 102, 241, 0.15),
    0 0 50px rgba(99, 102, 241, 0.05);
  animation: qr-scan 3s ease-in-out infinite;
}

@keyframes qr-scan {
  0%   { top: 4px; }
  50%  { top: calc(100% - 8px); }
  100% { top: 4px; }
}

/* Subtle pulse glow on the frame */
.qr-scanner-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.15);
  pointer-events: none;
  z-index: 1;
  animation: qr-glow 3s ease-in-out infinite;
}

@keyframes qr-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.1); }
  50% { box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.3), 0 0 12px rgba(99, 102, 241, 0.1); }
}

/* Dark mode adjustments */
.dark .qr-corner-tl,
.dark .qr-corner-tr,
.dark .qr-corner-bl,
.dark .qr-corner-br {
  border-color: rgb(var(--color-primary-400));
}

.dark .qr-scan-line {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(129, 140, 248, 0.25) 10%,
    rgba(129, 140, 248, 0.5) 50%,
    rgba(129, 140, 248, 0.25) 90%,
    transparent 100%
  );
  box-shadow:
    0 0 10px rgba(129, 140, 248, 0.35),
    0 0 30px rgba(129, 140, 248, 0.18),
    0 0 50px rgba(129, 140, 248, 0.08);
}

.dark .qr-scanner-frame::after {
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.2);
  animation: qr-glow-dark 3s ease-in-out infinite;
}

@keyframes qr-glow-dark {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.1); }
  50% { box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.4), 0 0 16px rgba(129, 140, 248, 0.2); }
}

/* QR scan effect: subtle decorative animation — always enabled */

/* ═══════════════════════════════════════════════════════════════════════════
   PERFORMANCE PAGE — 2-panel layout (stats + chat)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Wrapper: same negative-margin technique as messaging-wrapper */
.perf-wrapper {
  position: relative; /* anchor for mobile/tablet chat overlay */
  margin: -4.5rem -1rem -1rem -1rem;
  padding-top: 3.5rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 640px) {
  .perf-wrapper { margin: -4.5rem -1.5rem -1.5rem -1.5rem; }
}
@media (min-width: 1024px) {
  .perf-wrapper {
    margin: -2rem;
    padding-top: 0;
    flex-direction: row;
  }
}

/* Panel 1 (left): fixed header + scrollable content */
.perf-panel-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Bot Chat Panel (shared: admin + assistant) ──
   Drawer overlay toggled via BotLogo button.
   Mobile: full overlay | md: 50% right | lg+: fixed 400px drawer.
   Inline pages (body[data-panel-inline="true"]): seamless at xl+.
   sidebar-content gets xl:pr-[400px] via Alpine (sidebarContentClass) on inline pages. */
.bot-chat-panel {
  position: fixed;
  right: 0;
  top: 3.5rem; /* below mobile topbar h-14 */
  bottom: 0;
  left: 0;
  z-index: 30; /* above main content, below modals (z-50) */

  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid rgb(var(--color-surface-200));
  background-color: white;
  overflow-y: auto;
}
@media (min-width: 768px) {
  .bot-chat-panel {
    left: auto;
    width: 50%;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  }
}
@media (min-width: 1024px) {
  /* lg: overlay drawer, top:0 (no mobile topbar), fixed 400px width */
  .bot-chat-panel {
    top: 0;
    width: 400px;
  }
}
@media (min-width: 1280px) {
  /* xl+, inline pages (performance/dashboard): seamless panel (no shadow, no overlay z-index) */
  body[data-panel-inline="true"] .bot-chat-panel {
    z-index: auto;
    box-shadow: none;
  }
}
.dark .bot-chat-panel {
  border-left-color: rgb(var(--color-surface-700));
  background-color: rgb(var(--color-surface-800));
}
/* FOUC: hidden before body.ready */
body:not(.ready) .bot-chat-panel {
  display: none !important;
}
/* Instant layout changes during HTMX page navigation.
   Prevents chat panel slide-out and sidebar-content padding animation
   when navigating between pages. Manual BotLogo toggle keeps animation.
   Scoped by data-panel-inline: only hide/reset when LEAVING inline page.
   When staying on inline page, panel + padding are preserved (no flash). */
body.htmx-nav .bot-chat-panel,
body.htmx-nav .sidebar-content {
  transition-duration: 0s !important;
}
body.htmx-nav:not([data-panel-inline="true"]) .bot-chat-panel {
  visibility: hidden !important;
}
body.htmx-nav:not([data-panel-inline="true"]) .sidebar-content {
  padding-right: 0 !important;
}
/* Going TO inline page: force panel visible + positioned instantly (no Alpine x-transition).
   display:block !important overrides Alpine's inline display:none from x-show.
   transform+opacity override x-transition:enter-start classes (translate-x-full opacity-0). */
body.htmx-nav[data-panel-inline="true"] .bot-chat-panel {
  display: block !important;
  transform: translateX(0) !important;
  opacity: 1 !important;
}
@media (min-width: 1280px) {
  /* Going TO inline page: set padding instantly (no Alpine delay) */
  body.htmx-nav[data-panel-inline="true"] .sidebar-content {
    padding-right: 400px !important;
  }
  /* Inline pages xl+: push sidebar-content right before ready (prevent layout shift) */
  body:not(.ready)[data-panel-inline="true"] .sidebar-content {
    padding-right: 400px;
  }
}

/* Panel 2 (right): chat — drawer overlay until xl, inline from xl+.
   Same responsive pattern as messaging info panel (cssMsgInfoPanel).
   Mobile: full overlay | md: half overlay | lg: half overlay, top:0 | xl: inline 400px */
.perf-panel-right {
  /* Mobile: absolute overlay below mobile topbar (h-14 = 3.5rem) */
  position: absolute;
  left: 0;
  right: 0;
  top: 3.5rem;
  bottom: 0;
  z-index: 20;

  flex-shrink: 0;
  border-left: 1px solid rgb(var(--color-surface-200));
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: white;
  overflow-y: auto;
}
@media (min-width: 768px) {
  /* Tablet: overlay right half, with shadow */
  .perf-panel-right {
    left: auto;
    width: 50%;
    /* shadow-xl — exact Tailwind standard, same as messaging info panel (md:shadow-xl) */
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  }
}
@media (min-width: 1024px) {
  /* lg: still overlay drawer, but top:0 (no mobile topbar at lg+) */
  .perf-panel-right { top: 0; }
}
@media (min-width: 1280px) {
  /* xl: inline panel in flex-row layout */
  .perf-panel-right {
    position: relative;
    inset: auto;
    width: 400px;
    z-index: auto;
    box-shadow: none;
    overflow-y: hidden;
  }
}
/* ═══════ FOUC Prevention ═══════
   NOTE: Universal rule `body:not(.ready) #main-content { opacity: 0 }` lives in
   shared.templ inline <style> — NOT here. Inline = available before first paint on all devices.
   Only layout-specific rules below (need media queries + multiple properties). */

/* Performance chat panel (BotChatPanel): layout-specific rules.
   Panel uses absolute on <xl, relative on xl+. CSS must match initial Alpine state
   (botPanel: innerWidth >= 1280) to prevent layout shift on handoff. */
body:not(.ready) .perf-panel-right {
  display: none !important;
}
@media (min-width: 1280px) {
  body:not(.ready) .perf-panel-right {
    display: flex !important;
    position: relative;
    inset: auto;
    width: 400px;
    z-index: auto;
    box-shadow: none;
    overflow-y: hidden;
  }
}
.dark .perf-panel-right {
  border-left-color: rgb(var(--color-surface-700));
  background-color: rgb(var(--color-surface-800));
}

/* ── Widget Dashboard (Panel 1) ── */

.widget-card {
  background: white;
  border-radius: 1rem;
  border: 1px solid rgb(var(--color-surface-200));
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.dark .widget-card {
  background: rgb(var(--color-surface-800));
  border-color: rgb(var(--color-surface-700));
}
.widget-card:hover {
  border-color: rgb(var(--color-surface-300));
}
.dark .widget-card:hover {
  border-color: rgb(var(--color-surface-600));
}
.widget-actions {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.widget-card:hover .widget-actions,
.widget-card:focus-within .widget-actions {
  opacity: 1;
}
.widget-handle {
  cursor: grab;
  touch-action: none;
}
.widget-handle:active {
  cursor: grabbing;
}
.widget-dragging {
  opacity: 0.5;
  transform: scale(0.98);
}
.widget-drag-over {
  border-color: rgb(var(--color-primary-400)) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.dark .widget-drag-over {
  border-color: rgb(var(--color-primary-500)) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* ── Skill Cards (hover border + icon animation) ── */

.skill-card {
  transition: border-color 0.2s ease, opacity 0.3s ease, filter 0.3s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}
.skill-card:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
}
.dark .skill-card {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15);
}
.dark .skill-card:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.25);
}
.skill-card:hover .skill-icon {
  transform: scale(1.25) rotate(-12deg);
}
.skill-icon {
  transition: transform 0.3s ease;
}

/* Hover border per skill color */
.skill-card[data-skill="sale"]:hover { border-color: rgb(var(--color-primary-300)); }
.skill-card[data-skill="marketing"]:hover { border-color: #c4b5fd; }
.skill-card[data-skill="tax"]:hover { border-color: #fcd34d; }
.skill-card[data-skill="research"]:hover { border-color: #7dd3fc; }

.dark .skill-card[data-skill="sale"]:hover { border-color: rgb(var(--color-primary-500) / 0.5); }
.dark .skill-card[data-skill="marketing"]:hover { border-color: rgba(139, 92, 246, 0.5); }
.dark .skill-card[data-skill="tax"]:hover { border-color: rgba(245, 158, 11, 0.5); }
.dark .skill-card[data-skill="research"]:hover { border-color: rgba(14, 165, 233, 0.5); }

/* Widget Drawer — slides from right, matches Panel 2 width */
.widget-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  max-width: 360px;
  background: white;
  border-left: 1px solid rgb(var(--color-surface-200));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 1280px) {
  .widget-drawer { max-width: 400px; }
}
.dark .widget-drawer {
  background: rgb(var(--color-surface-800));
  border-left-color: rgb(var(--color-surface-700));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

/* Picker modal catalog item */
.widget-picker-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.widget-picker-item:hover {
  background: rgb(var(--color-surface-50));
}
.dark .widget-picker-item:hover {
  background: rgb(var(--color-surface-700));
}
.widget-picker-item.is-added {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MESSAGING INBOX — 3-panel layout inside assistant layout
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   DOCUMENTS V2 — 2-panel layout + detail drawer
   ═══════════════════════════════════════════════════════════════════════════ */

/* Wrapper: same negative-margin full-viewport technique as messaging */
.docs-v2-wrapper {
  position: relative;
  margin: -4.5rem -1rem -1rem -1rem;
  padding-top: 3.5rem;
  height: 100vh;
  display: flex;
  overflow: clip;
}
@media (min-width: 640px) {
  .docs-v2-wrapper { margin: -4.5rem -1.5rem -1.5rem -1.5rem; }
}
@media (min-width: 1024px) {
  .docs-v2-wrapper { margin: -2rem; padding-top: 0; }
}

/* FOUC prevention during Alpine init (hx-boost navigation).
   is-init: added in Alpine init(), removed after double-rAF.
   Hides folder panel children + suppresses all transitions. */
.docs-v2-wrapper.is-init * {
  transition-duration: 0s !important;
}
.docs-v2-wrapper.is-init > div:first-child > * {
  opacity: 0;
}

/* Scrollable areas */
.docs-v2-folder-scroll { overflow-y: auto; }
.docs-v2-file-scroll { overflow-y: auto; }

/* Detail drawer: always overlay (same pattern as perf-panel-right) */
.docs-v2-detail-panel {
  position: absolute;
  right: 0;
  top: 3.5rem;
  bottom: 0;
  width: 100%;
  z-index: 20;
  border-left: 1px solid rgb(var(--color-surface-200));
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: white;
  overflow-y: auto;
}
@media (min-width: 768px) {
  .docs-v2-detail-panel {
    width: 50%;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  }
}
@media (min-width: 1024px) {
  .docs-v2-detail-panel { top: 0; }
}
@media (min-width: 1280px) {
  .docs-v2-detail-panel { width: 400px; }
}
.dark .docs-v2-detail-panel {
  border-left-color: rgb(var(--color-surface-700));
  background-color: rgb(var(--color-surface-800));
}

/* Wide modifier: wider drawer (Add Document) — only overrides width */
@media (min-width: 768px) {
  .docs-v2-detail-panel.docs-v2-wide { width: 75%; }
}
@media (min-width: 1280px) {
  .docs-v2-detail-panel.docs-v2-wide { width: 800px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRODUCTS V2 — 2-panel layout (same pattern as Documents V2)
   ═══════════════════════════════════════════════════════════════════════════ */
.prod-v2-wrapper {
  position: relative;
  margin: -4.5rem -1rem -1rem -1rem;
  padding-top: 3.5rem;
  height: 100vh;
  display: flex;
  overflow: clip;
}
@media (min-width: 768px) {
  .prod-v2-wrapper { margin: -4.5rem -1.5rem -1.5rem -1.5rem; }
}
@media (min-width: 1024px) {
  .prod-v2-wrapper { margin: -2rem; padding-top: 0; }
}
/* FOUC prevention */
.prod-v2-wrapper.is-init * {
  transition-duration: 0s !important;
}
.prod-v2-wrapper.is-init > div:first-child > * {
  opacity: 0;
}
/* Scrollable areas */
.prod-v2-cat-scroll { overflow-y: auto; }
.prod-v2-product-scroll { overflow-y: auto; }
/* Detail drawer */
.prod-v2-detail-panel {
  position: absolute;
  right: 0;
  top: 3.5rem;
  bottom: 0;
  width: 100%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background-color: white;
  border-left: 1px solid rgb(var(--color-surface-200));
}
@media (min-width: 768px) {
  .prod-v2-detail-panel {
    width: 50%;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  }
}
@media (min-width: 1024px) {
  .prod-v2-detail-panel { top: 0; }
}
@media (min-width: 1280px) {
  .prod-v2-detail-panel { width: 400px; }
}
.dark .prod-v2-detail-panel {
  border-left-color: rgb(var(--color-surface-700));
  background-color: rgb(var(--color-surface-800));
}
/* Wide panel (add product drawer) */
@media (min-width: 768px) {
  .prod-v2-detail-panel.prod-v2-wide { width: 75%; }
}
@media (min-width: 1280px) {
  .prod-v2-detail-panel.prod-v2-wide { width: 800px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CUSTOMERS V2 — Kanban/Table view toggle (1-panel: vertical stack)
   ═══════════════════════════════════════════════════════════════════════════ */
.cust-v2-wrapper {
  position: relative;
  margin: -4.5rem -1rem -1rem -1rem;
  padding-top: 3.5rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: clip;
}
@media (min-width: 640px) {
  .cust-v2-wrapper { margin: -4.5rem -1.5rem -1.5rem -1.5rem; }
}
@media (min-width: 1024px) {
  .cust-v2-wrapper { margin: -2rem; padding-top: 0; }
}
/* View toggle via <html> class */
html.cust-kanban .cust-v2-wrapper #custTableView { display: none; }
html:not(.cust-kanban) .cust-v2-wrapper #custKanbanView { display: none; }
/* Kanban column scroll */
.cust-kanban-scroll {
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.cust-kanban-scroll::-webkit-scrollbar {
  display: none;
}
/* Mobile kanban toolbar: exact 50/50 via CSS Grid (4 direct children → 2x2) */
@media (max-width: 639px) {
  .cust-kanban-toolbar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }
  .cust-kanban-toolbar .cust-bulk-action button,
  .cust-kanban-toolbar button.cust-bulk-action {
    width: 100%;
  }
}
/* Desktop: flex single row, ActionDropdown auto-width */
@media (min-width: 640px) {
  .cust-kanban-toolbar {
    display: flex !important;
  }
  .cust-bulk-action > div > button {
    width: auto !important;
  }
}
/* Mobile kanban: full-screen snap carousel per stage */
@media (max-width: 639px) {
  .cust-kanban-board {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 1rem !important;
    scroll-padding-inline: 1rem;
    overflow-y: hidden !important;
  }
  .cust-kanban-inner {
    gap: 1rem !important;
    align-items: flex-start !important;
  }
  .cust-kanban-col {
    width: calc(100vw - 2rem) !important;
    flex: 0 0 auto !important;
    max-height: 100% !important;
    scroll-snap-align: start;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRODUCT CREATE — full-width form (negative margin to break out of <main>)
   ═══════════════════════════════════════════════════════════════════════════ */
.prod-create-wrapper {
  margin: -4.5rem -1rem -1rem -1rem;
  padding-top: 3.5rem;
  min-height: 100vh;
}
@media (min-width: 640px) {
  .prod-create-wrapper { margin: -4.5rem -1.5rem -1.5rem -1.5rem; }
}
@media (min-width: 1024px) {
  .prod-create-wrapper { margin: -2rem; padding-top: 0; }
}

/* WYSIWYG rich editor: heading, list, link styles inside contenteditable */
[x-ref="richEditor"] h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; margin: 0.5em 0; }
[x-ref="richEditor"] h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin: 0.5em 0; }
[x-ref="richEditor"] h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin: 0.4em 0; }
[x-ref="richEditor"] h4 { font-size: 1rem; font-weight: 600; line-height: 1.3; margin: 0.4em 0; }
[x-ref="richEditor"] ul { list-style: disc; padding-left: 1.5em; margin: 0.4em 0; }
[x-ref="richEditor"] ol { list-style: decimal; padding-left: 1.5em; margin: 0.4em 0; }
[x-ref="richEditor"] li { margin: 0.15em 0; }
[x-ref="richEditor"] a { color: rgb(var(--color-primary-600)); text-decoration: underline; }
[x-ref="richEditor"] s, [x-ref="richEditor"] strike { text-decoration: line-through; }
[x-ref="richEditor"] blockquote { border-left: 3px solid rgb(var(--color-primary-400)); padding-left: 0.75em; margin: 0.5em 0; color: rgb(var(--color-surface-500)); font-style: italic; }
[x-ref="richEditor"] code { background: rgb(var(--color-surface-100)); padding: 0.15em 0.35em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.85em; }
[x-ref="richEditor"] pre { background: rgb(var(--color-surface-100)); padding: 0.75em 1em; border-radius: 0.5em; margin: 0.5em 0; overflow-x: auto; }
[x-ref="richEditor"] pre code { background: none; padding: 0; font-size: 0.85em; }
[x-ref="richEditor"] table { border-collapse: collapse; width: 100%; margin: 0.5em 0; }
[x-ref="richEditor"] th, [x-ref="richEditor"] td { border: 1px solid rgb(var(--color-surface-200)); padding: 0.4em 0.6em; text-align: left; font-size: 0.875em; }
[x-ref="richEditor"] th { background: rgb(var(--color-surface-50)); font-weight: 600; }
[x-ref="richEditor"] hr { border: none; border-top: 2px solid rgb(var(--color-surface-200)); margin: 0.75em 0; }

/* Markdown preview prose styles */
.md-preview { font-size: 0.875rem; line-height: 1.6; color: inherit; }
.md-preview h1 { font-size: 1.5rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.md-preview h2 { font-size: 1.25rem; font-weight: 600; margin: 0.75rem 0 0.5rem; }
.md-preview h3 { font-size: 1.1rem; font-weight: 600; margin: 0.5rem 0 0.25rem; }
.md-preview p { margin: 0.5rem 0; }
.md-preview ul, .md-preview ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.md-preview ul { list-style: disc; }
.md-preview ol { list-style: decimal; }
.md-preview li { margin: 0.15rem 0; }
.md-preview blockquote { border-left: 3px solid rgb(var(--color-surface-300)); padding-left: 1rem; opacity: 0.8; margin: 0.5rem 0; }
.md-preview code { background: rgb(var(--color-surface-100)); padding: 0.15rem 0.35rem; border-radius: 0.25rem; font-size: 0.85em; }
.md-preview pre { background: rgb(var(--color-surface-100)); padding: 1rem; border-radius: 0.5rem; overflow-x: auto; margin: 0.5rem 0; }
.md-preview pre code { background: none; padding: 0; }
.md-preview hr { border-color: rgb(var(--color-surface-200)); margin: 1rem 0; }
.md-preview a { color: rgb(var(--color-primary-600)); text-decoration: underline; }
.md-preview strong { font-weight: 600; }
.md-preview em { font-style: italic; }
.md-preview del { text-decoration: line-through; }
.md-preview table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.85em; }
.md-preview th, .md-preview td { border: 1px solid rgb(var(--color-surface-200)); padding: 0.4rem 0.75rem; text-align: left; }
.md-preview th { background: rgb(var(--color-surface-50)); font-weight: 600; }
.dark .md-preview code { background: rgb(var(--color-surface-700)); }
.dark .md-preview pre { background: rgb(var(--color-surface-700)); }
.dark .md-preview blockquote { border-left-color: rgb(var(--color-surface-500)); }
.dark .md-preview hr { border-color: rgb(var(--color-surface-600)); }
.dark .md-preview th, .dark .md-preview td { border-color: rgb(var(--color-surface-600)); }
.dark .md-preview th { background: rgb(var(--color-surface-700)); }

/* ═══════════════════════════════════════════════════════════════════════════ */

/* Wrapper: negate assistant.templ <main> padding exactly, fill full viewport.
   Mobile:  p-4 pt-[4.5rem]     → margin: -4.5rem -1rem -1rem -1rem
   SM:      sm:p-6 sm:pt-[4.5rem] → margin: -4.5rem -1.5rem -1.5rem -1.5rem
   LG:      lg:p-8 (all 2rem)   → margin: -2rem
   Mobile topbar (h-14 = 3.5rem, lg:hidden) → padding-top: 3.5rem on mobile/tablet */
.messaging-wrapper {
  position: relative; /* anchor for tablet info overlay */
  margin: -4.5rem -1rem -1rem -1rem;
  padding-top: 3.5rem; /* space for fixed MobileTopbar h-14 */
  height: 100vh;
  display: flex;
  overflow: hidden;
}
@media (min-width: 640px) {
  .messaging-wrapper { margin: -4.5rem -1.5rem -1.5rem -1.5rem; }
}
@media (min-width: 1024px) {
  .messaging-wrapper { margin: -2rem; padding-top: 0; }
}

/* Conversation list + Messages area — only overflow, scrollbar styling is global */
.msg-conv-scroll { overflow-y: auto; }
.msg-messages-area { overflow-y: auto; }

/* Message bubbles — 4 sender types */
.msg-bubble-customer {
  background: rgb(var(--color-surface-200));
  color: rgb(var(--color-surface-800));
  border-radius: 1.25rem 1.25rem 1.25rem 0.375rem;
  animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg-bubble-ai {
  background: linear-gradient(135deg, rgb(var(--color-primary-500)), rgb(var(--color-primary-600)));
  color: white;
  border-radius: 1.25rem 1.25rem 0.375rem 1.25rem;
  box-shadow: 0 2px 8px rgb(var(--color-primary-500) / 0.25);
  animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg-bubble-agent {
  background: linear-gradient(135deg, rgb(59 130 246), rgb(37 99 235));
  color: white;
  border-radius: 1.25rem 1.25rem 0.375rem 1.25rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg-bubble-owner {
  background: linear-gradient(135deg, rgb(245 158 11), rgb(217 119 6));
  color: white;
  border-radius: 1.25rem 1.25rem 0.375rem 1.25rem;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLTIP SYSTEM — 4 directions (LAYOUT.md §7.18)
   Usage: class="tooltip tooltip-{top|bottom|left|right}" data-tooltip="Text"
   Default (no direction class) = tooltip-top
   ═══════════════════════════════════════════════════════════════════════════ */
.tooltip { position: relative; }

/* Base pseudo-elements (shared by all directions) */
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  background: rgb(var(--color-surface-800));
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.tooltip::before {
  content: '';
  position: absolute;
  border: 5px solid transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}
.tooltip:hover::after { opacity: 1; }
.tooltip:hover::before { opacity: 1; }

/* --- TOP (default) — tooltip appears above element --- */
.tooltip:not(.tooltip-bottom):not(.tooltip-left):not(.tooltip-right)::after,
.tooltip.tooltip-top::after {
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}
.tooltip:not(.tooltip-bottom):not(.tooltip-left):not(.tooltip-right)::before,
.tooltip.tooltip-top::before {
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border-top-color: rgb(var(--color-surface-800));
}
.tooltip:not(.tooltip-bottom):not(.tooltip-left):not(.tooltip-right):hover::after,
.tooltip.tooltip-top:hover::after {
  transform: translateX(-50%) translateY(0);
}

/* --- BOTTOM — tooltip appears below element --- */
.tooltip.tooltip-bottom::after {
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}
.tooltip.tooltip-bottom::before {
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: rgb(var(--color-surface-800));
}
.tooltip.tooltip-bottom:hover::after {
  transform: translateX(-50%) translateY(0);
}

/* --- LEFT — tooltip appears to the left of element --- */
.tooltip.tooltip-left::after {
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}
.tooltip.tooltip-left::before {
  right: calc(100% + 3px);
  top: 50%;
  transform: translateY(-50%);
  border-left-color: rgb(var(--color-surface-800));
}
.tooltip.tooltip-left:hover::after {
  transform: translateY(-50%) translateX(0);
}

/* --- RIGHT — tooltip appears to the right of element --- */
.tooltip.tooltip-right::after {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}
.tooltip.tooltip-right::before {
  left: calc(100% + 3px);
  top: 50%;
  transform: translateY(-50%);
  border-right-color: rgb(var(--color-surface-800));
}
.tooltip.tooltip-right:hover::after {
  transform: translateY(-50%) translateX(0);
}

/* Dark mode tooltip */
.dark .tooltip::after {
  background: rgb(var(--color-surface-600));
}
.dark .tooltip:not(.tooltip-bottom):not(.tooltip-left):not(.tooltip-right)::before,
.dark .tooltip.tooltip-top::before {
  border-top-color: rgb(var(--color-surface-600));
}
.dark .tooltip.tooltip-bottom::before {
  border-bottom-color: rgb(var(--color-surface-600));
}
.dark .tooltip.tooltip-left::before {
  border-left-color: rgb(var(--color-surface-600));
}
.dark .tooltip.tooltip-right::before {
  border-right-color: rgb(var(--color-surface-600));
}
/* Floating tooltip — for elements inside overflow containers (escapes clipping) */
.msg-float-tooltip {
  position: fixed;
  z-index: 50;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  background: rgb(var(--color-surface-800));
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(calc(-100% + 4px));
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.msg-float-tooltip.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-100%);
}
/* Arrow pointing down (tooltip appears above) */
.msg-float-tooltip::before {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgb(var(--color-surface-800));
}
.dark .msg-float-tooltip {
  background: rgb(var(--color-surface-600));
}
.dark .msg-float-tooltip::before {
  border-top-color: rgb(var(--color-surface-600));
}
/* Sidebar floating tooltip — position:fixed to escape overflow-y:auto clipping.
   Uses CSS transition (not Alpine x-transition) to avoid transform conflict with translateY(-50%). */
.sidebar-float-tip {
  position: fixed;
  left: 80px; /* sidebar collapsed 72px + 8px gap */
  z-index: 60;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  background: rgb(var(--color-surface-800));
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.1s ease;
}
.sidebar-float-tip.is-visible {
  opacity: 1;
}
/* Arrow pointing left */
.sidebar-float-tip::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: rgb(var(--color-surface-800));
}
.dark .sidebar-float-tip {
  background: rgb(var(--color-surface-600));
}
.dark .sidebar-float-tip::before {
  border-right-color: rgb(var(--color-surface-600));
}

/* Sidebar content — only animate padding-left (for collapse/expand).
   !important overrides Tailwind CDN's runtime-generated .transition-all { transition-property: all }
   which otherwise causes a 300ms opacity fade when body.ready removes FOUC opacity:0.
   padding-right added for smooth chat panel toggle at xl+ (sidebar-content gets pr-[400px]). */
.sidebar-content {
  transition-property: padding-left, padding-right !important;
}

/* AI Selector Glow — rotating gradient border around assistant selector button */
.ai-selector-glow {
  position: relative;
  padding: 1.5px;
  border-radius: 0.5rem;
  overflow: hidden;
}
.ai-selector-glow::before {
  content: '';
  position: absolute;
  inset: -100%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgb(var(--color-primary-300) / 0.6) 8%,
    rgb(var(--color-primary-500)) 15%,
    rgb(var(--color-primary-300) / 0.6) 22%,
    transparent 30%
  );
  animation: ai-glow-spin 4s linear infinite;
}
.ai-selector-glow > * {
  position: relative;
  z-index: 1;
}
.dark .ai-selector-glow::before {
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgb(var(--color-primary-400) / 0.3) 8%,
    rgb(var(--color-primary-400) / 0.7) 15%,
    rgb(var(--color-primary-400) / 0.3) 22%,
    transparent 30%
  );
}
@keyframes ai-glow-spin {
  to { transform: rotate(360deg); }
}

.dark .msg-bubble-customer {
  background: rgb(var(--color-surface-700));
  color: rgb(var(--color-surface-200));
}
/* msg scrollbar dark mode — handled by global .dark * rule */

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE — .dark prefix variants
   Strategy: Add dark variants to component classes here (DRY).
   Layout/page structural elements use inline dark: Tailwind classes.
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Base --- */
.dark ::selection {
  background-color: rgb(var(--color-primary-800));
  color: rgb(var(--color-primary-100));
}

/* --- Buttons --- */
/* .btn-primary keeps indigo — works on dark bg */
.dark .btn-secondary {
  background-color: rgb(var(--color-surface-800));
  color: rgb(var(--color-surface-200));
  border-color: rgb(var(--color-surface-600));
}
.dark .btn-secondary:hover:not(:disabled) {
  background-color: rgb(var(--color-surface-700));
  border-color: rgb(var(--color-surface-500));
}
.dark .btn-ghost {
  color: rgb(var(--color-surface-400));
}
.dark .btn-ghost:hover:not(:disabled) {
  background-color: rgb(var(--color-surface-800));
  color: rgb(var(--color-surface-200));
}

/* --- Inputs --- */
.dark .input {
  background-color: rgb(var(--color-surface-800));
  border-color: rgb(var(--color-surface-600));
  color: rgb(var(--color-surface-100));
}
.dark .input::placeholder {
  color: rgb(var(--color-surface-500));
}
.dark .input:hover {
  border-color: rgb(var(--color-surface-500));
}
.dark .input:focus {
  border-color: rgb(var(--color-primary-500));
  box-shadow: 0 0 0 3px rgb(var(--color-primary-500) / 0.2);
}
.dark .input-label {
  color: rgb(var(--color-surface-300));
}
.dark .input-hint {
  color: rgb(var(--color-surface-400));
}
.dark .input-error-text {
  color: rgb(var(--color-error-500));
}

/* --- Date Input Override --- */
/* Style native date picker to match design system */
input[type="date"].input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  cursor: pointer;
}

input[type="date"].input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
  filter: none;
  transition: opacity 0.15s;
}

input[type="date"].input::-webkit-calendar-picker-indicator:hover {
  opacity: 0.8;
}

.dark input[type="date"].input {
  color-scheme: dark;
}

.dark input[type="date"].input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  opacity: 0.6;
}

.dark input[type="date"].input::-webkit-calendar-picker-indicator:hover {
  opacity: 0.9;
}

/* --- Checkbox --- */
.dark .checkbox {
  background-color: rgb(var(--color-surface-700));
  border-color: rgb(var(--color-surface-500));
}
.dark .checkbox:hover {
  border-color: rgb(var(--color-primary-400));
}
.dark .checkbox:focus {
  border-color: rgb(var(--color-primary-500));
  box-shadow: 0 0 0 3px rgb(var(--color-primary-500) / 0.2);
}
.dark .checkbox:checked {
  background-color: rgb(var(--color-primary-600));
  border-color: rgb(var(--color-primary-600));
}
.dark .checkbox:checked:hover {
  background-color: rgb(var(--color-primary-500));
  border-color: rgb(var(--color-primary-500));
}
.dark .checkbox:indeterminate {
  background-color: rgb(var(--color-primary-600));
  border-color: rgb(var(--color-primary-600));
}

/* --- Cards --- */
.dark .card {
  background-color: rgb(var(--color-surface-800));
}
.dark .card-hover:hover {
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.4);
}

/* --- Links --- */
.dark .link {
  color: rgb(var(--color-primary-400));
}
.dark .link:hover {
  color: rgb(var(--color-primary-300));
}

/* --- Spinner --- */
.dark .spinner {
  border-color: rgb(var(--color-surface-700));
  border-top-color: rgb(var(--color-primary-400));
}

/* --- Alerts --- */
.dark .alert-info {
  background-color: rgb(30 64 175 / 0.15);
  color: rgb(147 197 253);
}
.dark .alert-success {
  background-color: rgb(var(--color-accent-900) / 0.3);
  color: rgb(var(--color-accent-300));
}
.dark .alert-warning {
  background-color: rgb(146 64 14 / 0.15);
  color: rgb(253 186 116);
}
.dark .alert-error {
  background-color: rgb(153 27 27 / 0.15);
  color: rgb(var(--color-error-300));
}

/* --- OTP Input --- */
.dark .otp-input {
  background: rgb(var(--color-surface-800));
  border-color: rgb(var(--color-surface-600));
  color: rgb(var(--color-surface-100));
}

/* --- Industry Card (Onboarding) --- */
.dark .industry-card {
  border-color: rgb(var(--color-surface-600));
  background: rgba(var(--color-surface-800), 0.6);
}
.dark .industry-card:hover {
  border-color: rgb(var(--color-primary-500));
  background: rgba(var(--color-primary-900), 0.3);
  box-shadow: 0 4px 12px rgb(var(--color-primary-500) / 0.15);
}
.dark .industry-card.selected {
  border-color: rgb(var(--color-primary-500));
  background: rgba(var(--color-primary-900), 0.3);
  box-shadow:
    0 0 0 3px rgb(var(--color-primary-500) / 0.2),
    0 4px 16px rgb(var(--color-primary-500) / 0.15);
}

/* --- Demo Card --- */
.dark .demo-card {
  background: rgb(var(--color-surface-800) / 0.95);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgb(var(--color-surface-700));
}
.dark .demo-card-header {
  border-color: rgb(var(--color-surface-700) / 0.8);
  background: rgb(var(--color-surface-800) / 0.8);
}
.dark .demo-card-footer {
  border-color: rgb(var(--color-surface-700) / 0.8);
  background: rgb(var(--color-surface-800) / 0.8);
}
/* dark demo-card-body scrollbar — handled by global .dark * rule */

/* --- Chat Bubbles --- */
/* .chat-bubble-user keeps gradient — fine for dark */
.dark .chat-bubble-assistant {
  background: rgb(var(--color-surface-800));
  color: rgb(var(--color-surface-200));
  border-color: rgb(var(--color-surface-700));
}
.dark .typing-dot {
  background: rgb(var(--color-surface-500));
}

/* --- Assistant Card (Selector) --- */
.dark .assistant-card {
  border-color: rgb(var(--color-surface-600));
  background: rgb(var(--color-surface-800));
}
.dark .assistant-card:hover {
  border-color: rgb(var(--color-primary-500));
  background: rgb(var(--color-primary-900) / 0.2);
}
.dark .assistant-card.selected {
  border-color: rgb(var(--color-primary-500));
  background: rgb(var(--color-primary-900) / 0.2);
}

/* --- Chat Dashboard --- */
.dark .chat-textarea-container {
  border-color: rgb(var(--color-surface-600));
  background: rgb(var(--color-surface-800));
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}
.dark .chat-textarea-container:focus-within {
  border-color: rgb(var(--color-surface-500));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
.dark .chat-textarea {
  color: rgb(var(--color-surface-100));
}
.dark .chat-textarea::placeholder {
  color: rgb(var(--color-surface-500));
}
.dark .chat-top-btn {
  color: rgb(var(--color-surface-400));
}
.dark .chat-top-btn:hover {
  background: rgb(var(--color-surface-800));
  color: rgb(var(--color-surface-200));
}
.dark .chat-top-btn-primary {
  background: rgb(var(--color-surface-800));
  color: rgb(var(--color-surface-300));
}
.dark .chat-top-btn-primary:hover {
  background: rgb(var(--color-surface-700));
}
.dark .chat-send-btn {
  background: rgb(var(--color-surface-700));
  color: rgb(var(--color-surface-500));
}
/* .chat-send-btn.active keeps primary-600 — fine for dark */
.dark .chat-attach-btn {
  color: rgb(var(--color-surface-500));
}
.dark .chat-attach-btn:hover {
  background: rgb(var(--color-surface-700));
  color: rgb(var(--color-surface-300));
}
.dark .chat-assistant-compact {
  border-color: rgb(var(--color-surface-600));
}
.dark .chat-assistant-compact:hover {
  border-color: rgb(var(--color-surface-500));
  background: rgb(var(--color-surface-800));
}
.dark .chat-quick-card {
  border-color: rgb(var(--color-surface-700));
  background: rgb(var(--color-surface-800));
}
.dark .chat-quick-card:hover {
  border-color: rgb(var(--color-surface-600));
  background: rgb(var(--color-surface-700));
}
.dark .chat-history-drawer {
  background: rgb(var(--color-surface-800));
  border-color: rgb(var(--color-surface-700));
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}
.dark .chat-history-item:hover {
  background: rgb(var(--color-surface-700));
}
/* dark chat-messages scrollbar — handled by global .dark * rule */
