/* QI运AI · 顾客端
   设计基调：暖纸底 + 墨绿主色 + 宋体标题，克制、干净，避免 SaaS 模板感 */

:root {
  --ink: #1b221d;
  --ink-2: #3d453f;
  --sub: #77807a;
  --line: #e7e2d6;
  --bg: #f6f4ee;
  --card: #ffffff;
  --accent: #2c6b55;
  --accent-soft: #eaf2ee;
  --gold: #a8834a;
  --danger: #b23a2e;
  --amber: #a8721f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 34, 29, .04), 0 8px 24px -18px rgba(27, 34, 29, .35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

.serif { font-family: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif; }

/* 外壳：移动端满宽，桌面居中成 440 竖版 */
.shell {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}
@media (min-width: 720px) {
  body { background: #eeeae0; }
  .shell {
    min-height: calc(100vh - 48px);
    margin: 24px auto;
    border-radius: 22px;
    box-shadow: 0 24px 60px -30px rgba(27, 34, 29, .45);
    overflow: hidden;
  }
}

/* ---------- 登录 ---------- */
.auth {
  min-height: 100vh;
  padding: 64px 28px 40px;
  display: flex;
  flex-direction: column;
}
@media (min-width: 720px) { .auth { min-height: calc(100vh - 48px); padding-top: 56px; } }

.brand-mark {
  width: 56px; height: 56px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  display: grid; place-items: center;
  color: var(--accent);
  font-size: 28px;
  letter-spacing: 0;
  margin-bottom: 22px;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 4px;
  border: .5px solid rgba(44, 107, 85, .35);
  border-radius: 2px;
}

.brand-name { font-size: 30px; line-height: 1.2; letter-spacing: 1px; margin: 0 0 8px; }
.brand-sub { color: var(--sub); font-size: 13px; letter-spacing: .5px; margin: 0 0 36px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 7px; letter-spacing: .3px; }
.input, .select, .textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44, 107, 85, .1);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2377807a' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}

/* 农历三列选择 */
.lunar-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.lunar-row .select { padding-left: 10px; padding-right: 24px; background-position: right 8px center; text-align: center; }
.lunar-hint {
  margin-top: 8px; font-size: 12px; color: #8a8172; line-height: 1.7;
  background: #faf9f4; border-radius: 8px; padding: 7px 10px;
}
.lunar-hint .sep { color: #c2b9a4; margin: 0 2px; }
.lunar-hint .leap-tag {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px;
  background: #eef3eb; color: var(--accent); font-size: 11px;
}

.btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15.5px;
  letter-spacing: 1px;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.99); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(44, 107, 85, .3);
}
.btn-sm { height: 38px; font-size: 13.5px; border-radius: 9px; width: auto; padding: 0 18px; }

.auth-foot { margin-top: auto; padding-top: 28px; text-align: center; }
.link {
  background: none; border: 0; color: var(--accent);
  font-size: 13.5px; padding: 6px; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: rgba(44, 107, 85, .3);
}
.tip { font-size: 12px; color: var(--sub); text-align: center; line-height: 1.7; }
.demo-box {
  margin-top: 22px; padding: 12px 14px;
  border: 1px dashed var(--line); border-radius: 10px;
  font-size: 12px; color: var(--sub); line-height: 1.9;
}
.demo-box b { color: var(--ink-2); font-weight: 600; }

/* ---------- 通用页头 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  background: rgba(246, 244, 238, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(231, 226, 214, .7);
}
.topbar h1 { font-size: 17px; margin: 0; letter-spacing: .5px; font-weight: 600; }
.topbar .back {
  border: 0; background: none; padding: 4px 6px 4px 0;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink-2); font-size: 14px;
}
.credit {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; white-space: nowrap;
}
.credit b { font-size: 14px; font-weight: 600; }

.page { flex: 1; padding: 18px 18px 96px; }
.page.tight { padding-bottom: 24px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-hd {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-hd h2 { font-size: 17px; margin: 0; letter-spacing: .5px; font-weight: 600; }
.card-hd .meta { font-size: 12px; color: var(--sub); }

.eyebrow {
  font-size: 11.5px; letter-spacing: 2px; color: var(--gold);
  text-transform: uppercase; margin-bottom: 6px;
}

/* ---------- 列表 ---------- */
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left;
}
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { min-width: 0; }
.list-item .li-title { font-size: 15px; font-weight: 500; color: var(--ink); }
.list-item .li-sub { font-size: 12.5px; color: var(--sub); margin-top: 3px; }
.list-item .chev { color: #b9bdb7; flex: 0 0 auto; }

/* ---------- 档案卡 ---------- */
.arc {
  display: block; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 14px;
  margin-bottom: 12px; box-shadow: var(--shadow);
}
.arc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.arc-name { font-size: 16.5px; font-weight: 600; letter-spacing: .5px; }
.arc-date { font-size: 12.5px; color: var(--sub); }
.arc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 11.5px; color: var(--ink-2);
  background: #f3f1e9; border-radius: 6px;
  padding: 3px 8px;
}
.tag.on { background: var(--accent-soft); color: var(--accent); }

