*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #f4a261;
  --orange-light: #fff7ed;
  --orange-dark: #e07040;
  --bg: #fdf6ec;
  --text: #3d2b1f;
  --bubble-ai-bg: #ffffff;
  --bubble-ai-border: #ede8e0;
  --radius: 16px;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: white;
  border-bottom: 1px solid var(--orange-light);
  flex-shrink: 0;
}
.header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--orange-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.header-name { font-weight: 600; font-size: 15px; }
.header-status { font-size: 12px; color: #aaa; }
.header-audio-btn {
  margin-left: auto;
  background: none; border: 1px solid var(--orange);
  color: var(--orange); padding: 5px 12px;
  border-radius: 20px; font-size: 12px; cursor: pointer;
  text-decoration: none;
}
.header-audio-btn:hover { background: var(--orange-light); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.msg.ai .msg-avatar { background: var(--orange-light); }
.msg.user .msg-avatar { background: #dbeafe; }

.bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px; line-height: 1.7;
}
.msg.ai .bubble {
  background: var(--bubble-ai-bg);
  border: 1px solid var(--bubble-ai-border);
  border-bottom-left-radius: 4px;
}
.msg.user .bubble {
  background: var(--orange);
  color: white;
  border-bottom-right-radius: 4px;
}

.typing-indicator {
  display: flex; gap: 4px; padding: 10px 14px;
  background: white; border: 1px solid var(--bubble-ai-border);
  border-radius: var(--radius); border-bottom-left-radius: 4px;
  max-width: 60px;
}
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ccc; animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.input-area {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid var(--orange-light);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.text-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fafafa;
}
.text-input:focus { border-color: var(--orange); background: white; }

.send-btn, .mic-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  transition: transform 0.1s;
}
.send-btn { background: var(--orange); color: white; }
.send-btn:hover { background: var(--orange-dark); }
.send-btn:active { transform: scale(0.9); }

.mic-btn { background: var(--orange-light); color: var(--orange); }
.mic-btn.recording { background: #fee2e2; color: #ef4444; animation: pulse 1s infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  body { font-size: 15px; }
  .header { padding: 12px 14px; }
  .header-name { font-size: 16px; }
  .messages { padding: 12px 12px 6px; gap: 10px; }
  .bubble { max-width: 85%; font-size: 15px; padding: 10px 13px; }
  .input-area { padding: 10px 12px; gap: 8px; }
  .text-input { font-size: 15px; padding: 10px 14px; }
  .send-btn, .mic-btn { width: 44px; height: 44px; font-size: 19px; }
  .dash-layout { flex-direction: column; height: auto; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e5e7eb; max-height: 220px; }
  .main-content { padding: 16px; }
}
