.dave-ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483645;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.3);
  background: linear-gradient(135deg, rgba(26, 24, 18, 0.95), rgba(10, 10, 15, 0.98));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(201, 168, 76, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

.dave-ai-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.6), 0 0 30px rgba(201, 168, 76, 0.2);
}

.dave-ai-fab:active {
  transform: scale(0.96);
}

.dave-ai-fab-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}

.dave-ai-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 168, 76, 0.15);
  animation: dave-ai-pulse 3s ease-in-out infinite;
  pointer-events: none;
}

.dave-ai-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c9a84c;
  color: #0a0a0f;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.4);
  animation: dave-ai-badge-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.dave-ai-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 2147483644;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  border-radius: 16px;
  border: 1px solid rgba(201, 168, 76, 0.15);
  background: linear-gradient(160deg, rgba(18, 16, 12, 0.97), rgba(8, 8, 12, 0.99));
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 40px rgba(201, 168, 76, 0.05);
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  opacity: 0;
  transform: scale(0.92) translateY(16px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.dave-ai-panel.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.dave-ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  flex-shrink: 0;
}

.dave-ai-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.dave-ai-header-info {
  flex: 1;
  min-width: 0;
}

.dave-ai-header-name {
  font: 600 14px/1.3 system-ui, -apple-system, sans-serif;
  color: #f5f0e8;
  margin: 0;
  letter-spacing: 0.01em;
}

.dave-ai-header-status {
  font: 400 11px/1.3 system-ui, -apple-system, sans-serif;
  color: rgba(201, 168, 76, 0.7);
  margin: 1px 0 0;
}

.dave-ai-header-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 5px;
  vertical-align: middle;
  animation: dave-ai-status-pulse 2s ease-in-out infinite;
}

.dave-ai-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.dave-ai-header-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(245, 240, 232, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.dave-ai-header-btn:hover {
  background: rgba(201, 168, 76, 0.1);
  color: rgba(245, 240, 232, 0.8);
}

.dave-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.dave-ai-messages::-webkit-scrollbar {
  width: 4px;
}

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

.dave-ai-messages::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, 0.2);
  border-radius: 2px;
}

.dave-ai-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font: 400 13.5px/1.55 system-ui, -apple-system, sans-serif;
  animation: dave-ai-msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  word-wrap: break-word;
}

.dave-ai-msg-ai {
  align-self: flex-start;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.12);
  color: #e8e0d0;
  border-bottom-left-radius: 4px;
}

.dave-ai-msg-user {
  align-self: flex-end;
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.2);
  color: #f5f0e8;
  border-bottom-right-radius: 4px;
}

.dave-ai-msg-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(201, 168, 76, 0.5);
  margin-bottom: 4px;
}

.dave-ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  background: rgba(201, 168, 76, 0.06);
  border: 1px solid rgba(201, 168, 76, 0.08);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.dave-ai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.4);
  animation: dave-ai-typing-bounce 1.4s ease-in-out infinite;
}

.dave-ai-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dave-ai-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.dave-ai-error {
  align-self: center;
  font: 400 12px/1.4 system-ui, -apple-system, sans-serif;
  color: rgba(245, 240, 232, 0.4);
  text-align: center;
  padding: 8px 12px;
  background: rgba(255, 80, 80, 0.06);
  border: 1px solid rgba(255, 80, 80, 0.1);
  border-radius: 8px;
  max-width: 100%;
}

.dave-ai-suggestions {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.dave-ai-suggestion {
  font: 400 11.5px/1.3 system-ui, -apple-system, sans-serif;
  color: rgba(201, 168, 76, 0.7);
  background: rgba(201, 168, 76, 0.06);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.dave-ai-suggestion:hover {
  background: rgba(201, 168, 76, 0.12);
  color: rgba(201, 168, 76, 0.9);
  border-color: rgba(201, 168, 76, 0.2);
}

.dave-ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(201, 168, 76, 0.08);
  flex-shrink: 0;
}

.dave-ai-composer-field {
  flex: 1;
  background: rgba(201, 168, 76, 0.04);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  font: 400 13.5px/1.4 system-ui, -apple-system, sans-serif;
  color: #f5f0e8;
  resize: none;
  outline: none;
  min-height: 20px;
  max-height: 120px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dave-ai-composer-field::placeholder {
  color: rgba(245, 240, 232, 0.3);
}

.dave-ai-composer-field:focus {
  border-color: rgba(201, 168, 76, 0.3);
  background: rgba(201, 168, 76, 0.06);
}

.dave-ai-composer-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: rgba(201, 168, 76, 0.15);
  color: #c9a84c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}

.dave-ai-composer-send:hover {
  background: rgba(201, 168, 76, 0.25);
  transform: scale(1.05);
}

.dave-ai-composer-send:active {
  transform: scale(0.95);
}

.dave-ai-composer-send:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}

.dave-ai-composer-send svg {
  width: 16px;
  height: 16px;
}

@keyframes dave-ai-pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.2;
    transform: scale(1.12);
  }
}

@keyframes dave-ai-badge-in {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes dave-ai-status-pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@keyframes dave-ai-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dave-ai-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

@media (max-width: 480px) {
  .dave-ai-fab {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  .dave-ai-fab-img {
    width: 26px;
    height: 26px;
  }

  .dave-ai-panel {
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }
}