/* ---------- 状态 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.chip.pending { background: #fbf1de; color: var(--amber); }
.chip.done, .chip.answered { background: var(--accent-soft); color: var(--accent); }
.chip.failed, .chip.refunded { background: #fbeeec; color: var(--danger); }
.chip.claimed { background: #eef1fb; color: #3c4f9b; }
.chip.neutral { background: #f2f1ec; color: var(--sub); }

/* ---------- 板块 ---------- */
.sec { margin-bottom: 14px; }
.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; letter-spacing: 1px; margin: 0 0 10px;
}
.sec-title::before {
  content: ""; width: 3px; height: 15px; border-radius: 2px;
  background: var(--accent); flex: 0 0 auto;
}
.sec-sum { color: var(--ink-2); margin: 0 0 12px; }
.pts { margin: 0; padding: 0; list-style: none; }
.pts li {
  position: relative; padding-left: 16px; margin-bottom: 8px;
  color: var(--ink-2); font-size: 14.5px;
}
.pts li::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 5px; height: 5px; border-radius: 50%; background: #c9cdc6;
}
.subs { display: grid; gap: 10px; }
.sub { background: #faf9f4; border-radius: 10px; padding: 12px 14px; }
.sub .sub-label { font-size: 13px; color: var(--accent); letter-spacing: .5px; margin-bottom: 4px; }
.sub p { margin: 0; font-size: 14px; color: var(--ink-2); }

.seg {
  display: inline-flex; background: #f0eee6; border-radius: 8px; padding: 3px; gap: 2px;
  margin-bottom: 10px;
}
.seg button {
  border: 0; background: none; padding: 5px 13px; border-radius: 6px;
  font-size: 12.5px; color: var(--sub);
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(27,34,29,.08); }

.periods { display: grid; gap: 8px; }
.period {
  display: flex; gap: 10px; padding: 9px 0;
  border-bottom: 1px dashed var(--line); font-size: 14px;
}
.period:last-child { border-bottom: 0; }
.period .p-label { flex: 0 0 74px; color: var(--sub); font-size: 13px; padding-top: 1px; }
.period .p-text { color: var(--ink-2); }

/* ---------- 追问 ---------- */
.ask-box { margin-top: 4px; }
.ask-item { background: #faf9f4; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.ask-item .q { font-size: 13.5px; color: var(--ink); margin-bottom: 6px; }
.ask-item .q::before { content: "问 "; color: var(--gold); font-size: 12px; }
.ask-item .a { font-size: 14px; color: var(--ink-2); }
.ask-item .a::before { content: "答 "; color: var(--accent); font-size: 12px; }
.ask-input { display: flex; gap: 8px; }
.ask-input .input { flex: 1; }

/* 追问等待态 */
.ask-item.ask-wait { background: #f6f4ec; border: 1px dashed #e3dcc8; }
.ask-item.ask-wait .a { color: #8a8172; display: flex; align-items: center; gap: 6px; }
.ask-item.ask-wait .a::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid #cfc6b0; border-top-color: var(--accent);
  animation: askSpin .8s linear infinite;
}
.ask-item.ask-wait .ask-sec { font-size: 11.5px; color: #a79c86; margin-left: 2px; }
@keyframes askSpin { to { transform: rotate(360deg); } }

/* ---------- 提示条 ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fbf8ef; border: 1px solid #efe5cd;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 12.5px; color: #7a6437; line-height: 1.7;
}
.banner.warn { background: #fbeeec; border-color: #f0d6d2; color: #8a3a30; }
.banner b { font-weight: 600; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--sub); }
.empty .em-mark {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; color: #c3c7c0;
}
.empty p { margin: 0 0 4px; font-size: 14px; }
.empty .small { font-size: 12.5px; opacity: .8; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: sticky; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  border: 0; background: none; padding: 6px 0 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #9aa19b; font-size: 11px; letter-spacing: .3px;
}
.tabbar button.on { color: var(--accent); }
.tabbar svg { width: 21px; height: 21px; }

/* ---------- 表单行 ---------- */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.segmented { display: flex; gap: 8px; }
.segmented button {
  flex: 1; height: 42px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  color: var(--sub); font-size: 14px;
}
.segmented button.on {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}

/* ---------- 上传 ---------- */
.upload {
  border: 1px dashed #d8d2c4; border-radius: 10px;
  padding: 18px; text-align: center; color: var(--sub); font-size: 13px;
  background: #fcfbf7; position: relative; overflow: hidden;
}
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload .preview { max-width: 100%; max-height: 180px; border-radius: 8px; display: block; margin: 0 auto; }

/* ---------- 吐司 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 12px);
  background: rgba(27, 34, 29, .92); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: all .22s; z-index: 99;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(27, 34, 29, .4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 60;
}
.sheet {
  width: 100%; max-width: 440px; background: #fff;
  border-radius: 18px 18px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow: auto;
}
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .sheet-sub { font-size: 12.5px; color: var(--sub); margin-bottom: 18px; }

/* ---------- 生成中 ---------- */
.loading { text-align: center; padding: 56px 24px; }
.loading .ring {
  width: 46px; height: 46px; margin: 0 auto 20px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading h3 { font-size: 17px; margin: 0 0 6px; }
.loading p { color: var(--sub); font-size: 13px; margin: 0; }

.footnote {
  font-size: 11.5px; color: #9aa19b; line-height: 1.8;
  text-align: center; padding: 8px 4px 0;
}

.kv { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--sub); font-size: 13.5px; }
.kv .v { color: var(--ink); }

.points-hero {
  background: linear-gradient(135deg, #2c6b55 0%, #1f5040 100%);
  color: #fff; border-radius: var(--radius); padding: 22px;
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.points-hero::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}
.points-hero .ph-label { font-size: 12.5px; opacity: .8; letter-spacing: 1px; }
.points-hero .ph-num { font-size: 34px; font-weight: 600; line-height: 1.3; margin: 2px 0 2px; }
.points-hero .ph-num span { font-size: 14px; font-weight: 400; opacity: .85; margin-left: 6px; }
.points-hero .ph-note { font-size: 12px; opacity: .75; }

[hidden] { display: none !important; }