


.ai-chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.ai-msg { display: flex; }
.ai-msg.ai-user { justify-content: flex-end; }
.ai-msg.ai-assistant { justify-content: flex-start; }
.ai-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}
.ai-user .ai-bubble {
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  border-bottom-right-radius: 4px;
}
.ai-assistant .ai-bubble {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-bubble p { margin: 0 0 6px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble ul { margin: 0 0 6px; padding-left: 18px; }
.ai-bubble li { margin: 2px 0; }
.ai-bubble h4 { margin: 8px 0 4px; font-size: 0.95rem; }
.ai-bubble code {
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.85em;
}
.ai-user .ai-bubble code { background: rgba(0, 0, 0, 0.1); }
.ai-br { height: 6px; }

.ai-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.ai-input textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}
.ai-input textarea:focus { outline: none; border-color: var(--accent); }
.ai-input button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.ai-input button:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-disclaimer {
  padding: 0 12px 10px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.ai-typing { display: flex; gap: 4px; align-items: center; padding: 14px 13px; }
.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: ai-blink 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }


.assistant-page { max-width: 860px; margin: 0 auto; padding: 32px 20px 80px; }
.assistant-intro { margin-bottom: 18px; }
.assistant-intro h1 { margin: 0 0 6px; font-size: 1.7rem; }
.assistant-chat {
  height: min(64vh, 640px);
  min-height: 380px;
  border-radius: 16px;
  overflow: hidden;
}
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.assistant-suggestions .chip {
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.assistant-suggestions .chip:hover { background: rgba(255, 255, 255, 0.12); }


.ai-panel {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 360px;
  max-width: calc(100% - 28px);
  height: min(560px, calc(100% - 130px));
  height: min(560px, calc(100dvh - 185px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: var(--glass-highlight), var(--shadow);
  z-index: 40;
  overflow: hidden;
}
.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}
.ai-panel-head .icon-btn { width: 28px; height: 28px; font-size: 0.85rem; }
.ai-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-panel .ai-chat { height: 100%; }

@media (max-width: 760px) {
  .ai-panel {
    width: calc(100% - 20px);
    right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    height: calc(100dvh - 150px);
    max-height: none;
    border-radius: 14px;
  }
  .assistant-chat { height: min(60dvh, 520px); min-height: 320px; }
}
