:root {
  /* ===== 国风配色（取自设计稿 theme-preview.html :root） ===== */
  --paper: #f7f4ea;
  --paper-soft: #fbfaf4;
  --mist: #eaf3f1;
  --mist-2: #dfecea;
  --qing: #2f6f73;
  --qing-dark: #1f4e5a;
  --qing-soft: #d7e8e5;
  --ink: #223331;
  --ink-soft: #5f6f6d;
  --line: rgba(47, 111, 115, 0.2);
  --gold: #c8a96a;
  --gold-soft: rgba(200, 169, 106, 0.28);
  --cinnabar: #a85d4e;
  --shadow: 0 22px 70px rgba(22, 58, 62, 0.13);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  /* 旧变量名映射，保持兼容 */
  --bg: var(--paper);
  --panel: rgba(255, 253, 246, 0.9);
  --panel-solid: #fffdf6;
  --muted: var(--ink-soft);
  --soft: var(--mist);
  --blue: var(--qing);
  --blue-2: var(--qing-soft);
  --green: #2f8f6b;
  --danger: var(--cinnabar);
  --radius: var(--radius-lg);

  font-family: "Noto Serif SC", "Songti SC", SimSun, "Microsoft YaHei", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", SimSun, "Microsoft YaHei", serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(200, 169, 106, 0.16), transparent 26%),
    radial-gradient(circle at 84% 12%, rgba(47, 111, 115, 0.16), transparent 28%),
    linear-gradient(135deg, #f7f4ea 0%, #edf5f3 48%, #f8f5eb 100%);
  overflow: hidden;
}

/* 淡网格宣纸纹理（设计稿 body::before） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(47, 111, 115, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 111, 115, 0.03) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

/* 水墨晕染（设计稿 .ink-wash） */
.ink-wash {
  position: fixed;
  inset: auto -8vw 0 auto;
  width: 56vw;
  height: 42vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
  background:
    radial-gradient(ellipse at 45% 60%, rgba(31, 78, 90, 0.28), transparent 58%),
    radial-gradient(ellipse at 72% 58%, rgba(200, 169, 106, 0.22), transparent 52%);
  filter: blur(20px);
  transform: rotate(-8deg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== 印章 logo（设计稿 .seal）：青绿渐变 + 楷体 + 居中无字间距 ===== */
.seal {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff5e6;
  background: linear-gradient(145deg, var(--qing), var(--qing-dark));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 12px 22px rgba(31, 78, 90, 0.22);
  font-family: "KaiTi", "STKaiti", "Kaiti SC", "楷体", "DFKai-SB", serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  text-indent: 0;
  padding-bottom: 2px;
}

.seal-sm {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 16px;
}

/* ===== 侧栏 ===== */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  padding: 22px 14px;
  z-index: 2;
  background: rgba(251, 250, 244, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  min-width: 0;
}

.brand-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-title strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--qing-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title span {
  color: var(--ink-soft);
  font-size: 12px;
}

.nav-block,
.side-section {
  display: grid;
  gap: 8px;
}

.nav-item,
.history-item {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-md);
  color: var(--ink);
  background: transparent;
  padding: 12px 14px;
}

.nav-item {
  font-weight: 700;
}

.nav-item.active {
  background: rgba(47, 111, 115, 0.1);
  color: var(--qing-dark);
}

.icon {
  display: inline-block;
  width: 26px;
  color: var(--qing);
}

.side-label {
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 0 14px 4px;
}

.memory-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  color: var(--ink);
}

.memory-item strong {
  color: var(--qing-dark);
  font-size: 14px;
}

.memory-item span,
.memory-item em {
  font-style: normal;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
  word-break: break-all;
}

.memory-empty {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.history-item {
  color: var(--ink-soft);
  line-height: 1.35;
}

.history-item.selected {
  background: rgba(47, 111, 115, 0.1);
  color: var(--qing-dark);
}

.grow {
  flex: 1;
  align-content: start;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(234, 243, 241, 0.6);
  border: 1px solid var(--line);
}

.account-meta {
  min-width: 0;
}

.account-name {
  font-weight: 700;
  color: var(--qing-dark);
}

.account-plan {
  font-size: 12px;
  color: var(--ink-soft);
}

.account-version {
  font-size: 10.5px;
  color: var(--ink-soft);
  opacity: 0.75;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.settings {
  margin-left: auto;
  color: var(--qing);
}

/* ===== 主区 ===== */
.app {
  margin-left: 292px;
  height: 100vh;
  position: relative;
  overflow: auto;
  z-index: 1;
}

.menu-toggle {
  display: none;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--qing-dark);
  padding: 4px 10px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 58, 62, 0.38);
  z-index: 40;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 76px;
  padding: 18px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
    to bottom,
    rgba(247, 244, 234, 0.8),
    rgba(247, 244, 234, 0)
  );
  backdrop-filter: blur(12px);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(251, 250, 244, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(31, 78, 90, 0.06);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 14px;
}

.status-chip.word {
  color: var(--qing-dark);
}

.top-actions {
  display: flex;
  gap: 10px;
}

/* ===== 通用胶囊按钮（设计稿 .btn / .btn-primary / .btn-secondary） ===== */
.btn {
  border: 0;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--qing), var(--qing-dark));
  box-shadow: 0 15px 30px rgba(31, 78, 90, 0.22);
}

