.agent-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px;
}

.agent-page .breadcrumb {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 16px;
}

.agent-page .breadcrumb a {
  color: #0066cc;
  text-decoration: none;
}

.agent-hero {
  margin-bottom: 20px;
}

.agent-hero h1 {
  font-size: 1.9rem;
  margin: 0 0 10px 0;
  color: #1a1a2e;
}

.agent-hero p {
  color: #555;
  font-size: 1.05rem;
  margin: 0;
}

.agent-content {
  color: #555;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ── Chat shell ── */
.agent-chat {
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  height: 60vh;
  min-height: 420px;
}

.agent-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.agent-chat__empty {
  margin: auto;
  text-align: center;
  color: #999;
  max-width: 340px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.agent-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.agent-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.agent-msg--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.agent-msg__bubble {
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.agent-msg--user .agent-msg__bubble {
  background: #0066cc;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.agent-msg--assistant .agent-msg__bubble {
  background: #fff;
  border: 1px solid #e6e6e6;
  color: #333;
  border-bottom-left-radius: 4px;
}

.agent-msg__bubble p {
  margin: 0 0 8px 0;
}

.agent-msg__bubble p:last-child {
  margin-bottom: 0;
}

.agent-msg__bubble ul,
.agent-msg__bubble ol {
  margin: 8px 0;
  padding-left: 22px;
}

.agent-msg__bubble li {
  margin: 4px 0;
}

.agent-msg__bubble code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

.agent-msg__bubble pre {
  background: #f0f0f0;
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.agent-msg__bubble pre code {
  background: transparent;
  padding: 0;
}

.agent-msg__bubble a {
  color: #0066cc;
}

.agent-msg--user .agent-msg__bubble a {
  color: #fff;
  text-decoration: underline;
}

/* ── Related products ── */
.agent-msg__products {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.agent-msg__products-title {
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
}

.agent-product {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  color: #333;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.agent-product:hover {
  border-color: #0066cc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.agent-product__title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-product__meta {
  flex-shrink: 0;
  text-align: right;
  font-size: 0.82rem;
  color: #666;
  white-space: nowrap;
}

.agent-product__rating {
  color: #f59e0b;
  font-weight: 600;
}

/* ── Typing indicator ── */
.agent-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.agent-typing span {
  width: 7px;
  height: 7px;
  background: #bbb;
  border-radius: 50%;
  animation: agent-blink 1.2s infinite ease-in-out;
}

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

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

@keyframes agent-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ── Form ── */
.agent-chat__form {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid #e0e0e0;
  background: #fff;
}

.agent-chat__input {
  flex: 1;
  resize: none;
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
}

.agent-chat__input:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

.agent-chat__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-chat__send {
  border: none;
  background: #0066cc;
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.agent-chat__send:hover {
  background: #0052a3;
}

.agent-chat__send:disabled {
  background: #9cb8d4;
  cursor: not-allowed;
}

.agent-chat__new {
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #555;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.agent-chat__new:hover {
  background: #f5f5f5;
}

@media (max-width: 600px) {
  .agent-page { padding: 14px; }
  .agent-chat { height: 70vh; min-height: 380px; }
  .agent-msg { max-width: 92%; }
}
