:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1d2b26;
  --muted: #6b7a72;
  --brand: #0f5e54;
  --brand-soft: #e4f1ee;
  --gold: #b8860b;
  --user: #0f5e54;
  --user-bg: #e4f1ee;
  --bot-bg: #ffffff;
  --border: #e2e6e1;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--brand); color: #fff;
  box-shadow: var(--shadow); flex: 0 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-weight: 800; font-size: 17px; letter-spacing: 1px; }
.sub { font-size: 12px; opacity: 0.85; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 8px; font-size: 18px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.3); }
.acct-chip {
  background: rgba(255,255,255,0.18); border: none; color: #fff;
  font-size: 12px; padding: 6px 10px; border-radius: 999px; cursor: pointer; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-chip.hidden { display: none; }

/* 账户条 */
.acct-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 16px; background: var(--brand-soft); color: var(--brand);
  font-size: 12px; border-bottom: 1px solid #cfe6e1; flex: 0 0 auto;
}
.acct-bar.hidden { display: none; }
.acct-bar .plan-tag {
  font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 11px;
}
.acct-bar .plan-free { background: #fff; color: var(--gold); border: 1px solid #e3c98a; }
.acct-bar .plan-pro { background: var(--brand); color: #fff; }
.acct-bar .logout { background: none; border: none; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: 12px; }

/* 状态条 */
.banner {
  background: #fff4e0; color: #8a5a00; font-size: 13px;
  padding: 8px 16px; border-bottom: 1px solid #f0d9a8;
}
.banner.hidden { display: none; }

/* 聊天区 */
.chat {
  flex: 1 1 auto; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; line-height: 1.6; font-size: 15px; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow); }
.msg.user { align-self: flex-end; background: var(--user-bg); color: var(--ink); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--bot-bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot strong { color: var(--brand); }
.msg.bot h1, .msg.bot h2, .msg.bot h3 { margin: 6px 0 4px; font-size: 15px; color: var(--brand); }
.msg.error { align-self: flex-start; background: #fdecec; color: #b00020; border: 1px solid #f5c2c2; }

.cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--brand); }
@keyframes blink { 0%,50%{opacity:1} 50.01%,100%{opacity:0} }

/* 六合一 */
.quickbar { flex: 0 0 auto; padding: 8px 12px 4px; background: var(--panel); border-top: 1px solid var(--border); }
.quick-title { font-size: 11px; color: var(--muted); margin: 2px 4px 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.chip {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; font-size: 13px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid #cfe6e1; cursor: pointer; white-space: nowrap;
}
.chip:active { transform: scale(0.96); }

/* 输入区 */
.composer {
  flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px;
  background: var(--panel); border-top: 1px solid var(--border); align-items: flex-end;
}
#input {
  flex: 1 1 auto; resize: none; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; line-height: 1.5; max-height: 120px; outline: none;
}
#input:focus { border-color: var(--brand); }
.send-btn {
  flex: 0 0 auto; background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.send-btn:disabled { opacity: 0.5; }
.send-btn:active { transform: scale(0.96); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-card { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.modal-card h3 { margin: 0 0 6px; color: var(--brand); }
.modal-card .hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.modal-card label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 12px; }
.modal-card input { width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.preset { flex: 1 1 auto; padding: 7px 4px; font-size: 12px; border: 1px solid var(--border); background: #f3f5f2; border-radius: 8px; cursor: pointer; color: var(--ink); }
.preset:active { background: var(--brand-soft); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; padding: 10px; border-radius: 10px; font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: #fff; }
.modal-actions .primary { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 登录卡片 */
.login-card { max-width: 360px; }
.login-card .block { width: 100%; margin-top: 4px; }
.login-err { color: #b00020; font-size: 13px; background: #fdecec; border: 1px solid #f5c2c2; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.login-err.hidden { display: none; }
.login-card .wx { color: var(--brand); font-weight: 700; }
.demo { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 12px 0 0; background: #f3f5f2; padding: 8px 10px; border-radius: 8px; }
.primary.block { background: var(--brand); color: #fff; border: none; padding: 11px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; }

/* 登录：通道切换 */
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-btn { flex: 1; padding: 9px; border: 1px solid var(--border); background: #f3f5f2; border-radius: 9px; font-size: 14px; cursor: pointer; color: var(--ink); }
.seg-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 套餐自选 */
.plan-pick { background: #f3f5f2; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.plan-pick-title { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
.plan-opt { display: flex !important; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 6px !important; color: var(--ink); }
.plan-opt input { width: auto !important; margin: 0 !important; }

/* 验证码行 */
.code-row { display: flex; gap: 8px; margin-bottom: 8px; }
.code-row input { flex: 1; }
.ghost { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 9px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.dev-tip { font-size: 12px; color: var(--gold); background: #fff8e8; border: 1px solid #f0d9a8; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; line-height: 1.5; }
.dev-tip.hidden { display: none; }

/* 升级按钮 */
.upgrade-btn { background: var(--gold); color: #fff; border: none; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.upgrade-btn:active { opacity: 0.85; }