.btn-secondary {
  color: var(--qing-dark);
  background: rgba(251, 250, 244, 0.78);
  border: 1px solid var(--line);
}

/* ===== Hero：左文案 + 右表单（设计稿 .hero 两栏） ===== */
.hero {
  min-height: calc(100vh - 76px);
  padding: 18px 40px 110px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.hero-inner {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: 46px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(251, 250, 244, 0.86), rgba(234, 243, 241, 0.68)),
    radial-gradient(circle at 14% 16%, rgba(200, 169, 106, 0.16), transparent 30%);
  box-shadow: var(--shadow);
}

/* 角落大字"紫微"水印（设计稿 .hero-copy::after） */
.hero-copy::after {
  content: "紫微";
  position: absolute;
  right: -24px;
  bottom: -36px;
  font-size: 128px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(47, 111, 115, 0.06);
  writing-mode: vertical-rl;
  pointer-events: none;
}

.eyebrow,
.card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: var(--qing-dark);
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background: rgba(255, 252, 240, 0.66);
  font-size: 13px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(200, 169, 106, 0.14);
}

.hero h1 {
  margin: 26px 0 18px;
  max-width: 10em;
  color: var(--qing-dark);
  font-size: clamp(34px, 4.4vw, 60px);
  line-height: 1.08;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.title-line {
  display: block;
  white-space: nowrap;
}

.hero-lead {
  max-width: 650px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.9;
  margin: 0 0 30px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
}

.feature {
  padding: 16px;
  border: 1px solid rgba(47, 111, 115, 0.15);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.38);
}

.feature strong {
  display: block;
  margin-bottom: 7px;
  color: var(--qing-dark);
  font-size: 16px;
}

.feature span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

/* ===== 右侧工作台 + 宣纸卡片（设计稿 .workbench / .paper-card） ===== */
.workbench {
  display: grid;
  grid-template-rows: 1fr;
  gap: 16px;
  align-content: stretch;
}

.paper-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(255, 253, 246, 0.94), rgba(238, 247, 245, 0.84)),
    repeating-linear-gradient(0deg, rgba(47, 111, 115, 0.025), rgba(47, 111, 115, 0.025) 1px, transparent 1px, transparent 7px);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 0;
}

.card-head h2 {
  margin: 0;
  color: var(--qing-dark);
  font-size: 22px;
  letter-spacing: 0.06em;
}

.card-poem {
  margin: 0;
  color: var(--qing-dark);
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: 0.08em;
  text-align: right;
  white-space: nowrap;
  opacity: 0.85;
}

