/* Modern CRM Theme - Apple-like Minimalism */

:root {
  /* Light Theme - Apple-inspired */
  --background: #F5F5F7;
  --background-secondary: #F5F5F7;
  --foreground: #1D1D1F;
  --foreground-secondary: #86868B;
  --muted-foreground: #86868B;
  --card: #FFFFFF;
  --card-hover: #FAFAFA;
  --border: #E5E5E5;
  --border-light: #F0F0F0;
  --input: #FFFFFF;
  --input-border: #D1D1D6;

  /* Brand colors */
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-light: rgba(59, 130, 246, 0.1);
  --secondary: #F5F5F7;
  --secondary-hover: #E8E8ED;
  --accent: #8B5CF6;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --success: #22C55E;

  /* Shadows - subtle */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);

  /* Modal */
  --modal-backdrop: rgba(0, 0, 0, 0.2);
  --modal-blur: 8px;

  /* Neumorphic shadows - Light theme */
  --neu-shadow-light: rgba(255, 255, 255, 0.8);
  --neu-shadow-dark: rgba(0, 0, 0, 0.08);
  --neu-raised: -6px -6px 14px var(--neu-shadow-light), 6px 6px 14px var(--neu-shadow-dark);
  --neu-raised-sm: -3px -3px 8px var(--neu-shadow-light), 3px 3px 8px var(--neu-shadow-dark);
  --neu-inset: inset 3px 3px 8px var(--neu-shadow-dark), inset -3px -3px 8px var(--neu-shadow-light);
  --neu-inset-focus: inset 2px 2px 5px var(--neu-shadow-dark), inset -2px -2px 5px var(--neu-shadow-light);
  --neu-surface: var(--background);
  --neu-radius: 12px;
  --neu-shadow-inset-sm: inset 2px 2px 5px var(--neu-shadow-dark), inset -2px -2px 5px var(--neu-shadow-light);
}

[data-theme="dark"] {
  /* Dark Theme - Apple-inspired */
  --background: #000000;
  --background-secondary: #1C1C1E;
  --foreground: #F5F5F7;
  --foreground-secondary: #86868B;
  --muted-foreground: #86868B;
  --card: #1C1C1E;
  --card-hover: #2C2C2E;
  --border: #2C2C2E;
  --border-light: #3A3A3C;
  --input: #1C1C1E;
  --input-border: #3A3A3C;

  /* Brand colors */
  --primary: #3B82F6;
  --primary-hover: #60A5FA;
  --primary-light: rgba(59, 130, 246, 0.15);
  --secondary: #2C2C2E;
  --secondary-hover: #3A3A3C;
  --accent: #8B5CF6;
  --danger: #EF4444;
  --danger-hover: #F87171;
  --success: #22C55E;

  /* Shadows - subtle for dark */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);

  /* Modal */
  --modal-backdrop: rgba(0, 0, 0, 0.4);
  --modal-blur: 8px;

  /* Neumorphic shadows - Dark theme */
  --neu-shadow-light: rgba(50, 50, 55, 0.5);
  --neu-shadow-dark: rgba(0, 0, 0, 0.5);
  --neu-raised: -6px -6px 14px var(--neu-shadow-light), 6px 6px 14px var(--neu-shadow-dark);
  --neu-raised-sm: -3px -3px 8px var(--neu-shadow-light), 3px 3px 8px var(--neu-shadow-dark);
  --neu-inset: inset 3px 3px 8px var(--neu-shadow-dark), inset -3px -3px 8px var(--neu-shadow-light);
  --neu-inset-focus: inset 2px 2px 5px var(--neu-shadow-dark), inset -2px -2px 5px var(--neu-shadow-light);
  --neu-surface: var(--background);
  --neu-radius: 12px;
  --neu-shadow-inset-sm: inset 2px 2px 5px var(--neu-shadow-dark), inset -2px -2px 5px var(--neu-shadow-light);
}

/* Base body */
body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   SIDEBAR - Icon-only with hover expand
   ============================================ */

.sidebar-minimal {
  width: 64px;
  background: var(--background);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.20s ease-out;
  will-change: width;
  overflow: hidden;
  position: relative;
  z-index: 40;
  flex-shrink: 0;
}

.sidebar-minimal:hover {
  width: 240px;
}

.sidebar-minimal .nav-section {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-minimal .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--foreground-secondary);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-minimal .nav-item:hover {
  background: var(--nav-bg, var(--secondary));
  color: var(--nav-color, var(--foreground));
  transform: translateX(2px);
}

.sidebar-minimal .nav-item.active {
  background: var(--nav-bg, var(--primary-light));
  color: var(--nav-color, var(--primary));
}

/* Per-item nav colors */
.nav-item[data-nav="dashboard"]     { --nav-color: #3B82F6; --nav-bg: rgba(59,130,246,0.10); }
.nav-item[data-nav="assistant"]     { --nav-color: #8B5CF6; --nav-bg: rgba(139,92,246,0.10); }
.nav-item[data-nav="contacts"]      { --nav-color: #10B981; --nav-bg: rgba(16,185,129,0.10); }
.nav-item[data-nav="organizations"] { --nav-color: #F59E0B; --nav-bg: rgba(245,158,11,0.10); }
.nav-item[data-nav="projects"]      { --nav-color: #06B6D4; --nav-bg: rgba(6,182,212,0.10); }
.nav-item[data-nav="tasks"]         { --nav-color: #22C55E; --nav-bg: rgba(34,197,94,0.10); }
.nav-item[data-nav="calendar"]      { --nav-color: #F43F5E; --nav-bg: rgba(244,63,94,0.10); }
.nav-item[data-nav="teams"]         { --nav-color: #6366F1; --nav-bg: rgba(99,102,241,0.10); }
.nav-item[data-nav="settings"]      { --nav-color: #64748B; --nav-bg: rgba(100,116,139,0.10); }

/* Dark theme: slightly stronger tinted backgrounds */
[data-theme="dark"] .nav-item[data-nav="dashboard"]     { --nav-bg: rgba(59,130,246,0.15); }
[data-theme="dark"] .nav-item[data-nav="assistant"]     { --nav-bg: rgba(139,92,246,0.15); }
[data-theme="dark"] .nav-item[data-nav="contacts"]      { --nav-bg: rgba(16,185,129,0.15); }
[data-theme="dark"] .nav-item[data-nav="organizations"] { --nav-bg: rgba(245,158,11,0.15); }
[data-theme="dark"] .nav-item[data-nav="projects"]      { --nav-bg: rgba(6,182,212,0.15); }
[data-theme="dark"] .nav-item[data-nav="tasks"]         { --nav-bg: rgba(34,197,94,0.15); }
[data-theme="dark"] .nav-item[data-nav="calendar"]      { --nav-bg: rgba(244,63,94,0.15); }
[data-theme="dark"] .nav-item[data-nav="teams"]         { --nav-bg: rgba(99,102,241,0.15); }
[data-theme="dark"] .nav-item[data-nav="settings"]      { --nav-bg: rgba(100,116,139,0.15); }

.sidebar-minimal .nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-minimal .nav-label {
  opacity: 0;
  transition: opacity 0.15s ease;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-minimal:hover .nav-label {
  opacity: 1;
}

/* Logo section */
.sidebar-minimal .logo-section {
  padding: 16px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-minimal .logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  animation: logoGlow 8s ease-in-out infinite;
  transition: box-shadow 0.3s ease;
}

.sidebar-minimal .logo-icon:hover {
  animation-play-state: paused;
  box-shadow: 0 0 10px 4px rgba(48, 142, 101, 0.5),
              0 0 20px 8px rgba(92, 70, 138, 0.3),
              0 0 30px 10px rgba(75, 125, 175, 0.2);
}

[data-theme="dark"] .sidebar-minimal .logo-icon {
  animation-name: logoGlowDark;
}

[data-theme="dark"] .sidebar-minimal .logo-icon:hover {
  box-shadow: 0 0 14px 5px rgba(48, 142, 101, 0.7),
              0 0 25px 10px rgba(92, 70, 138, 0.5),
              0 0 35px 14px rgba(75, 125, 175, 0.3);
}

/* Bottom section */
.sidebar-minimal .bottom-section {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-minimal .theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-minimal .theme-toggle-btn:hover {
  background: var(--secondary);
  color: var(--foreground);
}

/* Mobile sidebar */
@media (max-width: 768px) {
  .sidebar-minimal {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    width: 240px;
    z-index: 50;
    transition: left 0.3s ease;
  }

  .sidebar-minimal.mobile-open {
    left: 0;
  }

  .sidebar-minimal .nav-label {
    opacity: 1;
  }

  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop);
    backdrop-filter: blur(var(--modal-blur));
    z-index: 45;
  }

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

/* Enhanced Modern Card Styles */
.card-modern {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  opacity: 0.8;
}

[data-theme="dark"] .card-modern::before {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
}

.card-modern:hover {
  box-shadow: var(--shadow-medium);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.card-modern:hover::before {
  background: linear-gradient(90deg,
    transparent 0%,
    var(--primary) 50%,
    transparent 100%
  );
  opacity: 0.3;
}

/* Enhanced Modern Chat Bubbles */
.chat-bubble-modern {
  border-radius: 16px;
  padding: 12px 16px;
  max-width: 75%;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: bubbleSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  word-wrap: break-word;
  line-height: 1.5;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.chat-bubble-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.chat-bubble-modern:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.12),
    0 3px 6px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.chat-bubble-user {
  background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.1) 0%,
    rgba(139, 92, 246, 0.05) 100%),
    var(--card);
  color: var(--foreground);
  margin-left: auto;
  border-bottom-right-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  position: relative;
  overflow: hidden;
}

.chat-bubble-user::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  background: var(--background);
  border-radius: 20px 0 0 0;
}

.chat-bubble-assistant {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-bottom-left-radius: 8px;
  position: relative;
  overflow: hidden;
}

.chat-bubble-assistant::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: -1px;
  width: 12px;
  height: 12px;
  background: var(--background);
  border-radius: 0 20px 0 0;
}

/* Message content wrapper - allows entity cards to expand beyond bubble width */
.message-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 85%;
  min-width: 0;
}

.message-content-wrapper .chat-bubble-modern {
  max-width: 100%;
}

.message-content-wrapper .entity-card-container {
  width: 100%;
  min-width: 320px;
  max-width: 450px;
}

[data-theme="dark"] .chat-bubble-modern {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .chat-bubble-modern:hover {
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .chat-bubble-user {
  background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(139, 92, 246, 0.08) 100%),
    var(--card);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Message Container */
.message-container {
  display: flex;
  margin-bottom: 12px;
  align-items: flex-end;
}

.message-container.user {
  justify-content: flex-end;
}

.message-container.assistant {
  justify-content: flex-start;
}

/* Avatar Styles */
.avatar-modern {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin: 0 8px;
  flex-shrink: 0;
}

.avatar-user {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.avatar-user-enhanced {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--chat-user-bg);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-light);
  position: relative;
  overflow: hidden;
}

.avatar-user-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 50%;
}

.avatar-initial {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.avatar-assistant {
  background: #000000;
  color: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: var(--shadow-light);
}

[data-theme="dark"] .avatar-user-enhanced {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .avatar-assistant {
  border-color: rgba(59, 130, 246, 0.3);
}

/* Message Meta (timestamp, status) */
.message-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.7;
}

.message-time {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 2px;
}

/* Enhanced Animations */
@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  60% {
    opacity: 0.8;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes messageSlideInUser {
  0% {
    opacity: 0;
    transform: translateX(20px) scale(0.95);
  }
  60% {
    opacity: 0.8;
    transform: translateX(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes morphingDots {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  40% {
    transform: scale(1.4);
    opacity: 1;
  }
}

@keyframes bubbleSlideIn {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
  }
  60% {
    opacity: 0.8;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes thinkingPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.08),
      0 2px 4px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    transform: scale(1.01);
    box-shadow:
      0 6px 16px rgba(0, 0, 0, 0.12),
      0 3px 6px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
}

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

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

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px var(--primary);
  }
  50% {
    box-shadow: 0 0 20px var(--primary), 0 0 30px var(--primary);
  }
}

/* Logo multi-color glow - light mode */
@keyframes logoGlow {
  0%, 100% {
    box-shadow: 0 0 6px 2px rgba(48, 142, 101, 0.5),
                0 0 12px 4px rgba(48, 142, 101, 0.2);
  }
  20% {
    box-shadow: 0 0 6px 2px rgba(215, 194, 138, 0.5),
                0 0 12px 4px rgba(215, 194, 138, 0.2);
  }
  40% {
    box-shadow: 0 0 6px 2px rgba(192, 123, 66, 0.5),
                0 0 12px 4px rgba(192, 123, 66, 0.2);
  }
  50% {
    box-shadow: 0 0 6px 2px rgba(173, 63, 19, 0.5),
                0 0 12px 4px rgba(173, 63, 19, 0.2);
  }
  70% {
    box-shadow: 0 0 6px 2px rgba(92, 70, 138, 0.5),
                0 0 12px 4px rgba(92, 70, 138, 0.2);
  }
  85% {
    box-shadow: 0 0 6px 2px rgba(75, 125, 175, 0.5),
                0 0 12px 4px rgba(75, 125, 175, 0.2);
  }
}

/* Logo multi-color glow - dark mode */
@keyframes logoGlowDark {
  0%, 100% {
    box-shadow: 0 0 8px 3px rgba(48, 142, 101, 0.35),
                0 0 18px 6px rgba(48, 142, 101, 0.12);
  }
  20% {
    box-shadow: 0 0 8px 3px rgba(215, 194, 138, 0.35),
                0 0 18px 6px rgba(215, 194, 138, 0.12);
  }
  40% {
    box-shadow: 0 0 8px 3px rgba(192, 123, 66, 0.35),
                0 0 18px 6px rgba(192, 123, 66, 0.12);
  }
  50% {
    box-shadow: 0 0 8px 3px rgba(173, 63, 19, 0.35),
                0 0 18px 6px rgba(173, 63, 19, 0.12);
  }
  70% {
    box-shadow: 0 0 8px 3px rgba(92, 70, 138, 0.35),
                0 0 18px 6px rgba(92, 70, 138, 0.12);
  }
  85% {
    box-shadow: 0 0 8px 3px rgba(75, 125, 175, 0.35),
                0 0 18px 6px rgba(75, 125, 175, 0.12);
  }
}

@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Page transition animations */
@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Micro-interaction animations */
@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes cardHover {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(-4px) scale(1.02);
  }
}

/* Enhanced AI Thinking Animation */
.thinking-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  border-bottom-left-radius: 8px;
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: thinkingPulse 2s ease-in-out infinite;
}

.thinking-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.15) 50%,
    transparent 100%);
  animation: shimmer 2.5s infinite ease-in-out;
}

.thinking-bubble::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: -1px;
  width: 12px;
  height: 12px;
  background: var(--background);
  border-radius: 0 20px 0 0;
}

.thinking-content {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.thinking-text {
  font-size: 14px;
  color: var(--foreground-secondary);
  font-weight: 500;
}

.thinking-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  animation: morphingDots 1.6s infinite ease-in-out;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}

.thinking-dot:nth-child(1) { animation-delay: -0.4s; }
.thinking-dot:nth-child(2) { animation-delay: -0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0s; }

/* AI Stars Icon Styling */
.ai-stars {
  font-size: 16px;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: sparkle 2s ease-in-out infinite;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1) rotate(5deg);
    filter: brightness(1.2);
  }
}

