/* 设计令牌见 /tokens.css（与 miniprogram/tokens.wxss 共享，改动须两端同步） */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(173, 135, 71, .10), transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(46, 109, 164, .07), transparent 45%),
    var(--paper-2);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.4; margin: 0; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
button { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.app {
  width: 100%;
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 0 1px rgba(43, 40, 37, .04);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 16px;
  background: rgba(245, 241, 232, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); min-width: 0; }
.seal {
  width: 27px; height: 27px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--serif); font-size: 15px; border-radius: 6px;
}
.brand strong { font-family: var(--serif); font-size: 17px; letter-spacing: .1em; white-space: nowrap; }
.brand .tagline {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.top-chip {
  margin-left: auto; flex: none;
  font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line); background: var(--card);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  font-family: inherit;
}
.top-chip.login-chip { color: var(--accent); border-color: #e2c2ba; background: var(--accent-soft); font-weight: 600; }

/* ---------- layout ---------- */
.screen { padding: 18px 16px 96px; animation: fade .2s ease; }
.screen.no-tabs { padding-bottom: 34px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-title { font-size: 21px; margin: 8px 0 3px; }
.sub { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin: 0 0 10px; }
.backrow { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.spacer { margin-left: auto; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(250, 246, 236, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; padding: 5px 0 4px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-radius: 9px;
}
.tabbar button .ic { font-family: var(--serif); font-size: 14px; letter-spacing: .08em; }
.tabbar button.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.icp-banner {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.6;
}
.icp-card { border: 1px dashed var(--line); background: var(--paper-2); }
.card h4 { font-size: 15px; margin: 0 0 6px; }
.card .hint { color: var(--muted); font-size: 12px; line-height: 1.65; }
.daily-card { border-left: 3px solid var(--accent); }
.hero { text-align: center; padding: 24px 0 6px; }
.hero .glyph { font-family: var(--serif); font-size: 34px; letter-spacing: .24em; text-indent: .24em; }
.hero .tagline { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.login-hero { padding: 34px 0 14px; }
.login-hero .glyph { font-size: 40px; }
.login-context {
  background: var(--accent-soft); border: 1px solid #e2c2ba; border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0; padding: 12px 14px; margin: 0 0 2px;
}
.login-context p { margin: 6px 0 4px; font-size: 13.5px; color: var(--ink); }
.login-context .hint { display: block; }
.footnote { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin: 14px 0 0; padding: 0 2px; }

/* ---------- 常见问题 ---------- */
.faq details { border-top: 1px dashed var(--line); padding: 8px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  cursor: pointer; list-style: none; font-size: 12.5px; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; flex: none; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.faq details[open] summary::after { content: "－"; }
.faq p { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); white-space: nowrap;
}
.badge.ai { background: var(--teal-soft); color: var(--teal); }
.badge.neutral { background: var(--paper-2); color: var(--ink); }
.badge.cinnabar { background: var(--accent-soft); color: var(--accent); }
.tag {
  display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--card);
}
.status-pill {
  display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink); border: 1px solid var(--line);
}
.trustbar {
  font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  line-height: 1.65; letter-spacing: .02em; margin: 4px 0 2px;
  word-break: break-all;
}

/* ---------- buttons ---------- */
.btn {
  font-size: 13px; padding: 8px 13px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #332f29; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 8px; }
.btn.ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn.small { font-size: 12px; padding: 5px 10px; border-radius: 8px; }
.btn.danger { color: var(--accent); border-color: #e2c2ba; background: var(--accent-soft); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block {
  display: block; width: 100%; font-size: 15px; font-weight: 600;
  padding: 13px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--ink); color: #fff;
}
.btn-block:active { transform: translateY(1px); }
.btn-block:disabled { background: #b9b1a4; cursor: not-allowed; }
.btn-outline {
  display: block; width: 100%; font-size: 13.5px; padding: 11px; border-radius: 12px;
  border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
}
.btn-outline:hover { background: var(--paper-2); }

/* ---------- forms ---------- */
.field { margin-bottom: 13px; }
.fl { display: block; font-size: 12px; color: var(--muted); margin: 0 0 5px 2px; }
input[type="date"], input[type="text"], input[type="time"], input[type="tel"], select {
  width: 100%; font: inherit; font-size: 14px;
  padding: 10px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.seg { display: flex; background: var(--paper-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; font: inherit; font-size: 13px; padding: 7px 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.checkline { display: flex; gap: 9px; align-items: flex-start; font-size: 12px; line-height: 1.65; color: var(--muted); cursor: pointer; }
.checkline input { margin-top: 3px; accent-color: var(--teal); width: 16px; height: 16px; flex: none; }
.checkline b { color: var(--ink); }
.advanced { margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 11px; }
.advanced summary { font-size: 12.5px; color: var(--muted); cursor: pointer; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "＋"; float: right; color: var(--muted); }
.advanced[open] summary::after { content: "－"; }
.err {
  font-size: 12px; color: var(--accent); background: var(--accent-soft);
  padding: 8px 10px; border-radius: 8px; margin-top: 8px;
}
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.mono { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* ---------- chart ---------- */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 6px; }
.pillar { background: var(--paper-2); border-radius: 9px; padding: 10px 4px; text-align: center; }
.pillar .gz { font-family: var(--serif); font-size: 18px; letter-spacing: .08em; }
.pillar .lbl { font-size: 10px; color: var(--muted); margin-top: 3px; }
.palaces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.palace { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px; font-size: 10.5px; color: var(--muted); min-height: 52px; }
.palace b { display: block; color: var(--ink); font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.insight { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.insight:last-child { border-bottom: 0; padding-bottom: 2px; }
.insight .n { font-family: var(--serif); font-size: 15px; color: var(--gold); flex: none; }
.insight p { margin: 0; font-size: 13px; line-height: 1.7; }
.chart-meta { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.mouth-line { font-size: 11.5px; color: var(--muted); margin: 3px 0 0; }

/* ---------- sku ---------- */
.sku-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; margin: 10px 0; color: var(--ink);
  box-shadow: var(--shadow); position: relative;
}
.sku-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sku-card .price { font-family: var(--serif); font-size: 19px; color: var(--accent); }
.sku-card .hint { margin-top: 2px; }
.sku-card .rec { position: absolute; top: -1px; right: 12px; }
.priceline { display: flex; align-items: baseline; gap: 6px; }
.price { font-family: var(--serif); font-size: 27px; color: var(--accent); }
.price small { font-size: 12px; color: var(--muted); font-family: var(--sans); }

/* ---------- loading / blocked ---------- */
.loading-wrap { padding-top: 52px; text-align: center; }
.blocked-ic {
  width: 52px; height: 52px; border-radius: 50%; margin: 22px auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-size: 24px;
}
.spinner {
  width: 38px; height: 38px; margin: 0 auto 18px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 3px; background: var(--paper-2); border-radius: 3px; overflow: hidden; margin: 18px 0; }
.progress i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.steps { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.step { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.step .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.step.on { color: var(--ink); }
.step.on .dot { background: var(--accent); }
.skeleton { height: 12px; background: var(--paper-2); border-radius: 6px; margin: 9px 0; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- report ---------- */
.report-head { margin-bottom: 4px; }
.rsec { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.rsec:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.rsec summary {
  cursor: pointer; list-style: none; font-family: var(--serif);
  font-size: 15px; padding: 4px 0; display: flex; justify-content: space-between; gap: 8px;
}
.rsec summary::-webkit-details-marker { display: none; }
.rsec summary::after { content: "＋"; color: var(--muted); font-family: var(--sans); font-size: 13px; }
.rsec[open] summary::after { content: "－"; }
.rsec .rbody { padding: 4px 0 2px; }
.rsec .rbody p { font-size: 14.5px; line-height: 1.9; color: var(--ink); margin: 0 0 14px; }
.ai-note { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); padding: 8px 0; }
.disclaimer {
  background: var(--paper-2); border-radius: 10px; padding: 11px 12px;
  font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-top: 14px;
}
.preview-cta { margin-top: 14px; text-align: center; }

/* ---------- archive / member / settings ---------- */
.profile-card { cursor: default; }
.profile-card .mini-pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 8px 0; }
.profile-card .mini-pillars span {
  text-align: center; font-family: var(--serif); font-size: 13px;
  background: var(--paper-2); border-radius: 6px; padding: 4px 0;
}
.report-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.report-chips button {
  font-size: 11.5px; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 4px 10px; cursor: pointer; color: var(--ink);
}
.empty { text-align: center; padding: 22px 12px; color: var(--muted); font-size: 13px; }
.empty .big { font-family: var(--serif); font-size: 26px; color: var(--line); margin-bottom: 6px; }
.benefit { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 9px 0; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.benefit:last-child { border-bottom: 0; }
.benefit b { color: var(--ink); font-weight: 600; }
.benefit > b { flex: none; text-align: right; }
.benefit-desc { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.6; }
.order-row { border-bottom: 1px dashed var(--line); padding: 9px 0; font-size: 12px; }
.order-row:last-child { border-bottom: 0; }
.order-row .oid { font-family: var(--mono); font-size: 10px; color: var(--muted); word-break: break-all; }
.switch-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.switch-line input { width: 18px; height: 18px; accent-color: var(--teal); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 5px 0; }
.kv span:last-child { color: var(--ink); text-align: right; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translate(-50%, 12px);
  max-width: 320px; width: calc(100% - 48px);
  background: var(--ink); color: #fff; font-size: 12.5px;
  padding: 10px 14px; border-radius: 10px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- share card / print ---------- */
.report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 4px; }
.qa-card { margin-top: 14px; }
.qa-item { padding: 10px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.qa-item:first-of-type { border-top: 0; padding-top: 4px; }
.qa-q { color: var(--ink); font-weight: 500; }
.qa-a { color: var(--muted); margin-top: 4px; line-height: 1.8; }
.qa-cursor {
  display: inline-block; width: .55em; text-align: center; margin-left: 1px;
  color: var(--teal); animation: qa-cursor-blink 1s steps(2) infinite;
}
@keyframes qa-cursor-blink { 50% { opacity: 0; } }
.qa-input {
  width: 100%; padding: 10px 12px; margin-top: 10px;
  border: 1px solid var(--line); border-radius: 10px; resize: vertical;
  background: var(--paper); font-family: inherit; font-size: 14px;
  line-height: 1.6; color: var(--ink); transition: border-color .15s;
}
.qa-input:focus { border-color: var(--teal); outline: none; }
.sheet-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(43, 40, 37, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.sheet {
  width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 16px; padding: 12px;
  box-shadow: var(--shadow);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-family: var(--serif); font-size: 15px; }
.sheet canvas { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sheet .hint { margin: 8px 2px 0; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; }
  .app {
    max-width: none; width: auto; min-height: 0;
    box-shadow: none; border: 0; border-radius: 0; background: #fff;
  }
  .topbar, .tabbar, .backrow, .report-actions, .ai-note, .preview-cta,
  .sheet-mask, .toast, .btn, .btn-block, .btn-outline { display: none !important; }
  .screen, .screen.no-tabs { padding: 0; }
  .card { box-shadow: none; border: 0; border-radius: 0; padding: 0; margin: 0 0 14px; background: #fff; }
  .rsec { border-top: 1px solid #ccc; margin-top: 10px; padding-top: 8px; break-inside: avoid; page-break-inside: avoid; }
  .rsec summary::after { display: none; }
  .rsec .rbody { display: block; }
  .rsec .rbody p { font-size: 11.5pt; line-height: 1.75; }
  .report-head { font-size: 20pt; }
  .trustbar { color: #555; }
  .disclaimer { background: #fff; border: 1px solid #ccc; }
  a { color: #000; text-decoration: none; }
  details, details > summary { display: block; list-style: none; }
}

@media (min-width: 720px) {
  body { padding: 24px 0; }
  .app { border-radius: 22px; overflow: hidden; min-height: calc(100vh - 48px); border: 1px solid rgba(43, 40, 37, .08); max-width: 680px; }
  .topbar { border-radius: 22px 22px 0 0; }
  .tabbar { bottom: 24px; border-radius: 0 0 22px 22px; }
}

/* PC / 大屏：左侧竖排导航 + 宽画布内容 */
@media (min-width: 1024px) {
  body { padding: 28px 0; }
  .app {
    max-width: 1080px;
    min-height: calc(100vh - 56px);
    border-radius: 22px;
    border: 1px solid rgba(43, 40, 37, .08);
    box-shadow: 0 26px 70px -48px rgba(43, 40, 37, .4);
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  .topbar { grid-column: 1 / -1; grid-row: 1; height: 64px; padding: 0 28px; }
  .brand strong { font-size: 19px; }
  .brand .tagline { font-size: 12px; }
  .tabbar {
    grid-column: 1; grid-row: 2;
    position: static; top: auto; left: auto; bottom: auto; transform: none;
    width: 100%; max-width: none;
    display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch;
    gap: 4px; padding: 18px 12px;
    background: var(--card);
    border: 0; border-right: 1px solid var(--line); border-radius: 0;
  }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; font-size: 13px; }
  .tabbar button .ic { font-size: 16px; }
  .screen { grid-column: 2; grid-row: 2; max-width: none; margin: 0; padding: 30px 34px 52px; }
  /* 无导航页面（登录、录入、确认、报告等）：不显示左侧导航，内容居中 */
  .app.no-tabs { grid-template-columns: minmax(0, 1fr); }
  .app.no-tabs .screen { grid-column: 1; max-width: 860px; width: 100%; margin: 0 auto; }
  /* 首页在 PC 上左右分栏 */
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
  .home-grid .hero { grid-column: 1 / -1; }
  .home-main, .home-side { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
