/* 驴火智能体 · 真实体验面板 */
.lh-agent-backdrop {
  display: none;
  position: fixed;
  z-index: 10060;
  inset: 0;
  background: rgba(50, 28, 12, 0.45);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lh-agent-backdrop.active {
  display: flex;
}

.lh-agent-panel {
  width: min(720px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: #fffdf9;
  border: 1px solid #f0dcbf;
  box-shadow: 0 24px 64px rgba(66, 37, 14, 0.28);
  overflow: hidden;
}

.lh-agent-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #a8330f, #d94a1e);
  color: #fff;
}
.lh-agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.lh-agent-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}
.lh-agent-head p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.85;
}
.lh-agent-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.lh-agent-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

.lh-agent-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

/* 输入区 */
.lh-agent-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.lh-agent-input-row textarea {
  flex: 1;
  min-height: 44px;
  resize: none;
  border: 1.5px solid #e3cbaa;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  box-sizing: border-box;
  outline: none;
}
.lh-agent-input-row textarea:focus {
  border-color: #d94a1e;
  box-shadow: 0 0 0 3px rgba(217, 74, 30, 0.12);
}
.lh-agent-send {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  padding: 0 22px;
  background: linear-gradient(135deg, #d94a1e, #f28b2f);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.lh-agent-send:disabled {
  background: #a38b70;
  cursor: not-allowed;
}

/* 快速需求模板 */
.lh-agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.lh-agent-chip {
  border: 1px solid #e3cbaa;
  border-radius: 999px;
  background: #fff8ee;
  color: #6f563e;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
}
.lh-agent-chip:hover {
  border-color: #d94a1e;
  color: #d94a1e;
}

/* 消息区 */
.lh-agent-msgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lh-agent-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.lh-agent-msg.bot .lh-agent-msg-avatar {
  background: linear-gradient(135deg, #d94a1e, #f28b2f);
  color: #fff;
}
.lh-agent-msg.user {
  flex-direction: row-reverse;
}
.lh-agent-msg.user .lh-agent-msg-avatar {
  background: #2f6d66;
  color: #fff;
}
.lh-agent-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.lh-agent-msg-bubble {
  max-width: 82%;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  background: #f7f0e4;
  color: #4b3929;
  word-break: break-word;
}
.lh-agent-msg.user .lh-agent-msg-bubble {
  background: linear-gradient(135deg, #2f6d66, #4c9188);
  color: #fff;
}
.lh-agent-msg-bubble b {
  color: #a8330f;
}
.lh-agent-msg.user .lh-agent-msg-bubble b {
  color: #ffe9c9;
}

/* 推理块 */
.lh-agent-reason {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 4px;
}
.lh-agent-reason-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #a8330f;
  letter-spacing: 0.5px;
}
.lh-agent-reason-step {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: #5a4632;
  line-height: 1.5;
}
.lh-agent-reason-step .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f28b2f;
  margin-top: 7px;
  flex-shrink: 0;
}

/* 方案表 */
.lh-agent-plan {
  border: 1px solid #e6cdab;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 6px;
}
.lh-agent-plan-row {
  display: grid;
  grid-template-columns: 56px 1fr 74px;
  gap: 8px;
  align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid #f3e6d4;
  font-size: 13px;
}
.lh-agent-plan-row:last-child {
  border-bottom: none;
}
.lh-agent-plan-row .k {
  color: #8b765d;
  font-weight: 700;
  text-align: right;
}
.lh-agent-plan-row .n {
  color: #4b3929;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lh-agent-plan-row .p {
  color: #a8330f;
  font-weight: 800;
  text-align: right;
}
.lh-agent-plan-total {
  background: #fff3e1;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #a8330f;
  text-align: right;
}

/* 兼容性提示 */
.lh-agent-issue {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
}
.lh-agent-issue.error {
  background: #fdeeea;
  color: #b02a1d;
  border: 1px solid #f5c9c0;
}
.lh-agent-issue.info {
  background: #fff8ed;
  color: #8a5a30;
  border: 1px solid #ecd9bd;
}

/* 顾问思路卡片 */
.lh-agent-advice {
  background: linear-gradient(135deg, #fff3e1, #ffe9d2);
  border: 1px solid #f0d7b4;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 4px 0 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #6f4a1f;
}
.lh-agent-advice b {
  color: #a8330f;
}

/* 秒回提示：本地规则引擎先出的方案，顾问正在复核 */
.lh-agent-provisional {
  background: linear-gradient(135deg, #e8f4ff, #d6e9ff);
  border: 1px solid #b8d8f7;
  border-radius: 12px;
  padding: 8px 13px;
  margin: 2px 0 8px;
  font-size: 12.5px;
  color: #1f5c96;
  animation: lhPulse 1.6s ease-in-out infinite;
}
@keyframes lhPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

/* 引擎标识条 */
.lh-agent-engine {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed #e6cdab;
  font-size: 11px;
  color: #a08a6d;
  text-align: right;
}

/* AI 响应慢时提示可先用本地方案 */
.lh-agent-slow-tip {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8f4ec;
  border: 1px dashed #e0cfae;
  border-radius: 8px;
  font-size: 12px;
  color: #96723f;
  line-height: 1.5;
}

.lh-agent-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.lh-agent-apply {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 11px 0;
  background: linear-gradient(135deg, #d94a1e, #f28b2f);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.lh-agent-apply:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(168, 51, 15, 0.26);
}
.lh-agent-more {
  border: 1.5px solid #dcc8ae;
  border-radius: 12px;
  padding: 0 18px;
  background: #fff;
  color: #6f563e;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.lh-agent-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.lh-agent-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d94a1e;
  animation: lhAgentBlink 1.2s infinite;
}
.lh-agent-typing span:nth-child(2) { animation-delay: 0.2s; }
.lh-agent-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lhAgentBlink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}
.lh-agent-foot {
  padding: 10px 20px;
  border-top: 1px solid #f3e6d4;
  font-size: 11.5px;
  color: #a08a6d;
  text-align: center;
  background: #fffdf6;
}

@media (max-width: 480px) {
  .lh-agent-plan-row {
    grid-template-columns: 46px 1fr 62px;
    font-size: 12px;
  }
  .lh-agent-msg-bubble {
    max-width: 88%;
  }
}

/* ══════════════════════════════════════════════
   移动端补丁：手机全屏面板 + 输入区可用 + 气泡不溢出 + 触控 ≥40px
   ══════════════════════════════════════════════ */
.lh-agent-body { min-height: 0; overflow-y: auto; }
.lh-agent-msg-bubble { max-width: min(82%, 100%); overflow-wrap: anywhere; }
.lh-agent-close { min-width: 40px; min-height: 40px; }
.lh-agent-chip { min-height: 36px; }
.lh-agent-apply, .lh-agent-more { min-height: 44px; }

@media (max-width: 640px) {
  .lh-agent-backdrop { padding: 0; }
  .lh-agent-panel { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }
  .lh-agent-input-row {
    position: sticky; bottom: 0;
    background: var(--lh-card, #fffdf9);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .lh-agent-input-row textarea { font-size: 16px; } /* iOS 聚焦不放大 */
  .lh-agent-send { min-height: 44px; min-width: 72px; }
  .lh-agent-msg-bubble { max-width: calc(100% - 40px); }
  .lh-agent-plan-row { grid-template-columns: 44px minmax(0, 1fr) 62px; }
}