[data-theme="dark"] .thinking-bubble {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .thinking-bubble::before {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.2) 50%,
    transparent 100%);
}

/* Animation Classes */
.animate-slide-in-up {
  animation: messageSlideIn 0.4s ease-out;
}

.animate-slide-in-user {
  animation: messageSlideInUser 0.4s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.5s ease-out;
}

.animate-fade-in {
  animation: fadeInScale 0.3s ease-out;
}

.animate-glow {
  animation: glow 2s infinite alternate;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-page-enter {
  animation: pageSlideIn 0.6s ease-out;
}

/* Interactive Animation Classes */
.hover-lift {
  transition: all 0.3s ease;
}

.hover-lift:hover {
  animation: cardHover 0.3s ease-out forwards;
}

.press-effect {
  transition: transform 0.1s ease;
}

.press-effect:active {
  animation: buttonPress 0.2s ease-out;
}

.shimmer-effect {
  background: linear-gradient(90deg,
    var(--card) 0%,
    var(--secondary) 50%,
    var(--card) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* Enhanced Message Animations */
.message-container.user {
  animation: messageSlideInUser 0.4s ease-out;
}

.message-container.assistant {
  animation: messageSlideIn 0.4s ease-out;
}

/* Enhanced Card Animations */
.card-modern {
  animation: fadeInScale 0.3s ease-out;
}

.card-modern:hover {
  animation: cardHover 0.3s ease-out forwards;
}

/* Button Enhancement */
.btn-modern {
  transition: all 0.2s ease;
}

.btn-modern:active {
  animation: buttonPress 0.2s ease-out;
}

/* Navigation Animation */
.nav-link-modern {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.nav-link-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.1) 50%,
    transparent 100%);
  transition: left 0.3s ease;
}

.nav-link-modern:hover::before {
  left: 100%;
}

/* Modern Theme Toggle Button */
.theme-toggle {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

/* Enhanced Modern Sidebar */
.sidebar-modern {
  background: var(--card);
  border-right: none;
  box-shadow: var(--shadow-light);
  position: relative;
  transition: width 0.3s ease-in-out;
  overflow: hidden;
}

.sidebar-modern::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--border) 10%,
    var(--border) 90%,
    transparent 100%
  );
  opacity: 0.6;
}

.sidebar-modern::before {
  content: '';
  position: absolute;
  top: 0;
  right: 1px;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
}

[data-theme="dark"] .sidebar-modern::before {
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
}

.nav-link-modern {
  color: var(--foreground-secondary);
  padding: 12px 16px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  backdrop-filter: blur(10px);
  text-decoration: none;
}

.nav-link-modern:hover {
  background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.08) 0%,
    rgba(139, 92, 246, 0.05) 100%),
    var(--card);
  color: var(--foreground);
  border-color: rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 2px 4px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-link-modern.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow:
    0 6px 20px rgba(59, 130, 246, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Dark theme nav links */
[data-theme="dark"] .nav-link-modern:hover {
  background: linear-gradient(135deg,
    rgba(59, 130, 246, 0.12) 0%,
    rgba(139, 92, 246, 0.08) 100%),
    rgba(20, 20, 20, 0.8);
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-link-modern.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow:
    0 6px 20px rgba(59, 130, 246, 0.25),
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Enhanced icon animations */
.nav-link-modern svg {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link-modern:hover svg {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.nav-link-modern.active svg {
  transform: scale(1.1);
  filter: brightness(1.2);
}

/* Logo Container Styles */
.logo-container {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  box-shadow: var(--shadow-light);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Expanded Logo Container Styles */
.logo-container-expanded {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  box-shadow:
    0 8px 25px rgba(59, 130, 246, 0.15),
    0 3px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-container-expanded::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.logo-container-expanded:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow:
    0 12px 35px rgba(59, 130, 246, 0.2),
    0 5px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .logo-container-expanded {
  box-shadow:
    0 8px 25px rgba(59, 130, 246, 0.2),
    0 3px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .logo-container-expanded:hover {
  box-shadow:
    0 12px 35px rgba(59, 130, 246, 0.25),
    0 5px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.logo-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 12px;
}

.logo-fallback {
  background: transparent;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* Sidebar Toggle Button (old - kept for theme toggle) */
.sidebar-toggle {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Bottom Sidebar Toggle Button */
.sidebar-toggle-bottom {
  background: linear-gradient(135deg, var(--card), rgba(255, 255, 255, 0.05));
  color: var(--foreground);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 14px 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.12),
    0 2px 6px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  min-height: 48px;
}

.sidebar-toggle-bottom::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(59, 130, 246, 0.1) 50%,
    transparent 100%);
  transition: left 0.3s ease;
}

.sidebar-toggle-bottom:hover {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--primary-foreground);
  border-color: var(--primary);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 8px 30px rgba(59, 130, 246, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sidebar-toggle-bottom:hover::before {
  left: 100%;
}

.sidebar-toggle-bottom:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-light);
}

/* Dark theme enhancements for toggle button */
[data-theme="dark"] .sidebar-toggle-bottom {
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.9), rgba(40, 40, 40, 0.8));
  border-color: rgba(59, 130, 246, 0.4);
  color: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sidebar-toggle-bottom:hover {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow:
    0 8px 30px rgba(59, 130, 246, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Feedback Link Styling */
.feedback-link {
  color: var(--foreground-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
}

.feedback-link:hover {
  background: var(--secondary);
  color: var(--foreground);
  border-color: var(--border);
  opacity: 1 !important;
}

/* Enhanced Navigation for Collapsed State */
.nav-link-modern {
  position: relative;
  overflow: visible;
}

.nav-link-modern[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  color: var(--foreground);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--border);
  z-index: 1000;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease-out forwards;
}

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

/* Collapsed Sidebar Responsive Padding */
.sidebar-modern .p-4 {
  transition: padding 0.3s ease;
}

/* Ensure icons are properly sized in collapsed state */
.nav-link-modern svg {
  transition: all 0.2s ease;
}

/* Modern Input Styles */
.input-modern {
  background: var(--input);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.input-modern:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Modern Button Styles */
.btn-modern {
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-modern:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.btn-modern:active {
  transform: translateY(0);
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  box-shadow: var(--shadow-large);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-large);
}

/* Welcome Message Styles */
.welcome-message-container {
  max-width: 100%;
  margin-bottom: 2rem;
}

.welcome-message {
  animation: fadeInScale 0.6s ease-out;
}

.welcome-bubble {
  max-width: 100%;
  background: linear-gradient(135deg, var(--card), var(--background-secondary));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.welcome-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--primary) 50%,
    transparent 100%
  );
  opacity: 0.6;
}

.welcome-header {
  margin-bottom: 24px;
  text-align: center;
}

.welcome-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 8px;
}

.welcome-header p {
  color: var(--foreground-secondary);
  font-size: 1rem;
  margin: 0;
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.capability-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.capability-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-light);
  transform: translateY(-1px);
}

.capability-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capability-card strong {
  display: block;
  color: var(--foreground);
  font-weight: 600;
  margin-bottom: 4px;
}

.capability-card p {
  color: var(--foreground-secondary);
  font-size: 0.9rem;
  font-style: italic;
  margin: 0;
}

.getting-started {
  margin-top: 24px;
  text-align: center;
}

.tip-badge {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-light);
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: 80px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  box-shadow: var(--shadow-medium);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.scroll-to-bottom-btn:hover {
  background: var(--accent);
  transform: scale(1.1);
  box-shadow: var(--shadow-large);
}

.scroll-to-bottom-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* Seamless Chat Input Container */
.chat-input-container-modern {
  background: var(--background);
  border: none;
  padding: 40px 32px 32px;
  position: relative;
  transition: all 0.3s ease;
  margin-top: auto;
}

/* Subtle gradient overlay for depth */
.chat-input-container-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.01) 50%,
    transparent 100%
  );
  pointer-events: none;
}