/* ===== 出生信息表单（设计稿 .form / .field-grid） ===== */
.birth-form {
  flex: 1;
  padding: 22px 24px 24px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.birth-form .birth-submit {
  margin-top: auto;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.birth-form input,
.birth-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(47, 111, 115, 0.22);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  font: inherit;
  outline: none;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.birth-form input:focus,
.birth-form select:focus {
  border-color: var(--qing);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 4px rgba(47, 111, 115, 0.1);
}

/* 日期/时间分段数字输入：固定分隔符 - 和 :，每格只敲数字。 */
.date-field {
  position: relative;
}

.seg-input {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(47, 111, 115, 0.22);
  border-radius: 14px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.55);
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.seg-input:focus-within {
  border-color: var(--qing);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 4px rgba(47, 111, 115, 0.1);
}

/* 覆盖 .birth-form input 的通用样式：分段数字框是无边框、透明、居中的小格。 */
.birth-form .seg-num {
  min-height: auto !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 6px 2px !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.birth-form .seg-num:focus {
  background: rgba(47, 111, 115, 0.08) !important;
  box-shadow: none !important;
}

.seg-num.seg-year {
  flex: 0 0 4.5em;
}

.seg-input .seg-num:not(.seg-year) {
  flex: 0 0 2.6em;
}

.seg-sep {
  color: var(--ink-soft);
  font-weight: 700;
  opacity: 0.7;
  user-select: none;
}

.seg-num.invalid {
  color: var(--cinnabar) !important;
  background: rgba(168, 93, 78, 0.1) !important;
}

/* 分段按钮（性别 / 历法）。app.js 用 .seg-btn[data-value] + .seg-btn.active 取值，
   类名保持不变，仅套设计稿 .segmented 外观。 */
.seg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(47, 111, 115, 0.16);
  border-radius: 16px;
  background: rgba(234, 243, 241, 0.55);
  min-height: 46px;
  align-items: center;
}

.seg-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px;
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.seg-btn.active {
  color: var(--qing-dark);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 16px rgba(31, 78, 90, 0.08);
  font-weight: 700;
}

.birth-submit {
  width: 100%;
  margin-top: 4px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.form-hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

/* ===== 聊天区 ===== */
.chat {
  max-width: 1060px;
  margin: 8px auto 130px;
  padding: 0 34px;
}

.message {
  display: flex;
  margin: 22px 0;
  animation: rise 0.55s ease both;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 760px;
  padding: 16px 19px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(31, 78, 90, 0.06);
  line-height: 1.85;
}

.user .bubble {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--qing), var(--qing-dark));
  border-color: transparent;
  border-bottom-right-radius: 6px;
}

.agent-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #fff5e6;
  display: grid;
  place-items: center;
  font-family: "KaiTi", "STKaiti", "Kaiti SC", "楷体", serif;
  background: linear-gradient(145deg, var(--qing), var(--qing-dark));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  font-weight: 700;
  letter-spacing: 0;
  margin-right: 12px;
}

.agent-stack {
  flex: 1;
  display: grid;
  gap: 16px;
}

.agent-bubble {
  max-width: 720px;
}

.agent .bubble {
  border-bottom-left-radius: 6px;
}

.pending-bubble {
  background: linear-gradient(180deg, rgba(255, 253, 246, 0.95), rgba(238, 247, 245, 0.85));
  border-color: var(--line);
}

.pending-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--qing-dark);
  font-weight: 700;
}

.pending-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pending-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--qing);
  display: block;
  animation: pendingBlink 1.2s infinite ease-in-out;
}

.pending-dots i:nth-child(2) {
  animation-delay: 0.18s;
}

.pending-dots i:nth-child(3) {
  animation-delay: 0.36s;
}

.pending-text {
  line-height: 1.6;
}

