/* ============================================================
   本草智源AI · 设计系统
   移动端优先，桌面端居中为 520px 应用壳
   ============================================================ */
:root {
  --forest: #123c2c;
  --forest-2: #1b5a41;
  --forest-3: #2a7355;
  --jade: #1f7a55;
  --jade-2: #2e9e6b;
  --mint: #e8f5ee;
  --mint-2: #f4fbf7;
  --paper: #eef3ee;
  --card: #ffffff;
  --ink: #1c2a23;
  --ink-2: #34443b;
  --muted: #6b7a72;
  --muted-2: #8b9a92;
  --line: #e1eae4;
  --amber: #b86516;
  --amber-2: #d97706;
  --amber-bg: #fff5e8;
  --red: #b42318;
  --red-bg: #fef3f2;
  --blue: #1d4ed8;
  --blue-bg: #eff6ff;
  --shadow: 0 8px 24px rgba(18, 60, 44, 0.07);
  --shadow-sm: 0 2px 8px rgba(18, 60, 44, 0.05);
  --radius: 16px;
  --radius-sm: 11px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(46, 158, 107, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(18, 60, 44, 0.07), transparent 55%),
    var(--paper);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--jade); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  background: transparent;
}
@media (min-width: 560px) {
  body { padding: 18px 0 0; }
  .app-shell {
    min-height: calc(100dvh - 18px);
    border-radius: 26px 26px 0 0;
    box-shadow: 0 30px 80px rgba(18, 60, 44, 0.16);
    overflow: hidden;
    background: var(--paper);
  }
}
.view { padding-bottom: calc(86px + var(--safe-bottom)); animation: pageIn 0.28s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.container { padding: 15px 14px 0; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 28px; height: 28px; }
.ico-xl { width: 38px; height: 38px; }

/* ---------- 页头 ---------- */
.page-head {
  position: relative;
  overflow: hidden;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 18px 26px;
  color: #fff;
  background: linear-gradient(145deg, #0f3225 0%, #164a35 55%, #1f6649 100%);
  border-radius: 0 0 26px 26px;
}
.page-head::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -58px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(123, 201, 111, 0.32), transparent 62%);
  pointer-events: none;
}
.page-head::before {
  content: "";
  position: absolute;
  left: -30px;
  bottom: -70px;
  width: 160px;
  height: 160px;
  border-radius: 44% 56% 60% 40%;
  border: 1px solid rgba(255, 255, 255, 0.10);
  transform: rotate(18deg);
  pointer-events: none;
}
.page-head > * { position: relative; z-index: 1; }
.page-head h1 { font-size: 22px; line-height: 1.28; letter-spacing: -0.3px; font-weight: 800; }
.page-head .sub { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.72); }
.page-head .head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.page-head .head-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.page-head .head-actions { display: flex; gap: 8px; margin-top: 14px; }
.page-head .head-actions .btn { flex: 1; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 12px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 13px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.card-title h2 { font-size: 15.5px; font-weight: 800; letter-spacing: -0.15px; display: flex; align-items: center; gap: 7px; }
.card-title .hint { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.card-title .link-btn { border: 0; background: none; color: var(--jade); font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px; display: inline-flex; align-items: center; gap: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.48; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--jade), var(--jade-2)); color: #fff; box-shadow: 0 6px 16px rgba(31, 122, 85, 0.20); }
.btn-dark { background: var(--forest); color: #fff; }
.btn-amber { background: linear-gradient(135deg, #c2711b, #d98a2b); color: #fff; box-shadow: 0 6px 16px rgba(194, 113, 27, 0.18); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-soft { background: var(--mint); color: var(--forest); border-color: #d4eadf; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: #fecdca; }
.btn-sm { min-height: 34px; padding: 7px 10px; font-size: 12px; border-radius: 9px; }
.btn-xs { min-height: 28px; padding: 5px 8px; font-size: 11px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12.5px; font-weight: 750; color: var(--ink-2); }
.label .hint { font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid #d6e2da;
  border-radius: 11px;
  background: #fbfdfb;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--jade-2);
  box-shadow: 0 0 0 3px rgba(46, 158, 107, 0.12);
  background: #fff;
}
.textarea { min-height: 86px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #6b7a72 50%), linear-gradient(135deg, #6b7a72 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .field { margin-bottom: 0; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.checkline input { width: 16px; height: 16px; accent-color: var(--jade); }

/* ---------- 徽章 / 标签 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--jade);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
}
.chip-amber { background: var(--amber-bg); color: var(--amber); }
.chip-red { background: var(--red-bg); color: var(--red); }
.chip-blue { background: var(--blue-bg); color: var(--blue); }
.chip-gray { background: #f1f4f2; color: var(--muted); }
.chip-dark { background: var(--forest); color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot-live { box-shadow: 0 0 0 4px rgba(46, 158, 107, 0.14); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(46, 158, 107, 0.12); } 50% { box-shadow: 0 0 0 6px rgba(46, 158, 107, 0.05); } }

/* ---------- 工作台 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 17px;
  color: #fff;
  background: linear-gradient(135deg, #0f3225 0%, #184b36 52%, #2b7657 100%);
  box-shadow: 0 12px 28px rgba(18, 60, 44, 0.22);
  margin-bottom: 13px;
}
.hero::before {
  content: "";
  position: absolute;
  right: -36px;
  top: -42px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 201, 111, 0.26), transparent 65%);
}
.hero::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -44px;
  width: 110px;
  height: 110px;
  border-radius: 46% 54% 42% 58%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: rotate(-18deg);
}
.hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hero .eyebrow { font-size: 11px; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.62); font-weight: 700; }
.hero h2 { font-size: 23px; font-weight: 850; letter-spacing: -0.4px; margin: 5px 0 3px; }
.hero .meta { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.hero .plot-icon {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex: 0 0 auto;
}
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 15px; }
.hero-stat { background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.10); border-radius: 11px; padding: 8px 9px; }
.hero-stat b { display: block; font-size: 15px; font-weight: 800; }
.hero-stat span { font-size: 10px; color: rgba(255, 255, 255, 0.6); }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 13px; }
.quick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
}
.quick .q-ico { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--mint); color: var(--jade); flex: 0 0 auto; }
.quick b { display: block; font-size: 13.5px; font-weight: 800; }
.quick span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.quick.amber .q-ico { background: var(--amber-bg); color: var(--amber); }
.quick.blue .q-ico { background: var(--blue-bg); color: var(--blue); }
.quick.dark .q-ico { background: var(--forest); color: #fff; }
.quick.wide { grid-column: span 2; }

.weather-main { display: flex; align-items: center; gap: 12px; }
.weather-temp { font-size: 34px; font-weight: 850; letter-spacing: -1.5px; line-height: 1; }
.weather-temp small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.weather-desc { flex: 1; min-width: 0; }
.weather-desc b { font-size: 13.5px; }
.weather-desc p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.weather-days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 12px; }
.weather-day { background: var(--mint-2); border: 1px solid #e1eee7; border-radius: 10px; padding: 7px 6px; text-align: center; }
.weather-day b { display: block; font-size: 12px; }
.weather-day span { font-size: 10.5px; color: var(--muted); }
.advice { display: flex; gap: 8px; margin-top: 11px; padding: 10px; border-radius: 11px; background: var(--amber-bg); color: #7a430e; font-size: 11.5px; line-height: 1.5; }
.advice .ico { color: var(--amber); }
.advice.ok { background: var(--mint); color: var(--forest); }
.advice.ok .ico { color: var(--jade); }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border-radius: 11px;
  background: var(--mint-2);
  border: 1px solid #e1eee7;
  cursor: pointer;
}
.task input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--jade); flex: 0 0 auto; }
.task.done { opacity: 0.55; }
.task.done span { text-decoration: line-through; }
.task span { font-size: 12.5px; line-height: 1.45; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.list-item:first-child { padding-top: 0; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, #dff1e6, #c8e6d3);
  color: var(--forest);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
  font-size: 15px;
  flex: 0 0 auto;
  overflow: hidden;
}
.thumb.amber { background: linear-gradient(145deg, #fff0d9, #f7d6a8); color: #8a4b0f; }
.thumb.blue { background: linear-gradient(145deg, #e3edff, #c7d7fe); color: #1e3a8a; }
.thumb.dark { background: linear-gradient(145deg, #1b5a41, #123c2c); color: #fff; }
.list-main { flex: 1; min-width: 0; }
.list-main h3 { font-size: 13.5px; font-weight: 800; line-height: 1.35; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-main p { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 3px; }
.list-side { flex: 0 0 auto; text-align: right; font-size: 10.5px; color: var(--muted); }
.list-side b { display: block; font-size: 13px; color: var(--ink); }

/* ---------- 步骤 ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 13px; }
.step { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; background: #eaf0eb; color: var(--muted); font-size: 11px; font-weight: 700; }
.step b { display: inline-flex; width: 17px; height: 17px; align-items: center; justify-content: center; border-radius: 50%; background: #d8e2db; color: #5f6f66; font-size: 10px; margin-right: 3px; }
.step.active { background: var(--forest); color: #fff; }
.step.active b { background: rgba(255, 255, 255, 0.2); color: #fff; }
.step.done { background: var(--mint); color: var(--jade); }
.step.done b { background: var(--jade); color: #fff; }

/* ---------- 称重面板 ---------- */
.scale-panel {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 16px;
  color: #fff;
  background: linear-gradient(150deg, #0c2a1e 0%, #164a35 58%, #216b4d 100%);
  box-shadow: 0 12px 28px rgba(18, 60, 44, 0.22);
  margin-bottom: 12px;
}
.scale-panel::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 201, 111, 0.22), transparent 66%);
}
.scale-panel > * { position: relative; z-index: 1; }
.scale-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scale-head .tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: rgba(255, 255, 255, 0.72); }
.scale-head .tag b { color: #fff; font-weight: 800; }
.scale-reading { display: flex; align-items: baseline; gap: 7px; margin: 9px 0 2px; }
.scale-value { font-size: 42px; font-weight: 850; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; }
.scale-unit { font-size: 15px; color: rgba(255, 255, 255, 0.62); font-weight: 700; }
.scale-sub { display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(255, 255, 255, 0.62); min-height: 17px; }
.scale-sub .stable { color: #b9f0c8; font-weight: 800; }
.scale-sub .unstable { color: #ffd39b; font-weight: 800; }
.scale-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-top: 12px; }
.scale-actions .btn { min-height: 38px; padding: 8px 6px; font-size: 11.5px; border-radius: 9px; background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; }
.scale-actions .btn:active { background: rgba(255, 255, 255, 0.18); }
.scale-actions .btn.capture { background: #e8f5ee; color: var(--forest); border-color: #e8f5ee; }
.scale-foot { margin-top: 9px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 10px; color: rgba(255, 255, 255, 0.5); }
.source-badge { padding: 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-size: 10px; font-weight: 700; }
.source-badge.demo { background: rgba(217, 119, 6, 0.28); color: #ffe0b2; }

/* ---------- 结果 / 识别 ---------- */
.dropzone {
  position: relative;
  border: 2px dashed #b9d7c7;
  border-radius: 18px;
  padding: 25px 16px;
  text-align: center;
  background: linear-gradient(180deg, #f8fcf9, #eef8f2);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone:active { background: #e8f5ee; border-color: var(--jade-2); }
.dropzone .dz-icon { width: 54px; height: 54px; border-radius: 18px; background: var(--mint); color: var(--jade); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.dropzone b { display: block; font-size: 15px; font-weight: 850; }
.dropzone p { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.dropzone .dz-tags { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }
.preview-item { position: relative; border-radius: 10px; overflow: hidden; background: #e8f0eb; aspect-ratio: 1 / 1; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.preview-item .pv-organ { position: absolute; left: 4px; bottom: 4px; padding: 2px 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 9px; }
.result-hero {
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(145deg, #eef8f2, #ffffff);
  border: 1px solid #d8eadf;
  margin-bottom: 12px;
}
.result-media {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #e8f0eb;
  margin-bottom: 12px;
  cursor: pointer;
}
.result-media img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
}
.result-media-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}
.result-full-img { width: 100%; border-radius: 14px; background: #eef3ee; }
.result-media-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  margin-bottom: 12px;
}
.result-media-main {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #e8f0eb;
  min-height: 190px;
  cursor: pointer;
}
.result-media-main img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}
.result-media-ref {
  border-radius: 12px;
  overflow: hidden;
  background: #e8f0eb;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.result-media-ref img {
  width: 100%;
  height: 148px;
  object-fit: cover;
  display: block;
  flex: 1;
}
.result-media-ref span {
  display: block;
  padding: 4px 3px;
  background: #fff;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
}
.result-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.result-name { font-size: 23px; font-weight: 850; letter-spacing: -0.4px; }
.result-sci { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 2px; }
.confidence-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.confidence { flex: 1; height: 8px; border-radius: 999px; background: #e3eee7; overflow: hidden; }
.confidence > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2e9e6b, #7bc96f); transition: width 0.5s ease; }
.confidence-num { font-size: 12px; font-weight: 850; color: var(--jade); min-width: 42px; text-align: right; }
.candidate { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.candidate:last-child { border-bottom: 0; }
.candidate .rank { width: 20px; height: 20px; border-radius: 50%; background: #eef3ef; color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; flex: 0 0 auto; }
.candidate:first-child .rank { background: var(--forest); color: #fff; }
.candidate .c-main { flex: 1; min-width: 0; }
.candidate .c-main b { font-size: 13px; display: block; }
.candidate .c-main span { font-size: 10.5px; color: var(--muted); }
.candidate .c-score { font-size: 12px; font-weight: 800; color: var(--jade); }
.candidate.selected { background: var(--mint-2); border-radius: 9px; padding-left: 6px; padding-right: 6px; }

/* ---------- 聊天 ---------- */
.chat-box { display: flex; flex-direction: column; gap: 9px; max-height: 46vh; overflow-y: auto; padding: 4px 2px 8px; }
.bubble { max-width: 88%; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--jade), var(--jade-2)); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--mint-2); border: 1px solid #dcebe2; border-bottom-left-radius: 4px; }
.bubble .b-meta { display: block; margin-top: 5px; font-size: 9.5px; opacity: 0.6; }
.chat-suggest { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.chat-suggest button { border: 1px solid #d6e6dc; background: #fff; color: var(--jade); border-radius: 999px; padding: 6px 9px; font-size: 11px; cursor: pointer; }
.chat-input-row { display: flex; gap: 8px; margin-top: 3px; }
.chat-input-row .input { flex: 1; border-radius: 999px; }
.chat-input-row .btn { width: 70px; border-radius: 999px; }

/* ---------- 表格 / 计算 ---------- */
.calc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.calc-table td { padding: 7px 0; border-bottom: 1px dashed var(--line); color: var(--ink-2); }
.calc-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.calc-table tr.total td { border-bottom: 0; padding-top: 11px; font-size: 15px; font-weight: 850; color: var(--forest); }
.calc-table tr.total td:last-child { color: var(--amber); font-size: 20px; }
.calc-note { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-top: 8px; }

/* ---------- 空状态 / 提示 ---------- */
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.empty .ico { width: 34px; height: 34px; color: #a9c4b5; margin: 0 auto 8px; }
.empty b { display: block; color: var(--ink-2); font-size: 13.5px; margin-bottom: 4px; }
.empty p { font-size: 11.5px; line-height: 1.55; }
.banner { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; border-radius: 11px; font-size: 11.5px; line-height: 1.55; margin-bottom: 12px; }
.banner .ico { margin-top: 1px; }
.banner.warn { background: var(--amber-bg); color: #7a430e; border: 1px solid #f3d6b1; }
.banner.warn .ico { color: var(--amber); }
.banner.info { background: var(--blue-bg); color: #1e3a8a; border: 1px solid #c7d7fe; }
.banner.info .ico { color: var(--blue); }
.banner.green { background: var(--mint); color: var(--forest); border: 1px solid #cbe6d6; }
.banner.green .ico { color: var(--jade); }
.banner.red { background: var(--red-bg); color: #7a271a; border: 1px solid #fecdca; }
.banner.red .ico { color: var(--red); }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.stat { background: var(--mint-2); border: 1px solid #e1eee7; border-radius: 11px; padding: 9px 7px; text-align: center; }
.stat b { display: block; font-size: 16px; font-weight: 850; color: var(--forest); font-variant-numeric: tabular-nums; }
.stat span { font-size: 10px; color: var(--muted); }
.sensor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sensor { background: var(--mint-2); border: 1px solid #e1eee7; border-radius: 11px; padding: 10px; }
.sensor .s-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 10.5px; }
.sensor b { display: block; font-size: 19px; font-weight: 850; color: var(--forest); margin-top: 4px; font-variant-numeric: tabular-nums; }
.sensor b small { font-size: 10px; font-weight: 600; color: var(--muted); }
.sensor .s-bar { height: 4px; border-radius: 999px; background: #dfeae3; margin-top: 7px; overflow: hidden; }
.sensor .s-bar i { display: block; height: 100%; border-radius: 999px; background: var(--jade-2); }

/* ---------- 外链 ---------- */
.link-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); color: inherit; text-decoration: none; }
.link-item:last-child { border-bottom: 0; }
.link-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--mint); color: var(--jade); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.link-main { flex: 1; min-width: 0; }
.link-main b { display: block; font-size: 12.5px; font-weight: 800; }
.link-main span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.link-item > .ico { color: #a7b9af; }

/* ---------- 标签栏 ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 900;
  display: flex;
  align-items: stretch;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tab {
  position: relative;
  flex: 1;
  border: 0;
  background: transparent;
  color: #8a9a91;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.tab .ico { width: 22px; height: 22px; }
.tab.active { color: var(--jade); }
.tab.active::before { content: ""; position: absolute; top: 5px; width: 16px; height: 3px; border-radius: 999px; background: var(--jade); opacity: 0.9; }
.tab.active .ico { stroke-width: 2.2; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 14px;
  z-index: 3000;
  transform: translate(-50%, -140%);
  max-width: calc(100vw - 32px);
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(18, 60, 44, 0.96);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(18, 60, 44, 0.25);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { background: rgba(180, 35, 24, 0.96); }

/* ---------- 弹层 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 28, 20, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.18);
  animation: sheetIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
@media (min-width: 560px) {
  .modal-overlay { align-items: center; padding: 18px; }
  .modal { border-radius: 22px; max-height: 86dvh; }
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { font-size: 18px; font-weight: 850; letter-spacing: -0.2px; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.modal-close { border: 0; background: #f1f4f2; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto; }
.modal-body { font-size: 13px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 40%; }

/* ---------- 收据 ---------- */
.receipt { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.receipt-head { text-align: center; padding-bottom: 11px; border-bottom: 1px dashed #cfdcd3; margin-bottom: 10px; }
.receipt-head b { display: block; font-size: 16px; letter-spacing: 0.06em; color: var(--forest); }
.receipt-head span { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.receipt-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12px; }
.receipt-row span:first-child { color: var(--muted); }
.receipt-row span:last-child { text-align: right; font-weight: 650; }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #e5ece7; }
.receipt-total span { font-size: 12px; color: var(--muted); }
.receipt-total b { font-size: 24px; color: var(--amber); font-weight: 850; letter-spacing: -0.5px; }
.receipt-qr { text-align: center; margin-top: 12px; padding-top: 11px; border-top: 1px dashed #cfdcd3; }
.receipt-qr img { width: 116px; height: 116px; margin: 0 auto 5px; border-radius: 8px; background: #fff; }
.receipt-qr p { font-size: 9.5px; color: var(--muted); line-height: 1.5; }
.receipt-foot { margin-top: 10px; font-size: 9px; color: var(--muted-2); line-height: 1.5; text-align: center; }

/* ---------- 打印 ---------- */
#print-root { display: none; }
@media print {
  @page { size: A5 portrait; margin: 10mm; }
  body { background: #fff !important; padding: 0 !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .receipt { border: 0; padding: 0; }
  #print-root .receipt-qr img { width: 120px; height: 120px; }
  .no-print { display: none !important; }
}

/* ---------- 工具类 ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.xs { font-size: 10.5px; }
.bold { font-weight: 800; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.scroll-x { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.seg { display: flex; background: #eaf0eb; border-radius: 999px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 8px; font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.seg button.active { background: #fff; color: var(--forest); box-shadow: var(--shadow-sm); }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs-line button { border: 0; background: none; padding: 9px 8px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs-line button.active { color: var(--forest); border-bottom-color: var(--jade); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); flex: 0 0 auto; }
.kv span:last-child { text-align: right; font-weight: 650; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-2); flex: 0 0 auto; }
.status-pill { font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px; }
.status-pending { background: var(--amber-bg); color: var(--amber); }
.status-confirmed { background: var(--blue-bg); color: var(--blue); }
.status-paid { background: var(--mint); color: var(--jade); }
.status-cancelled { background: #f1f4f2; color: var(--muted); }

/* ---------- 补充组件 ---------- */
.sync-loading {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #d8e2db;
  border-top-color: var(--jade);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
  flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 850;
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

