/* ── AI 页面 ── */
.ai-page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 16px;
}
.ai-page-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 650; color: var(--ink);
}
.ai-page-title .ai-icon-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #ff8a65, #e87040);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(232,112,64,.25);
}
.ai-status {
  font-size: 10px; padding: 3px 10px; border-radius: 10px; font-weight: 550;
  letter-spacing: .02em;
}
.ai-status.ready { background: #e8f5e9; color: #2e7d32; }
.ai-status.unconfigured { background: #fff3e0; color: #e65100; }
.ai-gear-btn {
  width: 36px; height: 36px; border: 1px solid var(--hairline);
  background: #fff; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s;
}
.ai-gear-btn:hover { transform: rotate(30deg); }
.ai-gear-btn:active { background: #f5f3ee; }
.ai-clear-btn-header {
  background: none; border: none;
  font-size: 12px; color: var(--mute); cursor: pointer;
  font-family: inherit; padding: 6px 8px;
}

/* chat messages */
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 12px; min-height: 200px;
}
.ai-welcome {
  text-align: center; padding: 40px 16px 24px; line-height: 1.9;
}
.ai-welcome .ai-welcome-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #fff5f0, #ffe8dc);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.ai-welcome h3 {
  font-size: 17px; font-weight: 650; color: var(--ink); margin: 0 0 6px;
}
.ai-welcome p {
  font-size: 13px; color: var(--mute); margin: 0 0 18px;
}
.ai-welcome strong { color: var(--accent); }
/* quick chips */
.ai-quick-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 4px;
}
.ai-quick-chip {
  padding: 8px 14px; border: 1px solid var(--hairline);
  background: #fff; border-radius: 18px; font-size: 12px;
  color: var(--ink-light); cursor: pointer; font-family: inherit;
  transition: all .15s; white-space: nowrap;
}
.ai-quick-chip:active { background: var(--ink); color: #fff; border-color: var(--ink); }

.ai-msg {
  max-width: 85%; padding: 12px 15px; border-radius: 18px;
  font-size: 13px; line-height: 1.7; word-break: break-word;
  animation: aiMsgIn .25s ease;
  position: relative;
}
@keyframes aiMsgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ai-msg.user {
  align-self: flex-end; background: var(--ink); color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(30,30,42,.15);
}
.ai-msg.assistant {
  align-self: flex-start; background: #fff; color: var(--ink);
  border: 1px solid var(--hairline);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.ai-msg .ai-msg-label {
  font-size: 10px; color: var(--accent); font-weight: 650;
  margin-bottom: 5px; display: flex; align-items: center; gap: 5px;
  text-transform: uppercase; letter-spacing: .04em;
}
.ai-msg .ai-msg-label::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.ai-typing {
  align-self: flex-start; display: flex; gap: 4px; padding: 14px 16px;
  background: #fff; border-radius: 18px; border-bottom-left-radius: 6px;
  border: 1px solid var(--hairline); box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: #d0ccc6;
  animation: aiBounce 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aiBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-5px); opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-msg .ai-retry-btn {
  background: none; border: 1px solid var(--hairline); color: var(--accent);
  padding: 4px 10px; border-radius: 6px; font-size: 11px; cursor: pointer;
  font-family: inherit; margin-top: 6px;
}
.ai-chat-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 4px; border-top: 1px solid var(--hairline);
  margin-top: 12px;
}
.ai-chat-input-row input {
  flex: 1; border: 1.5px solid var(--hairline);
  border-radius: 24px; padding: 12px 18px; font-size: 14px;
  font-family: inherit; background: var(--bg); color: var(--ink);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.ai-chat-input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,112,64,.1);
}
.ai-chat-input-row input::placeholder { color: #c5c0b8; }
.ai-send-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 18px;
  cursor: pointer; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center;
  transition: transform .12s, box-shadow .12s;
  box-shadow: 0 2px 8px rgba(232,112,64,.3);
}
.ai-send-btn:active { transform: scale(.9); box-shadow: 0 1px 4px rgba(232,112,64,.2); }
.ai-send-btn:disabled {
  background: #d5d2cb; cursor: not-allowed; box-shadow: none;
}

/* ── 配置抽屉（左侧滑出）── */
.ai-drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 2000;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.ai-drawer-mask.open { opacity: 1; pointer-events: auto; }
.ai-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 78%; max-width: 340px;
  background: #fff; z-index: 2001;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: 2px 0 20px rgba(0,0,0,.15);
}
.ai-drawer.open { transform: translateX(0); }
.ai-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--hairline);
  font-size: 15px; font-weight: 600;
}
.ai-drawer-close {
  background: none; border: none; font-size: 24px; color: var(--mute);
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.ai-drawer-body {
  padding: 18px; overflow-y: auto; flex: 1;
}
.ai-drawer-label {
  display: block; font-size: 12px; font-weight: 550; color: var(--ink-light);
  margin-bottom: 6px; margin-top: 14px;
}
.ai-drawer-label:first-of-type { margin-top: 0; }
.ai-drawer-body input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hairline);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: var(--bg); color: var(--ink);
  box-sizing: border-box;
}
.ai-drawer-body input:focus { border-color: var(--accent); outline: none; }

/* provider presets */
.ai-preset-row {
  display: flex; gap: 6px;
}
.ai-preset-btn {
  flex: 1; padding: 9px 6px; border: 1px solid var(--hairline);
  background: #fff; border-radius: 8px; font-size: 12px;
  font-weight: 550; color: var(--ink-light); cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.ai-preset-btn.active {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.ai-test-btn {
  padding: 11px 16px; border: 1px solid var(--ink);
  background: #fff; border-radius: 8px; font-size: 13px;
  font-weight: 550; color: var(--ink); cursor: pointer;
  font-family: inherit; white-space: nowrap;
  transition: all .15s;
}
.ai-test-btn:active { background: #f5f3ee; }
.ai-test-btn.testing { opacity: .6; pointer-events: none; }