/* ===== 卡片：宣纸质感（workflow / data-card / response-card） ===== */
.workflow-card,
.data-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(255, 253, 246, 0.94), rgba(238, 247, 245, 0.84)),
    repeating-linear-gradient(0deg, rgba(47, 111, 115, 0.025), rgba(47, 111, 115, 0.025) 1px, transparent 1px, transparent 7px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.workflow-card {
  padding: 22px;
  animation: rise 0.65s 0.12s ease both;
}

.workflow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.workflow-header h2 {
  margin: 6px 0 0;
  font-size: 22px;
  color: var(--qing-dark);
  letter-spacing: 0.06em;
}

/* workflow-card 内的 card-kicker 不用胶囊框，回退为小标签字样 */
.workflow-header .card-kicker,
.data-card .card-kicker {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--qing-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.running {
  color: var(--qing-dark);
  background: rgba(47, 111, 115, 0.12);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 13px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 650;
}

.step span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(47, 111, 115, 0.12);
  color: var(--ink-soft);
  font-size: 13px;
}

.step.done,
.step.active {
  color: var(--qing-dark);
  background: rgba(47, 111, 115, 0.1);
}

.step.done span {
  color: #fffaf0;
  background: var(--qing);
}

.step.active span {
  color: #fffaf0;
  background: var(--gold);
}

.step.active {
  box-shadow: inset 0 0 0 1px rgba(47, 111, 115, 0.2);
}

.data-card {
  padding: 22px;
}

.tool-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 28px rgba(31, 78, 90, 0.06);
  animation: rise 0.45s ease both;
}

.response-card h2 {
  margin: 8px 0 10px;
  font-size: 20px;
  color: var(--qing-dark);
}

.response-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.9;
  word-break: break-all;
}

.bottom-composer {
  position: fixed;
  left: calc(292px + 50%);
  bottom: 24px;
  transform: translateX(-50%);
  width: min(880px, calc(100vw - 380px));
  min-height: 64px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: rgba(251, 250, 244, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.attach {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(234, 243, 241, 0.85);
  color: var(--qing-dark);
  border: 1px solid var(--line);
  font-size: 24px;
}

.bottom-composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  min-height: 34px;
  max-height: 160px;
  font-size: 16px;
}

textarea::placeholder,
input::placeholder {
  color: #9bafac;
}

/* send：胶囊青绿渐变（兼容 app.js setBusy 改文案的按钮） */
.send {
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  color: #fffaf0;
  background: linear-gradient(135deg, var(--qing), var(--qing-dark));
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 24px rgba(31, 78, 90, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(31, 78, 90, 0.26);
}

/* ===== 网页报告（app.js renderReport 渲染：.report-doc/.rp-* ）：书卷国风 ===== */
.report-doc {
  margin-top: 14px;
  padding: 46px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 253, 246, 0.98), rgba(250, 249, 241, 0.96)),
    repeating-linear-gradient(90deg, rgba(200, 169, 106, 0.025), rgba(200, 169, 106, 0.025) 1px, transparent 1px, transparent 9px);
  border: 1px solid rgba(47, 111, 115, 0.18);
  box-shadow: var(--shadow);
  color: #2c3d3a;
  line-height: 2;
}

.rp-head {
  text-align: center;
  border-bottom: 1px solid var(--gold-soft);
  padding-bottom: 18px;
  margin-bottom: 10px;
}

.rp-head h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--qing-dark);
  line-height: 1.25;
}

.rp-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

.rp-profile {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(47, 111, 115, 0.16);
  border-radius: 18px;
  background: rgba(234, 243, 241, 0.42);
  margin-top: 18px;
}

.rp-profile span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  color: var(--qing-dark);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.rp-section {
  margin-top: 30px;
}

.rp-section h3 {
  font-size: 21px;
  font-weight: 700;
  color: var(--qing-dark);
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gold-soft);
}

.rp-section p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 2;
  text-align: justify;
  color: #2c3d3a;
}

/* 第二块四主题小标题(【事业·学业】等):独立成行、加粗、石青色,与上一段留间距,
   让客户在手机上一眼扫到四个主题。app.js renderReport 把"· 【主题】正文"拆成
   .rp-theme(标题) + 普通 <p>(正文)两段。 */
.rp-section p.rp-theme {
  margin: 22px 0 6px;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--qing-dark);
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-align: left;
}

