.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(124, 58, 237, 0.2);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

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

.btn--ghost:hover {
  background: var(--color-accent-lavender);
  color: var(--color-primary);
}

.btn--active {
  background: var(--color-primary-dim);
  color: var(--color-primary);
}

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

.btn--icon {
  padding: 6px;
  border-radius: var(--radius-sm);
}

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

.btn--xs {
  padding: 4px 8px;
  font-size: 11px;
}

.btn--send {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}

.empty-state--sm {
  padding: 24px 16px;
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  max-width: 320px;
  line-height: 1.6;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 420px;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast--visible {
  transform: translateX(0);
  opacity: 1;
}

.toast--hiding {
  transform: translateX(120%);
  opacity: 0;
}

.toast--success { border-left: 3px solid var(--color-success); }
.toast--error { border-left: 3px solid var(--color-error); }
.toast--warning { border-left: 3px solid var(--color-warning); }
.toast--info { border-left: 3px solid var(--color-info); }

.toast__icon { font-size: 16px; }
.toast__message { flex: 1; font-size: 13px; }
.toast__close { opacity: 0.5; font-size: 18px; padding: 0 4px; }
.toast__close:hover { opacity: 1; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal--large {
  width: 90vw;
  height: 85vh;
}

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

.modal__body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal__close {
  font-size: 24px;
}

.conversation-setup-modal__dialog {
  width: min(440px, 92vw);
}

.conversation-setup-modal__form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conversation-setup-modal__mode {
  width: 100%;
}

.mode-switch {
  display: flex;
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--color-border);
}

.mode-switch__btn {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}

.mode-switch__btn--active {
  background: var(--color-primary);
  color: #fff;
}

.mode-switch__btn:hover:not(.mode-switch__btn--active) {
  color: var(--color-text);
}

.conversation-setup-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.panel-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100%;
  background: var(--color-bg-elevated);
  border-left: 1px solid var(--color-border);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.panel-drawer--open {
  right: 0;
}

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

.panel-drawer__header h3 {
  font-size: 15px;
  font-weight: 600;
}

.panel-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.panel-drawer__tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
}

.panel-tab {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.panel-tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.panel-tab:hover {
  color: var(--color-primary);
}

.compare-prompt {
  padding: 12px 16px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-muted);
  font-style: italic;
  flex-shrink: 0;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  .btn {
    min-height: 40px;
    padding: 8px 14px;
  }

  .btn--icon {
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
  }

  .btn--xs {
    min-height: 32px;
    padding: 4px 8px;
  }

  .toast-container {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    align-items: stretch;
  }

  .toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .modal {
    width: calc(100vw - 24px);
    max-width: none;
    max-height: calc(100dvh - 24px - env(safe-area-inset-bottom, 0));
    border-radius: var(--radius-lg);
  }

  .panel-drawer {
    width: 100%;
    right: -100%;
  }

  .panel-drawer__header,
  .panel-drawer__body {
    padding-left: 14px;
    padding-right: 14px;
  }
}