[data-theme="dark"] .chat-input-container-modern::before {
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.01) 50%,
    transparent 100%
  );
}

.chat-form-modern {
  max-width: 100%;
  width: 100%;
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 26px;
  padding: 4px 4px 4px 24px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.03);
  max-width: 800px;
  margin: 0 auto;
}

.chat-input-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--primary) 25%, transparent);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.chat-input-wrapper:focus-within {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 0 0 4px color-mix(in srgb, var(--primary) 8%, transparent);
}

.chat-input-wrapper:focus-within::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

[data-theme="dark"] .chat-input-wrapper {
  background: rgba(18, 18, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.2),
    0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .chat-input-wrapper:focus-within {
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.2),
    0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

.chat-input-modern {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.6;
  padding: 16px 8px 16px 0;
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-weight: 400;
  min-height: 24px;
  max-height: 120px;
  overflow-y: auto;
  transition: all 0.2s ease;
  scroll-behavior: smooth;
}

.chat-input-modern::placeholder {
  color: var(--foreground-secondary);
  opacity: 0.6;
  font-weight: 400;
  transition: opacity 0.2s ease;
}

.chat-input-modern:focus::placeholder {
  opacity: 0.4;
}

/* Custom scrollbar for textarea */
.chat-input-modern::-webkit-scrollbar {
  width: 4px;
}

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

.chat-input-modern::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.chat-input-modern::-webkit-scrollbar-thumb:hover {
  background: var(--foreground-secondary);
}

.send-button-modern {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  margin: 2px;
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.send-button-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.send-button-modern:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 8px 25px rgba(59, 130, 246, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.send-button-modern:hover::before {
  opacity: 1;
}

.send-button-modern:active {
  transform: translateY(0) scale(0.95);
  box-shadow:
    0 2px 8px rgba(59, 130, 246, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Disabled state */
.send-button-modern:disabled {
  background: var(--secondary);
  color: var(--secondary-foreground);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.send-button-modern:disabled::before {
  display: none;
}

.send-button-modern .send-icon,
.send-button-modern .check-icon {
  width: 20px;
  height: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.send-button-modern.sending {
  background: linear-gradient(135deg, #10b981, #059669);
  animation: sendingPulse 1s ease-in-out infinite;
}

.send-button-modern.sending .send-icon {
  transform: rotate(360deg) scale(0);
  opacity: 0;
}

.send-button-modern.sending .check-icon {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

@keyframes sendingPulse {
  0%, 100% {
    box-shadow:
      0 4px 12px rgba(16, 185, 129, 0.3),
      0 2px 4px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow:
      0 6px 20px rgba(16, 185, 129, 0.4),
      0 3px 6px rgba(0, 0, 0, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

.chat-input-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--foreground-secondary);
  min-height: 16px;
  transition: all 0.3s ease;
}

.char-counter {
  opacity: 0.5;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.typing-indicator-text {
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: typingPulse 1.5s ease-in-out infinite;
}

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

/* Input focus state animations */
.chat-input-wrapper.focused {
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 0 0 4px color-mix(in srgb, var(--primary) 8%, transparent);
  transform: translateY(-2px);
}

.chat-input-wrapper.focused::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

/* Enhanced input placeholder animation */
.chat-input-modern:not(:placeholder-shown) + .send-button-modern {
  transform: scale(1);
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chat-input-modern:placeholder-shown + .send-button-modern {
  opacity: 0.7;
  transform: scale(0.9);
}

/* Additional input enhancements */
.chat-input-wrapper:hover:not(:focus-within):not(.focused) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.06),
    0 1px 4px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .chat-input-wrapper:hover:not(:focus-within):not(.focused) {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.3),
    0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Original Chat Input Container (keep for backward compatibility) */
.chat-input-container {
  background: var(--card);
  border-top: none;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

/* Loading States */
.loading-pulse {
  animation: pulse 2s infinite;
}

/* Smooth Transitions */
* {
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--foreground-secondary);
}

/* Command Badge */
.command-badge {
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Execution Result */
.execution-result {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
}

.execution-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Comprehensive Mobile Responsive Design */

/* Large Screens (Desktop) */
@media (min-width: 1024px) {
  .chat-input-container-modern {
    padding: 24px 32px;
  }

  .user-menu-dropdown {
    min-width: 320px;
  }

  .card-modern {
    padding: 24px;
  }
}

/* Tablet Screens */
@media (max-width: 1023px) and (min-width: 769px) {
  .sidebar-modern {
    width: 240px;
  }

  .chat-input-modern {
    font-size: 15px;
  }

  .send-button-modern {
    width: 40px;
    height: 40px;
  }
}

/* Mobile Screens (Portrait) */
@media (max-width: 768px) {
  /* Layout adjustments */
  .sidebar-modern {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 1000;
    transition: left 0.3s ease;
    background: var(--card);
    box-shadow: var(--shadow-large);
  }

  .sidebar-modern.mobile-open {
    left: 0;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mobile header */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
  }

  .hamburger-menu {
    display: block;
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .hamburger-menu:hover {
    background: var(--secondary);
  }

  .hamburger-menu svg {
    width: 24px;
    height: 24px;
    color: var(--foreground);
  }

  /* Hide desktop hamburger */
  @media (min-width: 769px) {
    .hamburger-menu {
      display: none;
    }
  }

  /* Welcome message mobile adjustments */
  .welcome-bubble {
    padding: 16px;
    margin: 0 8px;
  }

  .welcome-header h3 {
    font-size: 1.3rem;
  }

  .capabilities-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 16px 0;
  }

  .capability-card {
    padding: 12px;
  }

  .capability-icon {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
  }

  .tip-badge {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  /* Scroll to bottom button mobile */
  .scroll-to-bottom-btn {
    width: 44px;
    height: 44px;
    bottom: 90px;
    right: 16px;
  }

  /* Collapsed sidebar mobile handling */
  .sidebar-modern.w-16 {
    width: 4rem !important;
  }

  .sidebar-modern .p-4 {
    padding: 1rem 0.5rem;
  }

  /* Logo container mobile */
  .logo-container {
    margin: 0 auto;
  }

  /* Bottom toggle mobile */
  .sidebar-toggle-bottom {
    padding: 10px 12px;
  }

  .sidebar-toggle-bottom svg {
    width: 18px;
    height: 18px;
  }

  .sidebar-toggle-bottom span {
    font-size: 12px;
  }

  .feedback-link {
    padding: 6px 8px;
  }

  /* Chat adjustments */
  .chat-bubble-modern {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 16px;
    box-shadow:
      0 3px 10px rgba(0, 0, 0, 0.08),
      0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .chat-bubble-modern:hover {
    transform: none; /* Disable hover effects on touch */
  }

  .chat-bubble-user {
    border-bottom-right-radius: 6px;
  }

  .chat-bubble-assistant {
    border-bottom-left-radius: 6px;
  }

  .chat-bubble-user::after,
  .chat-bubble-assistant::after {
    width: 10px;
    height: 10px;
  }

  /* Thinking bubble mobile */
  .thinking-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 6px;
  }

  .thinking-bubble::after {
    width: 10px;
    height: 10px;
  }

  .thinking-content {
    gap: 10px;
  }

  .thinking-text {
    font-size: 13px;
  }

  .thinking-dot {
    width: 5px;
    height: 5px;
  }

  /* AI stars mobile */
  .ai-stars {
    font-size: 14px;
  }

  .avatar-modern,
  .avatar-user-enhanced {
    width: 28px;
    height: 28px;
    font-size: 12px;
    margin: 0 6px;
  }

  .message-container {
    margin-bottom: 16px;
  }

  /* Chat input mobile optimization */
  .chat-input-container-modern {
    padding: 24px 16px 16px;
    background: var(--background);
    border: none;
    position: sticky;
    bottom: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  }

  .chat-input-container-modern::before {
    height: 30px;
  }

  .chat-input-wrapper {
    border-radius: 24px;
    padding: 3px 3px 3px 20px;
    max-width: none;
    margin: 0;
    box-shadow:
      0 3px 15px rgba(0, 0, 0, 0.08),
      0 1px 3px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .chat-input-wrapper:focus-within {
    transform: translateY(-1px);
    box-shadow:
      0 6px 20px rgba(0, 0, 0, 0.12),
      0 2px 6px rgba(0, 0, 0, 0.08),
      0 0 0 1px rgba(59, 130, 246, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .chat-input-modern {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 14px 8px 14px 0;
    line-height: 1.5;
    min-height: 22px;
  }

  .send-button-modern {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin: 1px;
  }

  .send-button-modern .send-icon,
  .send-button-modern .check-icon {
    width: 18px;
    height: 18px;
  }

  .chat-input-footer {
    margin-top: 8px;
    font-size: 11px;
  }

  /* User menu mobile */
  .user-menu-dropdown {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    margin: 0;
    border-radius: 0;
    transform: translateY(100%);
    border: none;
    min-width: auto;
    max-height: 70vh;
    overflow-y: auto;
  }

  .user-menu-dropdown.show {
    transform: translateY(30%);
    border-radius: 20px 20px 0 0;
  }

  .user-menu-header {
    padding: 24px 20px;
  }

  .user-avatar-large {
    width: 56px;
    height: 56px;
  }

  .user-initial-large {
    font-size: 20px;
  }

  /* Card adjustments */
  .card-modern {
    margin: 8px;
    padding: 16px;
    border-radius: 12px;
  }


  /* Navigation mobile */
  .nav-link-modern {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 0;
    margin: 2px 8px;
    border-radius: 8px;
  }

  /* Form adjustments */
  .input-modern {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 14px 16px;
    border-radius: 10px;
  }

  .btn-modern {
    padding: 14px 20px;
    font-size: 16px;
    min-height: 48px; /* Touch target size */
    border-radius: 8px;
  }

  /* Header mobile */
  header {
    padding: 12px 16px !important;
  }

  header h1 {
    font-size: 20px;
  }

  /* Page content mobile */
  .flex-1.overflow-auto {
    padding: 16px !important;
  }

  /* Thinking indicator mobile */
  .thinking-indicator {
    padding: 12px 16px;
    border-radius: 16px;
    margin: 0 8px;
  }

  .thinking-dots {
    gap: 4px;
  }

  .thinking-dot {
    width: 6px;
    height: 6px;
  }
}

/* Small Mobile Screens */
@media (max-width: 480px) {
  .chat-input-container-modern {
    padding: 20px 12px 12px;
  }

  .chat-input-wrapper {
    border-radius: 22px;
    padding: 2px 2px 2px 18px;
  }

  .chat-bubble-modern {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 14px;
  }

  .chat-bubble-user::after,
  .chat-bubble-assistant::after {
    width: 8px;
    height: 8px;
  }

  .thinking-bubble {
    padding: 10px 14px;
    border-radius: 14px;
  }

  .thinking-text {
    font-size: 12px;
  }

  .thinking-dot {
    width: 4px;
    height: 4px;
  }

  .ai-stars {
    font-size: 12px;
  }

  .avatar-modern,
  .avatar-user-enhanced {
    width: 24px;
    height: 24px;
    font-size: 11px;
    margin: 0 4px;
  }

  .send-button-modern {
    width: 36px;
    height: 36px;
  }

  .user-menu-dropdown.show {
    transform: translateY(20%);
  }

  .card-modern {
    margin: 4px;
    padding: 12px;
  }

  .btn-modern {
    padding: 12px 16px;
    font-size: 15px;
  }

  .input-modern {
    padding: 12px 14px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .hover-lift:hover {
    animation: none;
    transform: none;
  }

  .card-modern:hover {
    animation: none;
    transform: none;
    border-color: var(--border);
  }

  .btn-modern:hover {
    background: var(--primary);
    transform: none;
  }


  /* Focus styles for touch */
  .chat-input-modern:focus {
    transform: none;
    border-color: var(--primary);
  }

  .nav-link-modern:active {
    background: var(--secondary);
    transform: scale(0.98);
  }

  .btn-modern:active {
    transform: scale(0.95);
  }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .chat-input-container-modern {
    padding: 8px 16px;
  }

  .user-menu-dropdown.show {
    transform: translateY(10%);
    max-height: 80vh;
  }

  .sidebar-modern {
    width: 240px;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .border-glow {
    box-shadow: 0 0 0 0.5px var(--border),
                0 0 20px rgba(59, 130, 246, 0.1);
  }

  .card-modern {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
                0 1px 2px 0 rgba(0, 0, 0, 0.06);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .thinking-indicator::before {
    animation: none;
  }

  .thinking-dot {
    animation: none;
  }

  .nav-link-modern::before {
    transition: none;
  }
}

/* Enhanced User Menu */
.user-menu-modern {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--foreground);
}

.user-menu-trigger:hover {
  background: var(--secondary);
}

.user-avatar-header {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-light);
  position: relative;
  overflow: hidden;
}

.user-avatar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 50%;
}

.user-initial-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-foreground);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.menu-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.user-menu-trigger.active .menu-chevron {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-large);
  backdrop-filter: blur(20px);
  z-index: 1000;
  min-width: 280px;
  overflow: hidden;
  transform: translateY(-8px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.user-menu-dropdown.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.user-menu-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.user-initial-large {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.user-name {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0 12px;
}

.user-menu-nav {
  padding: 8px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--foreground);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.menu-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

[data-theme="dark"] .user-menu-dropdown {
  background: rgba(20, 20, 20, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced Dividers and Separators */
.header-divider {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--border) 20%,
    var(--border) 80%,
    transparent 100%
  );
  position: relative;
  margin: 20px 0;
}

.header-divider::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  transform: translateY(-1px);
}

[data-theme="dark"] .header-divider::after {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
}

.section-divider {
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--primary) 10%,
    var(--accent) 90%,
    transparent 100%
  );
  border-radius: 2px;
  margin: 24px 0;
  opacity: 0.6;
}

.menu-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 8px 16px;
  position: relative;
}

.menu-divider::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  transform: translateY(-1px);
}

[data-theme="dark"] .menu-divider::after {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
}

/* Enhanced Border Effects */
.border-gradient {
  border: 1px solid transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box,
              linear-gradient(135deg, var(--primary), var(--accent)) border-box;
  border-radius: 12px;
}

.border-glow {
  box-shadow: 0 0 0 1px var(--border),
              0 0 20px rgba(59, 130, 246, 0.1);
  transition: box-shadow 0.3s ease;
}

.border-glow:hover {
  box-shadow: 0 0 0 1px var(--primary),
              0 0 30px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .border-glow {
  box-shadow: 0 0 0 1px var(--border),
              0 0 20px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .border-glow:hover {
  box-shadow: 0 0 0 1px var(--primary),
              0 0 30px rgba(59, 130, 246, 0.25);
}

/* Rich Message Formatting */
.message-content {
  line-height: 1.6;
  word-wrap: break-word;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--foreground);
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.1em; }

.message-content p {
  margin: 8px 0;
}

.message-content strong {
  font-weight: 700;
  color: var(--foreground);
}

.message-content em {
  font-style: italic;
  color: var(--foreground-secondary);
}

.message-content code {
  background: var(--secondary);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.message-content pre {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  overflow-x: auto;
  position: relative;
}

.message-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--foreground);
  font-size: 0.85em;
  line-height: 1.5;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--border);
  margin: -12px -16px 8px -16px;
  padding: 8px 16px;
  font-size: 0.8em;
  color: var(--foreground-secondary);
  border-bottom: 1px solid var(--border);
}

.copy-code-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-code-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.message-content blockquote {
  border-left: 4px solid var(--primary);
  background: var(--secondary);
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  position: relative;
}

.message-content blockquote::before {
  content: '"';
  font-size: 3em;
  color: var(--primary);
  position: absolute;
  top: -10px;
  left: 8px;
  opacity: 0.3;
}

.message-content ul,
.message-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.message-content li {
  margin: 4px 0;
  line-height: 1.5;
}

.message-content a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.message-content a:hover {
  border-bottom-color: var(--primary);
}

.message-content a::before {
  content: '🔗';
  margin-right: 4px;
  opacity: 0.6;
  font-size: 0.8em;
}

.message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.message-content th,
.message-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.message-content th {
  background: var(--secondary);
  font-weight: 600;
}

.message-content tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .message-content tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}


/* Status Indicators */
.message-status {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--foreground-secondary);
}

.status-icon {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.status-sending {
  color: var(--accent);
}

.status-sent {
  color: var(--primary);
}

.status-delivered {
  color: var(--primary);
}

.status-read {
  color: var(--primary);
}

.status-error {
  color: #ef4444;
}

/* Message Timestamps */
.message-timestamp {
  margin-top: 4px;
  text-align: right;
}

.message-time {
  font-size: 10px;
  color: var(--foreground-secondary);
  opacity: 0.7;
}

/* Link Preview */
.link-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
  background: var(--card);
  transition: all 0.2s ease;
}

.link-preview:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-light);
}

.link-preview-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.link-preview-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--foreground);
}

.link-preview-description {
  color: var(--foreground-secondary);
  font-size: 0.9em;
  line-height: 1.4;
}

.link-preview-url {
  color: var(--primary);
  font-size: 0.8em;
  text-decoration: none;
}

/* Syntax Highlighting */
.hljs {
  background: var(--secondary) !important;
  color: var(--foreground) !important;
}

.hljs-keyword { color: var(--primary); }
.hljs-string { color: var(--accent); }
.hljs-comment { color: var(--foreground-secondary); opacity: 0.7; }
.hljs-number { color: #f59e0b; }
.hljs-function { color: var(--primary); }
.hljs-variable { color: var(--foreground); }

/* Utility Classes */
.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass-effect {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Page-Specific Styling */

/* Enhanced Search Container */
.search-container-modern {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%),
    var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 24px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  margin-bottom: 32px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-container-modern:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .search-container-modern {
  background: linear-gradient(135deg,
    rgba(20, 20, 20, 0.9) 0%,
    rgba(40, 40, 40, 0.8) 100%);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  z-index: 10;
  color: var(--foreground-secondary);
  transition: all 0.3s ease;
}

.search-input-modern {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px 14px 48px;
  font-size: 15px;
  color: var(--foreground);
  transition: all 0.15s ease;
}

.search-input-modern::placeholder {
  color: var(--foreground-secondary);
}

.search-input-modern:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input-wrapper:focus-within .search-icon {
  color: var(--primary);
}

/* Filter Select Wrapper */
.filter-select-wrapper {
  position: relative;
  min-width: 200px;
}

.filter-select-wrapper::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--foreground-secondary);
  pointer-events: none;
}

.filter-select-modern {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 40px 14px 18px;
  font-size: 15px;
  color: var(--foreground);
  transition: all 0.15s ease;
  appearance: none;
  cursor: pointer;
}

.filter-select-modern:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Contacts Grid */
.contacts-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 24px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.contacts-grid-modern > .neu-card {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 1200px) {
  .contacts-grid-modern {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1600px) {
  .contacts-grid-modern {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Contact Card Styling */
.contact-card-modern {
  background: var(--card, #ffffff);
  color: var(--card-foreground, #0f172a);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 100px;
}

[data-theme="dark"] .contact-card-modern {
  background: var(--card, #141414);
  color: var(--card-foreground, #fafafa);
  border-color: var(--border, #2a2a2a);
}

.contact-card-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contact-card-modern:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  border-color: #3b82f6;
}

.contact-card-modern:hover::before {
  opacity: 1;
}

.contact-card-modern .avatar-modern {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin: 0;
}

.contact-card-modern .btn-icon-modern {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--foreground-secondary, #475569);
}

[data-theme="dark"] .contact-card-modern .btn-icon-modern {
  background: var(--background-secondary, #1e1e1e);
  border-color: var(--border, #2a2a2a);
  color: var(--foreground-secondary, #a1a1aa);
}

.contact-card-modern .btn-icon-modern:hover {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.contact-card-modern .btn-icon-modern.btn-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
}

/* Organizations Grid */
.organizations-grid-modern {
  display: grid;
  gap: 24px;
  margin-top: 32px;
}

/* Projects Grid */
.projects-grid-modern {
  display: grid;
  gap: 24px;
  margin-top: 32px;
}

/* Tasks Grid */
.tasks-grid-modern {
  display: grid;
  gap: 24px;
  margin-top: 32px;
}

/* Loading Card */
.loading-card-modern {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%),
    var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.loading-spinner-modern {
  width: 48px;
  height: 48px;
  margin: 0 auto 24px;
  border: 4px solid rgba(59, 130, 246, 0.2);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Modal Styling */
.modal-modern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.modal-modern[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-modern::backdrop {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop-modern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: -1;
}

[data-theme="dark"] .modal-modern::backdrop,
[data-theme="dark"] .modal-backdrop-modern {
  background: rgba(0, 0, 0, 0.4);
}

.modal-card-modern {
  background: var(--card);
  border-radius: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.2),
    0 8px 20px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header-modern {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.05) 0%,
    transparent 100%);
}

.icon-badge-modern {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-foreground);
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground-secondary);
  transition: all 0.3s ease;
  cursor: pointer;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--foreground);
  transform: scale(1.05);
}

.modal-content-modern {
  padding: 32px;
  max-height: calc(90vh - 120px);
  overflow-y: auto;
}

.modal-actions-modern {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Form Styling */
.form-group-modern {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label-modern {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  opacity: 0.9;
}

.form-input-modern {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  color: var(--foreground);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.form-input-modern:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.12);
}

.form-textarea-modern {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  color: var(--foreground);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  resize: vertical;
  min-height: 80px;
}

.form-textarea-modern:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .form-input-modern,
[data-theme="dark"] .form-textarea-modern {
  background: rgba(20, 20, 20, 0.8);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .form-input-modern:focus,
[data-theme="dark"] .form-textarea-modern:focus {
  background: rgba(20, 20, 20, 0.9);
  border-color: var(--primary);
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--primary-foreground);
  border: none;
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px rgba(59, 130, 246, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-secondary {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--secondary);
  border-color: var(--foreground-secondary);
}

/* Auth-specific Components */
.error-alert-modern {
  background: linear-gradient(135deg,
    rgba(239, 68, 68, 0.1) 0%,
    rgba(239, 68, 68, 0.05) 100%),
    var(--card);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #dc2626;
  backdrop-filter: blur(10px);
  animation: alertSlideIn 0.3s ease-out;
}

[data-theme="dark"] .error-alert-modern {
  background: linear-gradient(135deg,
    rgba(239, 68, 68, 0.15) 0%,
    rgba(239, 68, 68, 0.08) 100%),
    rgba(20, 20, 20, 0.8);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

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

.checkbox-modern {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  appearance: none;
}

.checkbox-modern:checked {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: var(--primary);
}

.checkbox-modern:checked::before {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.checkbox-modern:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

[data-theme="dark"] .checkbox-modern {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(20, 20, 20, 0.8);
}

/* =====================================================
   ENTITY CARDS IN CHAT - CRUD Operation Results
   ===================================================== */

/* Card container */
.entity-card-container {
  animation: cardPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardPopIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  50% {
    transform: scale(1.02) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Entity card base */
.entity-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.entity-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* Clickable card styles */
.entity-card-clickable {
  cursor: pointer;
}

.entity-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.12),
    0 4px 8px rgba(0, 0, 0, 0.06);
  border-color: var(--primary);
}

/* Card header */
.entity-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.entity-card-icon {
  font-size: 24px;
  line-height: 1;
}

.entity-card-title-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.entity-card-type {
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.entity-card-action {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Action badge colors */
.bg-green-100 { background-color: rgba(34, 197, 94, 0.15); }
.text-green-800 { color: #166534; }
.bg-blue-100 { background-color: rgba(59, 130, 246, 0.15); }
.text-blue-800 { color: #1e40af; }
.bg-red-100 { background-color: rgba(239, 68, 68, 0.15); }
.text-red-800 { color: #991b1b; }

[data-theme="dark"] .text-green-800 { color: #86efac; }
[data-theme="dark"] .text-blue-800 { color: #93c5fd; }
[data-theme="dark"] .text-red-800 { color: #fca5a5; }

/* Card name */
.entity-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 8px;
  line-height: 1.3;
}

/* Card details */
.entity-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entity-card-detail {
  font-size: 13px;
  color: var(--foreground-secondary);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.detail-label {
  font-weight: 500;
  color: var(--foreground-secondary);
  min-width: 80px;
}

.detail-value {
  color: var(--foreground);
}

/* Badges container */
.entity-card-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* Status badges */
.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: capitalize;
}

.status-pending { background: rgba(251, 191, 36, 0.15); color: #92400e; }
.status-in-progress, .status-in_progress { background: rgba(59, 130, 246, 0.15); color: #1e40af; }
.status-completed { background: rgba(34, 197, 94, 0.15); color: #166534; }
.status-planned { background: rgba(168, 85, 247, 0.15); color: #6b21a8; }
.status-cancelled { background: rgba(107, 114, 128, 0.15); color: #374151; }

[data-theme="dark"] .status-pending { color: #fcd34d; }
[data-theme="dark"] .status-in-progress, [data-theme="dark"] .status-in_progress { color: #93c5fd; }
[data-theme="dark"] .status-completed { color: #86efac; }
[data-theme="dark"] .status-planned { color: #d8b4fe; }
[data-theme="dark"] .status-cancelled { color: #9ca3af; }

/* Priority badges */
.priority-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: capitalize;
}

.priority-low { background: rgba(34, 197, 94, 0.15); color: #166534; }
.priority-medium { background: rgba(251, 191, 36, 0.15); color: #92400e; }
.priority-high { background: rgba(249, 115, 22, 0.15); color: #9a3412; }
.priority-urgent, .priority-critical { background: rgba(239, 68, 68, 0.15); color: #991b1b; }

[data-theme="dark"] .priority-low { color: #86efac; }
[data-theme="dark"] .priority-medium { color: #fcd34d; }
[data-theme="dark"] .priority-high { color: #fdba74; }
[data-theme="dark"] .priority-urgent, [data-theme="dark"] .priority-critical { color: #fca5a5; }

/* Card footer */
.entity-card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.view-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.entity-card-clickable:hover .view-link {
  color: var(--accent);
  transform: translateX(3px);
}

/* Dark mode adjustments */
[data-theme="dark"] .entity-card {
  background: var(--card);
  border-color: var(--border-light);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .entity-card-clickable:hover {
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .bg-green-100 { background-color: rgba(34, 197, 94, 0.2); }
[data-theme="dark"] .bg-blue-100 { background-color: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .bg-red-100 { background-color: rgba(239, 68, 68, 0.2); }

/* ============================================
   HEADER - Clean minimal
   ============================================ */

.header-minimal {
  padding: 16px 24px;
  background: var(--background);
  border-bottom: 0px solid color-mix(in srgb, var(--border) 45%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-minimal h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* User menu */
.user-menu-minimal {
  position: relative;
}

.user-menu-trigger-minimal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-menu-trigger-minimal:hover {
  background: var(--secondary);
}

.user-avatar-minimal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-menu-dropdown-minimal {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s ease;
  z-index: 50;
}

.user-menu-dropdown-minimal.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-header-minimal {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.user-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.user-menu-email {
  font-size: 12px;
  color: var(--foreground-secondary);
}

.user-menu-item-minimal {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--foreground);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.user-menu-item-minimal:hover {
  background: var(--secondary);
}

.user-menu-item-minimal svg {
  width: 16px;
  height: 16px;
  color: var(--foreground-secondary);
}

.user-menu-item-minimal.danger {
  color: var(--danger);
}

.user-menu-item-minimal.danger svg {
  color: var(--danger);
}

/* ============================================
   BUTTONS - Clean minimal
   ============================================ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--secondary);
  border-color: var(--foreground-secondary);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  color: var(--primary);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.btn-ghost:hover {
  background: var(--primary-light);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 15px;
}

/* ============================================
   FORM INPUTS - Clean minimal
   ============================================ */

.input-minimal {
  width: 100%;
  padding: 10px 14px;
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-minimal::placeholder {
  color: var(--foreground-secondary);
}

.input-minimal:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}

.input-group {
  margin-bottom: 16px;
}

.textarea-minimal {
  width: 100%;
  padding: 10px 14px;
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--foreground);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea-minimal:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.select-minimal {
  width: 100%;
  padding: 10px 14px;
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--foreground);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-minimal:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   MODALS - Subtle backdrop, clean design
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(var(--modal-blur));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 90%;
  max-height: 85vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.15s ease;
}

.modal-backdrop.show .modal-container {
  transform: scale(1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ============================================
   CARDS - Clean minimal
   ============================================ */

.card-minimal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card-minimal:hover {
  box-shadow: var(--shadow-sm);
}

.card-minimal-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* Stat card for dashboard */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-card .stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card .stat-icon.blue {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-card .stat-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8B5CF6;
}

.stat-card .stat-icon.pink {
  background: rgba(236, 72, 153, 0.1);
  color: #EC4899;
}

.stat-card .stat-icon.orange {
  background: rgba(249, 115, 22, 0.1);
  color: #F97316;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 14px;
  color: var(--foreground-secondary);
}

/* ============================================
   CHAT - iMessage style bubbles
   ============================================ */

.chat-container-minimal {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* Critical for flex child scrolling */
  background: var(--background);
  position: relative;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  min-height: 0; /* Critical for flex child scrolling */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--foreground-secondary);
}

/* Message containers */
.message-user {
  display: flex;
  justify-content: flex-end;
  max-width: 100%;
}

.message-assistant {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 100%;
}

/* Chat bubbles */
.bubble-user {
  max-width: 70%;
  padding: 12px 16px;
  background: #E8E8ED;
  color: #1D1D1F;
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
}

[data-theme="dark"] .bubble-user {
  background: #2C2C2E;
  color: #F5F5F7;
}

/* Canvas-style — no bubble for assistant responses */
.bubble-assistant {
  padding: 2px 0;
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.7;
  word-wrap: break-word;
  letter-spacing: -0.011em;
}

/* Assistant avatar */
.assistant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.assistant-avatar svg {
  width: 18px;
  height: 18px;
  color: var(--background);
}

[data-theme="dark"] .assistant-avatar {
  background: #000000;
}

[data-theme="dark"] .assistant-avatar svg {
  color: var(--background);
}

/* Timestamps */
.message-time-user {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
  text-align: right;
}

.message-time-assistant {
  font-size: 11px;
  color: var(--foreground-secondary);
  margin-top: 4px;
}

/* Message content formatting */
.bubble-user p,
.bubble-assistant p {
  margin: 0 0 8px 0;
}

.bubble-user p:last-child,
.bubble-assistant p:last-child {
  margin-bottom: 0;
}

.bubble-assistant code {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
}

.bubble-user code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* Code blocks in assistant messages */
.bubble-assistant pre {
  background: #1e1e1e;
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}

.bubble-assistant pre code {
  display: block;
  padding: 12px;
  background: transparent;
  color: #d4d4d4;
  overflow-x: auto;
}

/* Scroll to bottom button */
.scroll-btn {
  position: absolute;
  bottom: 90px; /* Above the input container */
  right: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 10;
}

.scroll-btn:hover {
  background: var(--secondary);
  box-shadow: var(--shadow-md);
}

.scroll-btn svg {
  width: 16px;
  height: 16px;
  color: var(--foreground-secondary);
}

/* ============================================
   CHAT INPUT - Clean with attach button
   ============================================ */

.chat-input-container {
  width: 100%;
  padding: 20px 24px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--border) 25%, transparent) 0px, var(--background) 1px);
  border-top: none;
  flex-shrink: 0;
}

.chat-input-container form {
  width: 100%;
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 800px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 26px;
  padding: 6px 8px 6px 16px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.03);
}

.chat-input-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--primary) 25%, transparent);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
  opacity: 0;
}

.chat-input-wrapper:focus-within {
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 0 0 4px color-mix(in srgb, var(--primary) 8%, transparent);
  transform: translateY(-2px);
}

.chat-input-wrapper:focus-within::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

/* Attach button */
.attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  position: relative;
}

.attach-btn:hover {
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
  color: var(--foreground);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--foreground) 4%, transparent);
}

.attach-btn svg {
  width: 18px;
  height: 18px;
}

/* Attach tooltip */
.attach-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--foreground);
  color: var(--background);
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

.attach-btn:hover .attach-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Input field */
.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 8px;
  font-size: 16px;
  color: var(--foreground);
  resize: none;
  min-height: 24px;
  max-height: 200px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

.chat-input::placeholder {
  color: var(--foreground-secondary);
  opacity: 0.55;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-input:focus::placeholder {
  opacity: 0.3;
  transform: translateX(4px);
}

.chat-input:focus {
  outline: none;
}

/* Textarea scrollbar */
.chat-input::-webkit-scrollbar {
  width: 3px;
}

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

.chat-input::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 4px;
}

.chat-input::-webkit-scrollbar-thumb:hover {
  background: var(--foreground-secondary);
}

/* Send button */
.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.25s ease,
              filter 0.25s ease;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.send-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 20%, transparent) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: -1;
}

.send-btn:hover:not(:disabled) {
  box-shadow:
    0 0 16px color-mix(in srgb, var(--primary) 35%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

.send-btn:hover:not(:disabled)::after {
  opacity: 1;
}

.send-btn:active:not(:disabled) {
  box-shadow:
    0 0 6px color-mix(in srgb, var(--primary) 25%, transparent),
    0 1px 4px rgba(0, 0, 0, 0.1);
  filter: brightness(0.95);
}

.send-btn:active:not(:disabled)::after {
  opacity: 0;
}

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

.send-btn:disabled::after {
  display: none;
}

.send-btn svg {
  width: 16px;
  height: 16px;
  position: relative;
  z-index: 1;
}

.send-btn.sending {
  filter: brightness(1.1);
}

/* Dark theme - send button glow stronger */
[data-theme="dark"] .send-btn:hover:not(:disabled) {
  box-shadow:
    0 0 20px color-mix(in srgb, var(--primary) 40%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .send-btn::after {
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 25%, transparent) 0%, transparent 70%);
}

/* Dark theme - attach/voice button halos */
[data-theme="dark"] .attach-btn:hover {
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--foreground) 6%, transparent);
}

/* Thinking indicator */
.thinking-minimal {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.thinking-bubble-minimal {
  padding: 12px 16px;
  background: var(--background-secondary);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thinking-text-minimal {
  font-size: 14px;
  color: var(--foreground-secondary);
}

.thinking-dots-minimal {
  display: flex;
  gap: 4px;
}

.thinking-dot-minimal {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--foreground-secondary);
  animation: thinking-bounce 1.4s infinite ease-in-out;
}

.thinking-dot-minimal:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dot-minimal:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* ============================================
   SHARP CORPORATE INPUTS & SEARCH BARS
   ============================================ */

.neu-input,
input.neu-input,
select.neu-input,
textarea.neu-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  min-height: 38px;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-shadow: none;
}

.neu-input:hover {
  border-color: var(--input-border);
}

.neu-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.neu-input::placeholder {
  color: var(--foreground-secondary);
}

/* Search input with icon */
.neu-search-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.neu-search-wrapper .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--foreground-secondary);
  pointer-events: none;
}

.neu-search-wrapper .neu-input {
  padding-left: 2.25rem;
}

/* ============================================
   SHARP CORPORATE CARDS
   ============================================ */

.neu-card {
  position: relative;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 0 0 1px rgba(0, 0, 0, 0.02);
  min-width: 0;

  /* Parallax tilt support */
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, border-color 0.2s ease, box-shadow 0.25s ease;
  will-change: transform;

  /* Reduce reflow cost during sidebar/layout transitions */
  contain: layout paint;
}

.neu-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 8px rgba(0, 0, 0, 0.04),
    0 12px 24px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease-out, border-color 0.2s ease, box-shadow 0.25s ease;
}

/* Gradient accent bar on hover */
.neu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 8px 8px 0 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

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

/* Tilt perspective container */
.tilt-container {
  /* Keep neutral; per-card JS transforms already set their own perspective.
     Container-level perspective causes uneven tilt strength on very tall lists. */
  perspective: none;
}

.neu-card-flat {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: none;
}

/* ============================================
   SHARP CORPORATE BUTTONS
   ============================================ */

.neu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  min-height: 38px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.neu-btn:hover {
  background: var(--secondary);
  border-color: var(--input-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.neu-btn:active {
  background: var(--secondary-hover);
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.neu-btn-primary {
  background: linear-gradient(135deg, #4F8EF7 0%, var(--primary) 50%, #2563EB 100%);
  border: none;
  color: white;
  box-shadow:
    0 2px 8px rgba(59, 130, 246, 0.25),
    0 1px 2px rgba(59, 130, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.neu-btn-primary:hover {
  background: linear-gradient(135deg, #5B97F8 0%, #3B82F6 50%, #1D4ED8 100%);
  box-shadow:
    0 4px 16px rgba(59, 130, 246, 0.35),
    0 2px 4px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.neu-btn-primary:active {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  box-shadow:
    0 1px 4px rgba(59, 130, 246, 0.2),
    inset 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: translateY(0);
}

.neu-btn-primary svg {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

[data-theme="dark"] .neu-btn-primary {
  box-shadow:
    0 2px 12px rgba(59, 130, 246, 0.3),
    0 1px 3px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .neu-btn-primary:hover {
  box-shadow:
    0 4px 20px rgba(59, 130, 246, 0.4),
    0 2px 6px rgba(59, 130, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.neu-btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--danger);
}

.neu-btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.neu-btn-sm {
  padding: 0.375rem 0.75rem;
  min-height: 32px;
  font-size: 0.8125rem;
}

.neu-btn-icon {
  width: 38px;
  padding: 0;
}

.neu-btn-icon.neu-btn-sm {
  width: 32px;
  min-height: 32px;
}

/* ============================================
   SHARP CORPORATE MODALS
   ============================================ */

.neu-modal {
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.neu-modal[open] {
  display: flex;
  flex-direction: column;
  margin: auto;
}

.neu-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* Modal size variants */
.neu-modal-sm {
  width: 100%;
  max-width: 420px;
}

.neu-modal-md {
  width: 100%;
  max-width: 520px;
}

.neu-modal-lg {
  width: 100%;
  max-width: 720px;
}

.neu-modal-xl {
  width: 95%;
  max-width: 1060px;
  height: 92vh;
  max-height: 92vh;
}

.neu-modal-xl .neu-modal-body {
  min-height: 420px;
}

.neu-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.neu-modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.neu-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.neu-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--background-secondary);
  flex-shrink: 0;
}

.neu-modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.neu-modal-close:hover {
  background: var(--secondary);
  color: var(--foreground);
}

/* ============================================
   SHARP CORPORATE SELECTS & DROPDOWNS
   ============================================ */

.neu-select {
  appearance: none;
  background: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2386868B'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 38px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-shadow: none;
}

.neu-select:hover {
  border-color: var(--input-border);
}

.neu-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   FORM LAYOUT HELPERS
   ============================================ */

.neu-form-group {
  margin-bottom: 1rem;
}

.neu-form-group label,
.neu-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground-secondary);
  margin-bottom: 0.375rem;
}

.neu-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .neu-form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   SHARP CORPORATE BADGES & TAGS
   ============================================ */

.neu-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--secondary);
  color: var(--foreground-secondary);
  border: 1px solid var(--border-light);
  box-shadow: none;
  white-space: nowrap;
}

.neu-badge-primary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.2);
}

.neu-badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.2);
}

.neu-badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ============================================
   SHARP CORPORATE LISTS & TABLES
   ============================================ */

.neu-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.neu-list-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

.neu-list-item:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 8px rgba(0, 0, 0, 0.04),
    0 8px 16px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

/* Gradient left accent bar on hover */
.neu-list-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px 0 0 2px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.neu-list-item:hover::before {
  opacity: 1;
}

.neu-list-item-clickable {
  cursor: pointer;
}

/* Task Table View Styles */
.task-table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  border-collapse: collapse;
  background: var(--card);
}

.task-table th {
  background: var(--background-secondary);
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--foreground-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.task-table td {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.task-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.task-table tbody tr:hover {
  background: var(--secondary);
}

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

.task-table .task-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.task-table .task-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-table tbody tr:hover .task-actions {
  opacity: 1;
}

.task-table .task-subject {
  font-weight: 500;
  color: var(--foreground);
}

.task-table .task-subject.completed {
  text-decoration: line-through;
  opacity: 0.6;
}

/* View Toggle Styles */
.view-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.view-toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  color: var(--foreground-secondary);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-toggle:last-child {
  border-right: none;
}

.view-toggle:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.view-toggle.active {
  background: var(--primary);
  color: white;
}

.view-toggle svg {
  width: 1rem;
  height: 1rem;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.neu-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--background-secondary);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.neu-modal .neu-empty-state {
  padding: 1.5rem 1rem;
}

.neu-empty-state svg {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--foreground-secondary);
  opacity: 0.45;
  margin-bottom: 0.75rem;
}

.neu-empty-state h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}

.neu-empty-state p {
  font-size: 0.8125rem;
  color: var(--foreground-secondary);
  margin-bottom: 0;
  line-height: 1.5;
}

.neu-empty-state p + p {
  margin-top: 0.25rem;
}

/* ============================================
   PAGE HEADERS
   ============================================ */

.neu-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

.neu-page-header > div:first-child {
  padding-left: 0.75rem;
  border-left: 2px solid var(--primary);
}

.neu-page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--foreground);
}

.neu-page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Toolbar with search and filters */
.neu-toolbar {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--card) 93%, var(--primary) 7%) 0%,
      var(--card) 100%
    );
  border: 1px solid var(--border);
  border-top: 2px solid color-mix(in srgb, var(--primary) 35%, var(--border) 65%);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 4px 14px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 color-mix(in srgb, white 6%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.neu-toolbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--primary) 18%, transparent) 30%,
    color-mix(in srgb, var(--accent) 12%, transparent) 70%,
    transparent 100%
  );
  pointer-events: none;
}

.neu-toolbar:hover {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 color-mix(in srgb, white 8%, transparent);
}

[data-theme="dark"] .neu-toolbar {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--card) 94%, var(--primary) 6%) 0%,
      var(--card) 100%
    );
  border-color: var(--border-light);
  border-top-color: color-mix(in srgb, var(--primary) 30%, var(--border-light) 70%);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .neu-toolbar:hover {
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.neu-toolbar-search {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

/* Enhanced search input inside toolbar */
.neu-toolbar .neu-search-wrapper .neu-input {
  background: color-mix(in srgb, var(--background) 55%, var(--card) 45%);
  border-color: color-mix(in srgb, var(--border) 65%, transparent);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.neu-toolbar .neu-search-wrapper .neu-input:hover {
  border-color: var(--input-border);
  background: color-mix(in srgb, var(--card) 80%, var(--background) 20%);
}

.neu-toolbar .neu-search-wrapper .neu-input:focus {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), 0 2px 8px rgba(59, 130, 246, 0.08);
}

.neu-toolbar .neu-search-wrapper:focus-within .search-icon {
  color: var(--primary);
  transition: color 0.2s ease;
}

.neu-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding-top: 0.875rem;
  margin-top: 0.125rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  position: relative;
}

.neu-toolbar-filters .neu-form-group {
  margin-bottom: 0;
  min-width: 140px;
}

/* Enhanced select dropdowns inside toolbar */
.neu-toolbar-filters .neu-select {
  background: color-mix(in srgb, var(--background) 50%, var(--card) 50%);
  border-color: color-mix(in srgb, var(--border) 65%, transparent);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.neu-toolbar-filters .neu-select:hover {
  border-color: var(--input-border);
  background: var(--card);
}

.neu-toolbar-filters .neu-select:focus {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), 0 2px 8px rgba(59, 130, 246, 0.08);
}

/* Export and action buttons inside toolbar */
.neu-toolbar-filters .neu-btn {
  align-self: flex-end;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

.neu-toolbar-filters .neu-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.12);
}

/* === Role-Based Avatar Rings === */
.avatar-with-role {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    color: var(--foreground);
    background: var(--card);
}

.avatar-with-role.size-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-with-role.size-lg { width: 40px; height: 40px; font-size: 14px; }

/* Role rings */
.avatar-with-role.role-owner {
    box-shadow: 0 0 0 2px #F59E0B;
}

.avatar-with-role.role-you {
    box-shadow: 0 0 0 2px #3B82F6;
}

.avatar-with-role.role-member {
    box-shadow: 0 0 0 1px var(--border);
}

/* Team tint backgrounds */
.avatar-with-role.team-blue { background: rgba(59, 130, 246, 0.15); }
.avatar-with-role.team-green { background: rgba(34, 197, 94, 0.15); }
.avatar-with-role.team-purple { background: rgba(168, 85, 247, 0.15); }
.avatar-with-role.team-orange { background: rgba(249, 115, 22, 0.15); }
.avatar-with-role.team-teal { background: rgba(20, 184, 166, 0.15); }
.avatar-with-role.team-pink { background: rgba(236, 72, 153, 0.15); }

/* === Stacked Avatars === */
.stacked-avatars {
    display: inline-flex;
    align-items: center;
    position: relative;
    isolation: isolate;
    cursor: pointer;
    border-radius: 999px;
    padding: 2px 0 2px 8px;
    outline: none;
    user-select: none;
}

.stacked-avatars:focus-visible {
    box-shadow: 0 0 0 3px var(--primary-light);
}

.stacked-avatars .avatar-with-role,
.stacked-avatars .avatar-overflow {
    border: 2px solid var(--card);
    box-sizing: border-box;
    flex-shrink: 0;
}

.stacked-avatars .avatar-with-role.size-sm,
.stacked-avatars .avatar-overflow {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.stacked-avatars .avatar-with-role {
    margin-left: -9px;
    transition: margin-left 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.stacked-avatars .avatar-with-role:first-child {
    margin-left: 0;
}

.stacked-avatars .avatar-overflow {
    border-radius: 50%;
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-left: -9px;
    color: var(--foreground-secondary);
    letter-spacing: -0.02em;
    transition: margin-left 0.2s ease, transform 0.2s ease;
}

.stacked-avatars:hover .avatar-with-role:not(:first-child),
.stacked-avatars:hover .avatar-overflow,
.stacked-avatars:focus .avatar-with-role:not(:first-child),
.stacked-avatars:focus .avatar-overflow,
.stacked-avatars:focus-within .avatar-with-role:not(:first-child),
.stacked-avatars:focus-within .avatar-overflow {
    margin-left: -5px;
    transform: translateY(-1px);
}

/* Hover card for stacked avatars */
.stacked-avatars-card {
    position: absolute;
    bottom: calc(100% + 10px);
    top: auto;
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 250px;
    max-width: min(320px, calc(100vw - 2rem));
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
    z-index: 220;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom left;
    transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.2s;
    pointer-events: none;
    backdrop-filter: blur(6px);
    display: none;
}

.stacked-avatars-card.align-right {
    left: auto;
    right: 0;
    transform-origin: bottom right;
}

.stacked-avatars:hover .stacked-avatars-card,
.stacked-avatars:focus .stacked-avatars-card,
.stacked-avatars:focus-within .stacked-avatars-card {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.stacked-avatars-card .member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}

.stacked-avatars-card .member-row:hover {
    background: var(--background);
}

.stacked-avatars-card .member-row .avatar-with-role.size-sm,
.stacked-avatars-card .member-row .avatar-overflow {
    width: 26px;
    height: 26px;
    font-size: 10px;
}

.stacked-avatars-card .role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.stacked-avatars-card .role-dot.owner { background: #F59E0B; }
.stacked-avatars-card .role-dot.you { background: #3B82F6; }
.stacked-avatars-card .role-dot.member { background: var(--border); }

.stacked-avatars-card .member-meta {
    min-width: 0;
}

.stacked-avatars-card .member-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stacked-avatars-card .member-subtext {
    font-size: 11px;
    color: var(--foreground-secondary);
    line-height: 1.2;
    margin-top: 1px;
}

.card-ownership-corner {
    position: absolute;
    right: 0.65rem;
    bottom: 0.55rem;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 0.5rem;
    width: calc(100% - 1.3rem);
    z-index: 6;
    pointer-events: none;
}

.card-ownership-label {
    font-size: 11px;
    color: var(--foreground-secondary);
    line-height: 1.2;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 3.4rem);
}

.card-ownership-corner .stacked-avatars {
    pointer-events: auto;
}

.record-card-owned {
    position: relative;
    padding-bottom: 2.8rem !important;
    overflow: visible !important;
    contain: style;
}

/* === Workspace Switcher === */
.workspace-switcher {
    position: relative;
    margin-right: 12px;
}

.workspace-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground);
    transition: border-color 0.15s, background 0.15s;
}

.workspace-trigger:hover {
    border-color: var(--primary);
    background: var(--background);
}

.workspace-trigger .workspace-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-trigger .you-badge {
    font-size: 10px;
    color: var(--foreground-secondary);
    opacity: 0.7;
}

.workspace-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.workspace-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.workspace-dropdown .workspace-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 13px;
    color: var(--foreground);
}

.workspace-dropdown .workspace-item:hover {
    background: var(--background);
}

.workspace-dropdown .workspace-item.current {
    background: rgba(59, 130, 246, 0.1);
}

.workspace-dropdown .workspace-item .check-icon {
    width: 16px;
    color: #3B82F6;
}

.workspace-dropdown .workspace-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.workspace-dropdown .workspace-item.join-new {
    color: var(--primary);
}

/* === Segmented Filter Control === */
.segmented-filter {
    display: inline-flex;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.segmented-filter button {
    padding: 6px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground-secondary);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.segmented-filter button:hover {
    color: var(--foreground);
}

.segmented-filter button.active {
    background: var(--card);
    color: var(--foreground);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Enhanced segmented filter inside toolbar */
.neu-toolbar .segmented-filter {
    background: color-mix(in srgb, var(--background) 80%, var(--border) 20%);
    border-color: color-mix(in srgb, var(--border) 55%, transparent);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.neu-toolbar .segmented-filter button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.neu-toolbar .segmented-filter button:hover:not(.active) {
    color: var(--foreground);
    background: color-mix(in srgb, var(--card) 50%, transparent);
}

.neu-toolbar .segmented-filter button.active {
    background: var(--card);
    color: var(--primary);
    font-weight: 600;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08),
        0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .neu-toolbar .segmented-filter {
    background: color-mix(in srgb, var(--background) 60%, var(--card) 40%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .neu-toolbar .segmented-filter button.active {
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

/* === Workspace Switch Transition === */
.workspace-transition-overlay {
    position: fixed;
    inset: 0;
    background: var(--background);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.workspace-transition-overlay.active {
    opacity: 1;
    visibility: visible;
}

.workspace-transition-overlay .workspace-logo {
    font-size: 24px;
    font-weight: 600;
    color: var(--foreground);
}

/* === AI Assistant Workspace Banner === */
.workspace-switch-banner {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.workspace-switch-banner .banner-icon {
    color: #3B82F6;
    flex-shrink: 0;
}

.workspace-switch-banner .banner-content {
    flex: 1;
}

.workspace-switch-banner .banner-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.workspace-switch-banner .banner-text {
    font-size: 13px;
    color: var(--foreground-secondary);
}

.workspace-switch-banner .banner-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--foreground-secondary);
    padding: 4px;
}

.workspace-switch-banner .banner-close:hover {
    color: var(--foreground);
}

/* === Dashboard Stats Yours Count === */
.stat-yours {
    font-size: 12px;
    color: var(--foreground-secondary);
    margin-top: 2px;
}


/* ============================================================
   CALENDAR
   ============================================================ */

.cal-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    overflow: hidden;
}

/* ---- Header ---- */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 16px;
    gap: 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.cal-header-left,
.cal-header-center,
.cal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-header-center {
    gap: 12px;
}

/* View toggle (Week | Month) */
.cal-view-toggle {
    display: flex;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.cal-view-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--foreground-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cal-view-btn.active {
    background: var(--card);
    color: var(--foreground);
    box-shadow: var(--shadow-xs);
}

.cal-view-btn:hover:not(.active) {
    color: var(--foreground);
}

/* Nav buttons */
.cal-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cal-nav-btn:hover {
    background: var(--secondary);
    border-color: var(--foreground-secondary);
}

.cal-date-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    min-width: 200px;
    text-align: center;
}

.cal-today-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cal-today-btn:hover {
    background: var(--secondary);
    border-color: var(--foreground-secondary);
}

/* Provider filter chips */
.cal-provider-filters {
    display: flex;
    gap: 6px;
}

.cal-provider-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);
    color: var(--foreground-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cal-provider-chip:hover:not(.disabled) {
    border-color: var(--foreground-secondary);
    color: var(--foreground);
}

.cal-provider-chip.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.cal-provider-chip.active.microsoft {
    background: rgba(98, 100, 167, 0.1);
    border-color: #6264A7;
    color: #6264A7;
}

.cal-provider-chip.active.google {
    background: rgba(0, 137, 123, 0.12);
    border-color: #00897B;
    color: #00897B;
}

.cal-provider-chip.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Loading skeleton ---- */
.cal-loading {
    flex: 1;
    overflow: hidden;
}

.cal-skeleton-week {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    height: 100%;
    gap: 0;
}

.cal-skeleton-time-col {
    display: flex;
    flex-direction: column;
}

.cal-skeleton-time-slot {
    height: 60px;
    border-bottom: 1px solid var(--border-light);
}

.cal-skeleton-day-col {
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.cal-skeleton-header-cell {
    height: 44px;
    border-bottom: 1px solid var(--border);
}

.cal-skeleton-cell {
    height: 60px;
    border-bottom: 1px solid var(--border-light);
    padding: 2px;
    position: relative;
}

.cal-skeleton-event {
    border-radius: 6px;
    background: linear-gradient(90deg, var(--secondary) 25%, var(--border-light) 50%, var(--secondary) 75%);
    background-size: 200% 100%;
    animation: calShimmer 1.5s ease-in-out infinite;
}

.cal-skeleton-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-light);
    flex: 1;
}

.cal-skeleton-month-cell {
    background: var(--card);
    min-height: 100px;
    padding: 8px;
}

.cal-skeleton-event-pill {
    height: 18px;
    border-radius: 4px;
    margin-bottom: 4px;
    background: linear-gradient(90deg, var(--secondary) 25%, var(--border-light) 50%, var(--secondary) 75%);
    background-size: 200% 100%;
    animation: calShimmer 1.5s ease-in-out infinite;
}

@keyframes calShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton lines for panel */
.cal-skeleton-line {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, var(--secondary) 25%, var(--border-light) 50%, var(--secondary) 75%);
    background-size: 200% 100%;
    animation: calShimmer 1.5s ease-in-out infinite;
}

/* ---- Empty / Error states ---- */
.cal-empty-state,
.cal-error-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 40px;
}

.cal-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
    margin-top: 8px;
}

.cal-empty-subtitle {
    font-size: 14px;
    color: var(--foreground-secondary);
    max-width: 320px;
}

/* ============== WEEK VIEW ============== */
.cal-week-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}

.cal-week-header {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    padding-right: 6px; /* compensate for grid scrollbar width */
}

.cal-time-gutter-header {
    border-right: 1px solid var(--border);
}

.cal-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    border-left: 1px solid var(--border-light);
    gap: 2px;
}

.cal-day-header.today {
    background: var(--primary-light);
}

.cal-day-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--foreground-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day-number {
    font-size: 20px;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1;
}

.cal-day-number.today-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
}

/* All-day row */
.cal-allday-row {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    padding-right: 6px; /* compensate for grid scrollbar width */
}

.cal-allday-label {
    font-size: 10px;
    color: var(--foreground-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
}

.cal-allday-cell {
    padding: 4px 2px;
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-allday-event {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s;
}

.cal-allday-event:hover {
    opacity: 0.85;
}

.cal-allday-event.provider-microsoft {
    background: rgba(98, 100, 167, 0.15);
    color: #6264A7;
}

.cal-allday-event.provider-google {
    background: rgba(0, 137, 123, 0.12);
    color: #00897B;
}

/* Time grid */
.cal-week-grid {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    flex: 1;
    overflow-y: scroll; /* always show scrollbar so columns align with header */
    overflow-x: hidden;
    position: relative;
}

/* Custom scrollbar */
.cal-week-grid::-webkit-scrollbar {
    width: 6px;
}

.cal-week-grid::-webkit-scrollbar-track {
    background: transparent;
}

.cal-week-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.cal-week-grid::-webkit-scrollbar-thumb:hover {
    background: var(--foreground-secondary);
}

.cal-time-gutter {
    border-right: 1px solid var(--border);
}

.cal-time-label {
    height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 0 8px;
    font-size: 11px;
    color: var(--foreground-secondary);
    transform: translateY(-7px);
    user-select: none;
}

.cal-day-column {
    position: relative;
    border-left: 1px solid var(--border-light);
}

.cal-day-column.today-col {
    background: var(--primary-light);
}

.cal-hour-cell {
    height: 60px;
    border-bottom: 1px solid var(--border-light);
}

/* Current time line */
.cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--danger);
    z-index: 5;
    pointer-events: none;
}

.cal-now-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    position: absolute;
    left: -4px;
    top: -3px;
}

/* Event blocks */
.cal-event-block {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    overflow: hidden;
    z-index: 3;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
    border-left: 3px solid;
    box-sizing: border-box;
}

.cal-event-block:hover {
    z-index: 10;
    box-shadow: var(--shadow-md);
    transform: scale(1.01);
}

.cal-event-block.provider-microsoft {
    background: rgba(98, 100, 167, 0.12);
    border-left-color: #6264A7;
    color: #4A4C8A;
}

.cal-event-block.provider-google {
    background: rgba(0, 137, 123, 0.10);
    border-left-color: #00897B;
    color: #00695C;
}

[data-theme="dark"] .cal-event-block.provider-microsoft {
    background: rgba(98, 100, 167, 0.2);
    color: #B8B9DB;
}

[data-theme="dark"] .cal-event-block.provider-google {
    background: rgba(0, 137, 123, 0.18);
    color: #80CBC4;
}

.cal-event-inner {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 0;
}

.cal-event-time {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-event-block .cal-event-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cal-event-badge {
    display: inline-flex;
    align-items: center;
    opacity: 0.7;
    margin-top: 2px;
}

.cal-event-provider-icon {
    position: absolute;
    bottom: 4px;
    right: 4px;
    opacity: 0.5;
}

.cal-event-provider-icon.microsoft { color: #6264A7; }
.cal-event-provider-icon.google { color: #00897B; }

/* ============== MONTH VIEW ============== */
.cal-month-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    overflow: hidden;
}

.cal-month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.cal-month-day-name {
    padding: 10px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--foreground-secondary);
}

.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
    border-top: 0;
}

.cal-month-cell {
    min-height: 90px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.15s ease;
}

.cal-month-cell:nth-child(7n) {
    border-right: none;
}

.cal-month-cell:hover {
    background: var(--secondary);
}

.cal-month-cell.other-month {
    opacity: 0.35;
}

.cal-month-cell.today-cell {
    background: var(--primary-light);
}

.cal-month-date {
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground);
    display: inline-block;
    margin-bottom: 4px;
}

.cal-month-date.today-date {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.cal-month-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-month-event-pill {
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-month-event-pill.provider-microsoft {
    background: rgba(98, 100, 167, 0.15);
    color: #6264A7;
}

.cal-month-event-pill.provider-google {
    background: rgba(0, 137, 123, 0.12);
    color: #00897B;
}

[data-theme="dark"] .cal-month-event-pill.provider-microsoft {
    background: rgba(98, 100, 167, 0.25);
    color: #B8B9DB;
}

[data-theme="dark"] .cal-month-event-pill.provider-google {
    background: rgba(0, 137, 123, 0.2);
    color: #80CBC4;
}

.cal-month-more {
    font-size: 11px;
    color: var(--foreground-secondary);
    padding: 1px 6px;
    font-weight: 500;
}

/* ============== SLIDE-IN PANEL ============== */
.cal-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    justify-content: flex-end;
}

[data-theme="dark"] .cal-panel-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* Panel transitions */
.cal-panel-enter { transition: all 0.3s ease-out; }
.cal-panel-enter-start { opacity: 0; }
.cal-panel-enter-start .cal-panel { transform: translateX(100%); }
.cal-panel-enter-end { opacity: 1; }
.cal-panel-enter-end .cal-panel { transform: translateX(0); }
.cal-panel-leave { transition: all 0.2s ease-in; }
.cal-panel-leave-start { opacity: 1; }
.cal-panel-leave-end { opacity: 0; }
.cal-panel-leave-end .cal-panel { transform: translateX(100%); }

.cal-panel {
    width: 75%;
    max-width: 960px;
    min-width: 420px;
    height: 100%;
    background: var(--card);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-out;
}

[data-theme="dark"] .cal-panel {
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

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

.cal-panel-back {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
}

.cal-panel-back:hover {
    color: var(--foreground);
}

.cal-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--foreground-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.cal-panel-close:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.cal-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
}

/* Panel scrollbar */
.cal-panel-body::-webkit-scrollbar {
    width: 6px;
}

.cal-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.cal-panel-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Provider badge */
.cal-panel-provider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cal-panel-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.cal-panel-provider-badge.microsoft {
    background: rgba(98, 100, 167, 0.1);
    color: #6264A7;
}

.cal-panel-provider-badge.google {
    background: rgba(0, 137, 123, 0.1);
    color: #00897B;
}

/* Meeting status */
.cal-panel-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.cal-panel-status.upcoming {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.cal-panel-status.in-progress {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.cal-panel-status.completed {
    background: var(--secondary);
    color: var(--foreground-secondary);
}

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

.cal-panel-status.in-progress .cal-status-dot {
    animation: calPulse 1.5s ease-in-out infinite;
}

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

.cal-panel-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.3;
    margin-bottom: 16px;
}

/* Meta info */
.cal-panel-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.cal-panel-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--foreground-secondary);
}

.cal-panel-meta-item svg {
    flex-shrink: 0;
    color: var(--foreground-secondary);
    opacity: 0.7;
}

/* Attendees */
.cal-panel-attendees {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.cal-panel-attendees-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 8px;
}

.cal-panel-attendees-header svg {
    opacity: 0.6;
}

.cal-panel-attendee-list {
    padding-left: 24px;
}

.cal-panel-organizer {
    font-size: 13px;
    color: var(--foreground-secondary);
}

/* Join button */
.cal-panel-join {
    margin-bottom: 20px;
}

.cal-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
}

.cal-join-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

/* Description */
.cal-panel-description {
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.cal-panel-description p {
    font-size: 14px;
    color: var(--foreground-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Tabs */
.cal-panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.cal-tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.cal-tab:hover {
    color: var(--foreground);
}

.cal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.cal-panel-tab-content {
    flex: 1;
    min-height: 400px;
}

.cal-tab-pane {
    animation: calFadeIn 0.2s ease;
}

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

.cal-tab-loading {
    padding: 8px 0;
}

.cal-tab-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    gap: 8px;
}

.cal-tab-empty p {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
}

.cal-tab-empty span {
    font-size: 13px;
    color: var(--foreground-secondary);
    max-width: 320px;
    line-height: 1.5;
}

/* Notes */
.cal-note-item {
    padding: 14px 16px;
    background: var(--secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 10px;
}

.cal-note-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 4px;
}

.cal-note-date {
    font-size: 12px;
    color: var(--foreground-secondary);
}

/* Transcript */
.cal-transcript-item {
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 10px;
}

.cal-transcript-meta {
    font-size: 12px;
    color: var(--foreground-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.cal-transcript-content {
    font-size: 14px;
    color: var(--foreground);
    line-height: 1.7;
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .cal-header {
        flex-direction: column;
        align-items: stretch;
    }

    .cal-header-center {
        justify-content: center;
    }

    .cal-header-right {
        justify-content: center;
    }

    .cal-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .cal-date-title {
        font-size: 14px;
        min-width: auto;
    }

    .cal-day-name {
        font-size: 10px;
    }

    .cal-day-number {
        font-size: 16px;
    }

    .cal-time-label {
        font-size: 10px;
        padding: 0 4px;
    }

    .cal-week-header,
    .cal-week-grid,
    .cal-allday-row {
        grid-template-columns: 40px repeat(7, 1fr);
    }

    .cal-event-block .cal-event-title {
        font-size: 11px;
    }

    .cal-event-time {
        font-size: 9px;
    }
}