/* 注意：人工详批/联系方式章节由 renderReport 渲染成普通 .rp-section，
   没有专属 class/属性，CSS 无法只针对它做设计稿 .contact-box 的边框底色，
   也无法在不改 app.js 的前提下单独框选它(且若存在 closing，末章是"结语"而非本章)。
   因此这里让所有 .rp-section 保持统一书卷样式、联系方式内容清晰可读，
   并通过下面的 strong 高亮让微信号等关键信息醒目。
   如需还原设计稿那种独立边框联系框，需要 app.js 给该章加一个 class(由主控决定)。 */

/* 报告正文里出现的微信号/联系方式：加粗处用石青色更醒目 */
.rp-section p strong,
.rp-section strong {
  color: var(--qing-dark);
  font-weight: 700;
}

.rp-disclaimer {
  margin-top: 24px;
  padding: 16px 18px;
  border-left: 3px solid var(--gold);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 252, 240, 0.62);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.8;
}

/* 报告内若含表格，套书卷表格样式 */
.report-doc table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 115, 0.18);
  border-radius: 18px;
  margin: 18px 0 8px;
  font-size: 14px;
}

.report-doc th,
.report-doc td {
  padding: 14px 16px;
  vertical-align: top;
  border-bottom: 1px solid rgba(47, 111, 115, 0.12);
  line-height: 1.8;
  text-align: left;
}

.report-doc tr:last-child td {
  border-bottom: 0;
}

.report-doc th {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--qing), var(--qing-dark));
  letter-spacing: 0.08em;
  font-weight: 700;
}

