/* Ask Joy (test) page */
.aj-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.aj-chat {
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.aj-disclaimer {
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.aj-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
  max-height: 60vh;
  overflow-y: auto;
}

.aj-new-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 0;
  gap: 8px;
}
.aj-new-chat img { width: 72px; height: 72px; border-radius: 50%; }
.aj-greeting { font-size: 22px; font-weight: 700; color: #111827; }
.aj-subtitle { font-size: 16px; color: #6b7280; }

.aj-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.aj-chip {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #e0e7ff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.aj-chip:hover { background: #e0e7ff; }

.aj-row { display: flex; gap: 10px; align-items: flex-start; }
.aj-row.user { justify-content: flex-end; }
.aj-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }

.aj-bubble {
  max-width: 78%;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.aj-bubble.user { background: #0570EB; color: #fff; border-bottom-right-radius: 4px; }
.aj-bubble.joy { background: #f3f4f6; color: #111827; border-bottom-left-radius: 4px; }
.aj-bubble.pending { opacity: 0.6; }

.aj-typing { display: inline-flex; gap: 4px; align-items: center; }
.aj-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #9ca3af;
  animation: aj-blink 1.2s infinite ease-in-out both;
}
.aj-typing span:nth-child(2) { animation-delay: 0.2s; }
.aj-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aj-blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

.aj-details-toggle {
  margin-top: 6px;
  font-size: 12px;
  color: #2563eb;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.aj-details {
  margin-top: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #374151;
}
.aj-details h5 { margin: 10px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; }
.aj-details h5:first-child { margin-top: 0; }
.aj-details pre { white-space: pre-wrap; word-break: break-word; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px; margin: 4px 0 0; }
.aj-details .aj-err { color: #dc2626; }
.aj-details .aj-cited { color: #047857; font-weight: 600; }
.aj-details a { color: #2563eb; }

.aj-input-bar { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.aj-input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 44px;
  max-height: 160px;
}
.aj-icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid #d1d5db;
  background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.aj-icon-btn svg { width: 20px; height: 20px; stroke: #374151; fill: none; stroke-width: 2; }
.aj-icon-btn.send { background: #0570EB; border-color: #0570EB; }
.aj-icon-btn.send svg { stroke: #fff; }
.aj-icon-btn.recording { background: #fee2e2; border-color: #fca5a5; }
.aj-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ChatMarkdown */
.chat-md-link { color: #2563eb; text-decoration: underline; }
.chat-md-code { background: #e5e7eb; border-radius: 4px; padding: 1px 4px; font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; }
.chat-md-heading { margin: 8px 0 4px; font-weight: 700; }
.chat-md-li { display: flex; gap: 6px; margin: 2px 0; }
.chat-md-marker { flex-shrink: 0; }
.chat-md-gap { height: 8px; }
.aj-bubble.joy .chat-md-link { color: #1d4ed8; }
