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

html, body {
  height: 100%;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
}

body {
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  height: 100dvh;
}

/* 顶栏 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #07c160;
  color: #fff;
}
.shop-name { font-size: 17px; font-weight: 500; display: block; }
.sub { font-size: 12px; opacity: .85; }
.icon-btn {
  border: none; background: rgba(255,255,255,.2); color: #fff;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* 安装引导横幅 */
.install-banner {
  display: flex; align-items: center; gap: 8px;
  background: #fff7e6; color: #874d00;
  padding: 8px 12px; font-size: 13px;
  border-bottom: 1px solid #ffe0a3;
}
.install-banner span { flex: 1; }
.install-banner button {
  border: none; border-radius: 6px; padding: 5px 12px;
  background: #07c160; color: #fff; font-size: 13px; cursor: pointer;
}
.banner-close { background: transparent !important; color: #874d00 !important; font-size: 18px !important; padding: 0 6px !important; }

/* 聊天区 */
.chat {
  flex: 1; overflow-y: auto;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { max-width: 82%; padding: 10px 13px; border-radius: 10px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: #95ec69; border-top-right-radius: 3px; }
.msg.assistant { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.msg.tool { align-self: center; background: transparent; color: #999; font-size: 12px; padding: 2px 8px; max-width: 95%; }
.msg.error { align-self: center; background: #fee; color: #c00; font-size: 13px; }

/* 写操作确认卡片 */
.confirm-card {
  align-self: stretch;
  background: #fff; border: 1px solid #f0c36d; border-radius: 10px;
  padding: 12px; font-size: 14px;
}
.confirm-card .cc-title { font-weight: 500; color: #874d00; margin-bottom: 6px; }
.confirm-card pre { background: #fafafa; border-radius: 6px; padding: 8px; font-size: 12px; overflow-x: auto; margin-bottom: 10px; }
.confirm-card .cc-actions { display: flex; gap: 10px; }
.confirm-card .cc-actions button { flex: 1; padding: 9px; border: none; border-radius: 8px; font-size: 15px; cursor: pointer; }
.cc-ok { background: #07c160; color: #fff; }
.cc-no { background: #eee; color: #333; }

/* 输入栏 */
.input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #f7f7f7; border-top: 1px solid #e5e5e5;
}
.input-bar .mic { background: #fff; color: #555; border: 1px solid #ddd; flex-shrink: 0; }
.input-bar .mic.recording { background: #07c160; color: #fff; border-color: #07c160; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
#input {
  flex: 1; border: 1px solid #ddd; border-radius: 8px;
  padding: 10px 12px; font-size: 15px; background: #fff; outline: none;
}
.send-btn {
  border: none; border-radius: 8px; padding: 10px 16px;
  background: #07c160; color: #fff; font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.send-btn:disabled { background: #aaa; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 14px 14px 0 0; padding: 20px;
  max-height: 80dvh; overflow-y: auto;
}
.modal-card h2 { font-size: 15px; font-weight: 500; margin: 14px 0 8px; }
.modal-card h2:first-child { margin-top: 0; }
.steps p { font-size: 14px; line-height: 1.8; color: #444; }
.primary-btn {
  width: 100%; margin-top: 18px; padding: 12px;
  border: none; border-radius: 10px; background: #07c160; color: #fff;
  font-size: 16px; cursor: pointer;
}