@media print {
  /* 页面边距：给 A4 留出舒适白边 */
  @page {
    margin: 16mm 14mm;
  }

  /* 【关键修复·打印只出 1 页】旧做法用 visibility:hidden + .report-doc{position:absolute}
     把报告拉到左上角，但绝对定位元素在打印时不跨页分页，又被 .app(100vh+overflow:auto)
     裁成只剩第一页。改为：display:none 隐藏无关元素，报告祖先链全部释放成正常文档流，
     .report-doc 回到 position:static 自然分页。 */

  html,
  body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  /* 报告之外的界面元素一律不打印 */
  .sidebar,
  .sidebar-overlay,
  .topbar,
  .menu-toggle,
  .hero,
  .bottom-composer,
  .agent-avatar,
  .agent-bubble,
  .bubble,
  .tool-card,
  .workflow-card,
  .rp-actions {
    display: none !important;
  }

  /* 报告所在的祖先链：全部回到正常文档流、释放高度与裁剪，让报告能跨页 */
  .app,
  .chat,
  .message,
  .message.agent,
  .agent-stack {
    display: block !important;
    position: static !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    max-width: none !important;
    animation: none !important;
  }

  .report-doc {
    position: static !important;   /* 关键：不再 absolute，否则不分页、被裁成 1 页 */
    width: 100% !important;
    margin: 0 !important;
    padding: 0 6mm !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    /* 保留书卷国风的底色/边框，否则浏览器默认会抹成纯白 */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* 分页控制：章节标题不吊在页底、段落不被切成两页。
     注意：不对整章 .rp-section 用 break-inside:avoid——长章节(如逐年流年)
     会被整体顶到下一页留下大片空白；段落级避免切断即可兼顾可读性与省纸。 */
  .rp-section h3,
  .rp-head {
    break-after: avoid;
    page-break-after: avoid;
  }
  .rp-section p,
  .rp-disclaimer,
  .rp-contact,
  .rp-appendix {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ===== 动画 ===== */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pendingBlink {
  0%,
  80%,
  100% {
    transform: scale(0.72);
    opacity: 0.45;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== 中等屏：两栏 hero 收成一栏 ===== */
@media (max-width: 1100px) {
  .sidebar {
    width: 236px;
  }

  .app {
    margin-left: 236px;
  }

  .top-actions {
    display: none;
  }

  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: auto;
  }

  .bottom-composer {
    left: calc(236px + 50%);
    width: calc(100vw - 300px);
  }
}

/* ===== 手机端(≤768px)：侧栏化为抽屉，主区全宽 ===== */
@media (max-width: 768px) {
  .menu-toggle {
    display: inline-block;
  }

  .sidebar {
    width: 80vw;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 50;
    background: #fbfaf4;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .app {
    margin-left: 0;
  }

  /* 顶栏收起，汉堡按钮固定左上角最高层，保证可点 */
  .topbar {
    position: static;
    height: 0;
    padding: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
  }

  .menu-toggle {
    position: fixed;
    top: 8px;
    left: 10px;
    z-index: 60;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(251, 250, 244, 0.94);
    border: 1px solid var(--line);
    color: var(--qing-dark);
    box-shadow: 0 2px 8px rgba(31, 78, 90, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .top-actions {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 60px 16px 90px;
  }

  .hero-copy {
    padding: 26px 22px;
    border-radius: 22px;
  }

  .hero-copy::after {
    font-size: 88px;
    right: -12px;
    bottom: -18px;
  }

  .hero h1 {
    font-size: clamp(28px, 8vw, 40px);
  }

  .feature-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-poem {
    text-align: left;
  }

  .chat {
    padding: 56px 16px 0;
  }

  .bottom-composer {
    left: 50%;
    width: 92vw;
  }

  .report-doc {
    padding: 22px 16px;
    border-radius: 22px;
  }

  /* 手机端：分段数字框放大，方便点选与键入。 */
  .birth-form input,
  .birth-form select {
    font-size: 17px;
    padding: 14px;
    min-height: 50px;
  }

  .seg-input {
    min-height: 50px;
  }

  .birth-form .seg-num {
    font-size: 17px !important;
    padding: 8px 2px !important;
  }

  /* 关闭毛玻璃（微信内置浏览器会糊成马赛克） */
  .paper-card,
  .workflow-card,
  .data-card,
  .bottom-composer,
  .status-chip {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .report-doc table {
    display: block;
    overflow-x: auto;
  }
}

/* ===== 固定追加章节：人工详批/学习/反馈（contact-box 国风框） ===== */
.rp-appendix {
  margin-top: 32px;
  padding: 24px 26px;
  border: 1px solid rgba(47, 111, 115, 0.2);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(234, 243, 241, 0.72), rgba(255, 253, 246, 0.72));
}

.rp-appendix h3 {
  margin-top: 0;
}

.rp-appendix p {
  margin: 0 0 12px;
  color: #2c3d3a;
  line-height: 1.95;
  font-size: 15px;
}

.rp-contact {
  display: grid;
  gap: 5px;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(47, 111, 115, 0.14);
  line-height: 1.7;
}

.rp-contact strong {
  color: var(--qing-dark);
  font-size: 15.5px;
  letter-spacing: 0.04em;
}

.rp-contact-line {
  color: var(--ink);
  font-size: 14.5px;
}

/* ===== 保存为 PDF 按钮 ===== */
.rp-actions {
  display: flex;
  justify-content: flex-end;
  margin: 18px 0 4px;
}

.rp-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 12px;
  border: 1px solid var(--gold-soft);
  background: linear-gradient(180deg, var(--qing-dark), #245a5e);
  color: #fdf9ee;
  font-size: 14.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.rp-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(47, 111, 115, 0.28);
}

.rp-save-btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* ===== 微信/抖音内置浏览器引导浮层 ===== */
#browser-hint-mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 30, 30, 0.55);
  backdrop-filter: blur(2px);
}

.browser-hint-box {
  max-width: 360px;
  width: 100%;
  padding: 26px 24px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf6, #faf9f1);
  border: 1px solid var(--gold-soft);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.browser-hint-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--qing-dark);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.browser-hint-text {
  font-size: 14.5px;
  line-height: 1.9;
  color: #2c3d3a;
  text-align: left;
  margin-bottom: 20px;
}

.browser-hint-text strong {
  color: var(--qing-dark);
}

.browser-hint-close {
  padding: 10px 28px;
  border-radius: 11px;
  border: none;
  background: var(--qing-dark);
  color: #fdf9ee;
  font-size: 14.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

