/* ==========================================================================
   设计令牌 —— 唯一真相源见 design-system/mingli-web/MASTER.md
   风格：Soft UI Evolution（柔和阴影 / 微妙深度 / 沉静 / 有机形状）
   改样式前先改 MASTER.md，再同步这里。
   ========================================================================== */
:root {
  /* 背景与表面：宣纸暖白体系 */
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --surface-sunken: #FBFAF6;
  --line: #E4DFD3;
  --line-strong: #D6CFC0;

  /* 文字：墨色（对比度 ≥4.5:1） */
  --text: #2A2E2C;
  --muted: #66625A;
  --faint: #8C877D;

  /* 五角色：主（黛青）/ 辅（朱砂）/ CTA（金） */
  --primary: #3F6B64;
  --primary-soft: #E8F0EE;
  --secondary: #B4654A;
  --secondary-soft: #FBEEE9;
  --accent: #C9A227;          /* 金：主按钮与强调 */
  --accent-deep: #A98620;     /* 金：hover */
  --accent-soft: #FBF3DF;

  /* 语义色 */
  --ok: #3F7A54;
  --ok-bg: #EAF3EC;
  --warn-bg: #FFF8E6;
  --warn-line: #D99A1A;
  --danger: #A33B2A;
  --danger-bg: #FBEAE6;

  /* 五行色（命理语义，勿随意改） */
  --wx-木: #4A8F5B;
  --wx-火: #C0392B;
  --wx-土: #B8860B;
  --wx-金: #8A8F98;
  --wx-水: #2E6F9E;

  /* 柔和阴影（多层、低透明，禁止生硬黑影） */
  --shadow-xs: 0 1px 2px rgba(42, 46, 44, .04);
  --shadow-sm: 0 1px 2px rgba(42, 46, 44, .04), 0 2px 8px rgba(42, 46, 44, .05);
  --shadow-md: 0 2px 4px rgba(42, 46, 44, .04), 0 8px 22px rgba(42, 46, 44, .07);
  --shadow-lg: 0 4px 8px rgba(42, 46, 44, .05), 0 16px 40px rgba(42, 46, 44, .09);

  /* 圆角：有机形状 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* 间距刻度 */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* 动效 */
  --t-fast: 120ms ease;
  --t-base: 180ms cubic-bezier(.4, 0, .2, 1);

  /* 字体栈：不联网，只用系统字体 */
  --font-serif: "Songti SC", "SimSun", "Noto Serif CJK SC",
                "Source Han Serif SC", "STSong", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

/* 作者样式表里的 display 会盖掉浏览器默认的 [hidden]{display:none} 规则，
   所以 .progress 这种设了 display:flex 的元素加 hidden 属性是无效的。
   统一兜底，避免再踩同一个坑。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 页头盒模型（内边距/字号/配色见文件末尾「Soft UI Evolution 风格层」，勿在此重复定义） */
header { max-width: 1040px; margin: 0 auto; }

main { max-width: 1040px; margin: 0 auto; padding: 0 24px 40px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 14px 0;
}

h2 {
  font-size: 15px; font-weight: 600; margin: 0 0 14px;
  padding-left: 10px; border-left: 3px solid var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px 16px;
}

label { display: block; font-size: 13px; color: var(--muted); min-width: 0; }
label.opt { opacity: 0.85; }

input, select {
  display: block; width: 100%; min-width: 0; margin-top: 5px;
  padding: 7px 9px; font: inherit; font-size: 14px; color: var(--text);
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
}
/* 经度这类字段小数位多，隐藏 spinner 把宽度让给数字 */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.seg { display: flex; gap: 6px; margin-top: 5px; }
.seg button {
  flex: 1; padding: 7px 0; font: inherit; font-size: 14px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 7px; color: var(--text);
}
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: #7a5c05; }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.spacer { flex: 1; }

button.primary, .btn {
  padding: 8px 16px; font: inherit; font-size: 14px; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; text-decoration: none;
}
button.primary:hover { background: #a07409; }
.btn { background: #fff; color: var(--accent); border-color: var(--line); }
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.hint { font-size: 12px; color: var(--muted); }
.err {
  margin: 12px 0 0; padding: 10px 12px; font-size: 13px;
  background: #fdecea; border-left: 3px solid #c0392b; border-radius: 4px; color: #8c2b21;
}

.meta {
  background: var(--bg); border-radius: 8px; padding: 10px 14px;
  font-size: 13px; color: #4a463f; margin-bottom: 14px;
}
.meta-sub { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
th { font-weight: 500; color: var(--muted); font-size: 13px; background: #fcfbf9; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #fcfaf5; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--bg); color: var(--muted); }

.wxbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 14px 0 8px; }
.wxlegend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.wxlegend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }

.note { font-size: 13px; color: #4a463f; margin: 6px 0; }
.warn {
  background: var(--warn-bg); border-left: 3px solid var(--warn-line);
  padding: 10px 14px; font-size: 13px; border-radius: 4px; margin-top: 10px;
}
.kv { font-size: 14px; margin: 4px 0; }
.kv b { font-weight: 600; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: #7a5c05; font-size: 13px; margin-right: 6px;
}

.detail td { background: #fcfbf9; font-size: 13px; color: #4a463f; }
.detail p { margin: 5px 0; }
.detail .ch { display: inline-block; background: var(--accent-soft); border-radius: 6px; padding: 5px 10px; margin: 0 8px 6px 0; font-size: 13px; }
.detail .ch b { font-size: 15px; }
.detail .ch span { color: var(--muted); font-size: 12px; display: block; }
.detail .allu {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 4px; padding: 8px 12px; margin: 8px 0;
}
td.src { color: var(--muted); font-size: 12px; max-width: 260px; }
td .ai-badge { vertical-align: 1px; }

footer { max-width: 1040px; margin: 0 auto; padding: 0 24px 40px; }
/* 页脚：链接行 / 免责声明 / 主体与备案信息。
   内容由 tools/build_legal.py 生成，静态直出（备案号必须爬得到，不能靠 JS 注入）。 */
.foot-links {
  display: flex; flex-wrap: wrap; gap: 18px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.foot-links a { font-size: 12px; color: var(--primary); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-note { font-size: 12px; color: var(--muted); line-height: 1.75; margin: 10px 0 0; }
.foot-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12px; color: var(--faint); margin: 10px 0 0;
}
.foot-meta a { color: var(--faint); text-decoration: none; }
.foot-meta a:hover { color: var(--primary); text-decoration: underline; }
.foot-sep { color: var(--line-strong); }

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 260px; overflow-y: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 0;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.combo-group {
  font-size: 11px; color: var(--muted); padding: 5px 12px 3px;
  background: var(--bg); position: sticky; top: 0;
}
.combo-item {
  padding: 6px 12px; font-size: 14px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 10px;
}
.combo-item span { color: var(--muted); font-size: 12px; }
.combo-item:hover, .combo-item.on { background: var(--accent-soft); }
.combo-empty { padding: 8px 12px; font-size: 13px; color: var(--muted); }

/* ---- AI 选项区 ---- */
.aiopts {
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--accent-soft);
}
.airow { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.aiopts label { color: #6b5a2a; }
/* 注意：这里必须用 background-color，用 background 简写会把 select 的
   自绘箭头（background-image）一起重置掉，导致该下拉只剩文字。 */
.aiopts select, .aiopts input[type=range] { background-color: #fff; }
.wlabel { float: right; font-weight: 500; color: #7a5c05; }
.aiopts .hint { margin: 10px 0 0; color: #6b5a2a; }
.aiopts code {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: 0 4px; font-size: 12px;
}

/* ---- 进度条：AI 阶段要一眼看出"正在跑" ---- */
.progress { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.progress .bar {
  flex: 1; height: 8px; border-radius: 4px; background: #efe9d8; overflow: hidden;
  box-shadow: inset 0 0 0 1px #e6dcc0;
}
.progress .bar i {
  display: block; height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #d9a520, #f5d478, #d9a520);
  background-size: 200% 100%;
  transition: width .4s ease;
  animation: flow 1.3s linear infinite;
}
@keyframes flow {
  from { background-position: 0 0; }
  to { background-position: -200% 0; }
}
.progress .ptext {
  display: flex; align-items: center; gap: 7px; flex: none;
  font-size: 13px; font-weight: 600; color: #8a6100;
  font-variant-numeric: tabular-nums;
}
.progress .dot {
  flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .3; transform: scale(.7); }
}
.btn.small { padding: 5px 12px; font-size: 13px; }

/* ---- AI 卡片：生成中的强调状态 ---- */
#aiCard.busy {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.spinner {
  display: inline-block; width: 12px; height: 12px; margin-left: 8px;
  border: 2px solid #ecdfb8; border-top-color: var(--accent); border-radius: 50%;
  animation: spin .75s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 骨架屏：比一行灰字更能说明"正在生成" */
.skel-line {
  height: 12px; border-radius: 6px; margin: 11px 0;
  background: linear-gradient(90deg, #f1ede4 25%, #e6e0d2 37%, #f1ede4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.skel-line.w40 { width: 40%; }
.skel-line.w55 { width: 55%; }
.skel-line.w70 { width: 70%; }
.skel-line.w90 { width: 90%; }
.skel-note { margin: 14px 0 2px; font-size: 13px; color: var(--muted); }

/* ---- AI 标记 ----
   .ai-badge  = 「这个候选名是 AI 推荐的」（内容归属）
   .ai-mark   = 「这段文字是 AI 生成的」（内容来源声明，合规用，两者语义不同勿混用） */
.ai-badge {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--accent-soft); color: #7a5c05; border: 0.5px solid var(--accent);
  margin-left: 6px; white-space: nowrap;
}
.ai-mark {
  display: inline-block; font-size: 11px; font-weight: 500; padding: 1px 6px;
  border-radius: 4px; margin-left: 6px; white-space: nowrap; vertical-align: 1px;
  color: var(--muted); background: var(--surface-sunken);
  border: 0.5px solid var(--line-strong);
}
.h2note { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
a.jump { color: var(--accent); text-decoration: none; }
a.jump:hover { text-decoration: underline; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ---- AI 解读条目：不用 .card 套娃，自己做紧凑布局 ---- */
/* 小号标签：总评/用神/寓意分/推荐理由…统一用宽 */
.lab {
  display: inline-block; min-width: 3.4em; margin-right: 6px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.ai-lead { margin: 0 0 14px; }
.ai-item {
  border: 1px solid var(--line); border-radius: 10px;
  margin: 8px 0; background: #fff; overflow: hidden;
}
.ai-item[open] { border-color: #e3d3a3; background: #fffdf8; }
.ai-sum {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer; list-style: none;
  font-size: 15px; user-select: none;
}
.ai-sum::-webkit-details-marker { display: none; }
.ai-sum:hover { background: var(--accent-soft); }
/* 自绘箭头：比系统默认的实心三角干净 */
.ai-sum::after {
  content: ''; flex: none; width: 6px; height: 6px; margin-left: 2px;
  border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s ease;
}
.ai-item[open] > .ai-sum::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}
.ai-item .rank {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600;
}
.ai-item[open] .rank { background: var(--accent); color: #fff; }
.ai-item .nm { font-weight: 600; letter-spacing: .04em; }
.ai-item .ai-badge { flex: none; margin-left: 0; }
.ai-item .total {
  margin-left: auto; flex: none; font-size: 15px; font-weight: 600;
  color: #7a5c05; font-variant-numeric: tabular-nums;
}
.ai-item .total::before {
  content: '寓意 '; font-size: 11px; font-weight: 400; color: var(--muted);
}
.ai-body { padding: 2px 16px 14px; border-top: 1px dashed var(--line); }
.ai-body p { margin: 8px 0; }
.ai-body .chline b {
  display: inline-block; min-width: 1.5em; margin-right: 4px; color: #7a5c05;
}
.ai-body .allu { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 8px 12px; }
#aiBody > p { margin: 8px 0; }

/* ---- 典故风格与命名取向 ---- */
.styleopts {
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg);
}
.srow { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.srow + .srow { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.slabel { font-size: 13px; color: var(--muted); font-weight: 500; flex: none; }
.slabel .sub { font-weight: 400; color: var(--line); margin-left: 6px; font-size: 12px; }
.spresets { display: flex; gap: 6px; flex-wrap: wrap; }
button.mini {
  padding: 3px 10px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-family: inherit;
}
button.mini:hover { border-color: var(--accent); color: var(--accent); }

.stylelist { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.sline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.sgroup {
  flex: none; min-width: 62px; font-size: 12px; color: var(--muted);
  border-left: 2px solid var(--accent); padding-left: 7px;
}
.stylelist label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text); cursor: pointer; margin: 0;
}
.stylelist label:hover { color: var(--accent); }
.stylelist input { width: auto; margin: 0; }
.stylelist .n { color: var(--muted); font-size: 11px; }

.checks { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.checks label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--text); cursor: pointer; margin: 0;
}
.checks input { width: auto; margin: 0; }
.styleopts .hint { margin: 12px 0 0; }

/* ---- V2 命局特征与复核 ---- */
.feat { margin: 10px 0; font-size: 13px; }
.feat p { margin: 4px 0; }
.feat .lab, .reviewBody .lab {
  display: inline-block; min-width: 3.6em; margin-right: 6px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.hint2 { font-size: 11px; color: var(--muted); margin-left: 4px; }
.tag.ok { background: #eef6ee; color: #3f6b3f; }
.skel-note { font-size: 13px; color: var(--muted); }

/* ---- 账号栏与登录框 ---- */
.userbar { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.dialog {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; width: 320px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.dialog h3 { margin: 0 0 12px; font-size: 15px; font-weight: 500; }
.dialog label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.dialog input { display: block; width: 100%; margin-top: 5px; }

/* ---- 收藏星标 ---- */
button.star {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  cursor: pointer; font-size: 15px; line-height: 1; padding: 3px 7px; color: var(--muted);
}
button.star:hover { border-color: var(--accent); color: var(--accent); }
button.star.on { color: #b8860b; border-color: #b8860b; }

/* ---- 备选名与对比 ---- */
table.cmp th, table.cmp td { border-bottom: 1px solid var(--line); padding: 7px 10px; }
table.cmp th:first-child, table.cmp td:first-child { color: var(--muted); font-size: 12px; }
#compareBox { margin-top: 14px; }

/* ---- 顶部导航 ---- */
/* 页签：独立的分段控件，与下方内容卡片彻底分离。
   之前做成"连体标签页"（页签压在卡片顶边上），但卡片有 12px 圆角，
   页签一压上去就会露出圆弧/双层边，怎么调都不干净。
   改成整条灰色底 + 激活项白色胶囊，页签多少切换都不会变形。 */
.tabs { max-width: 1040px; margin: 16px auto 0; padding: 0 24px; }
.tabgroup {
  display: inline-flex; gap: 3px; padding: 3px;
  background: #f0ede7; border-radius: 10px;
}
.tab {
  padding: 7px 16px; font-size: 14px; cursor: pointer;
  border: none; background: transparent; border-radius: 8px;
  color: var(--muted); font-family: inherit;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); }
.tab.on {
  background: #fff; color: var(--accent); font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.pquick { display: flex; align-items: center; gap: 10px; }
.pquick select { margin-top: 0; width: auto; min-width: 240px; }

/* ---- 匹配度分析 ---- */
.mscore { display: flex; align-items: center; gap: 20px; margin: 18px 0; }
.mtotal {
  font-size: 46px; font-weight: 600; line-height: 1;
  min-width: 108px; text-align: center; padding: 12px 0;
  border-radius: 12px; border: 1px solid var(--line);
}
.mtotal.lv-great { color: #2f7a3f; background: #eef7ef; border-color: #bcd9c2; }
.mtotal.lv-good  { color: #7a5c05; background: var(--accent-soft); border-color: #e3d3a3; }
.mtotal.lv-mid   { color: #6b5a2a; background: #fdfaf2; border-color: #e6ddc4; }
.mtotal.lv-bad   { color: #8c2b21; background: #fdecea; border-color: #f0c9c4; }
.mlevel { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.mlevel.lv-great { color: #2f7a3f; } .mlevel.lv-good { color: #7a5c05; }
.mlevel.lv-mid { color: #6b5a2a; }   .mlevel.lv-bad { color: #8c2b21; }
.mname { font-size: 16px; margin-bottom: 3px; }

table.mdim { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.mdim th, table.mdim td {
  border-bottom: 1px solid var(--line); padding: 8px 10px;
  text-align: left; vertical-align: top; font-size: 13px;
}
table.mdim thead th { color: var(--muted); font-weight: 500; }
table.mdim td.num { font-variant-numeric: tabular-nums; font-weight: 600; width: 52px; }
table.mdim td.w { color: var(--muted); width: 56px; }
.bar { height: 6px; background: #f0ede7; border-radius: 3px; overflow: hidden; margin: 4px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.why { color: #4a463f; font-size: 12.5px; line-height: 1.6; }

.mbox { margin-top: 16px; }
.mbox h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
.mbox ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.8; }
.mbox p { font-size: 13px; line-height: 1.75; margin: 6px 0; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.mgrid > div { font-size: 13px; line-height: 1.7; background: #fcfbf9; border-radius: 8px; padding: 8px 10px; }
.mk { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.disclaim { margin-top: 16px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* 缺字补充 */
.mrow { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.mrow .mzi { font-size: 20px; width: 28px; text-align: center; }
.mrow label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mrow select, .mrow input { width: 96px; margin: 0; }

/* 匹配度页的 AI 选项行 */
#mAIOpts { margin-top: 12px; padding: 12px 14px; background: #fdfaf2;
           border: 1px solid #e6ddc4; border-radius: 8px; }
.aicheck { display: flex; align-items: center; gap: 7px; font-size: 13px;
           color: #6b5a2a; font-weight: 500; }
.aicheck input { width: auto; margin: 0; }
#mAIOpts.off { opacity: .55; }
#mAIOpts.off .aicheck { color: var(--muted); }

/* 存档弹窗：与登录框同一套版式，稍宽一点放摘要 */
#saveMask .dialog { width: 360px; }
#saveMask .hint { margin: -4px 0 12px; font-size: 12.5px; }

/* ---- 账号徽章 ---- */
.userchip {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 3px 11px 3px 3px; cursor: pointer;
  font-family: inherit; font-size: 13px;
}
.userchip:hover { border-color: var(--accent); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #7a5c05;
  font-size: 13px; font-weight: 600; flex: none;
}
.avatar.big { width: 46px; height: 46px; font-size: 19px; }
.userchip .caret { color: var(--muted); font-size: 11px; }

/* ---- 个人信息面板 ---- */
#meMask .dialog.me { width: 420px; }
.mehead { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.meid { flex: 1; min-width: 0; }
.mename { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.mestats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mecard {
  background: #fcfbf9; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; text-align: center;
}
.mecard-n { display: block; font-size: 21px; font-weight: 600; color: #7a5c05;
            font-variant-numeric: tabular-nums; }
.mecard-k { font-size: 12px; color: var(--muted); }
.mecard-k i { font-style: normal; }
.meacts { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.meacts .spacer { flex: 1; }
.btn.danger { color: #8c2b21; border-color: #f0c9c4; }
.btn.danger:hover { background: #fdecea; }

/* ==========================================================================
   Soft UI Evolution 风格层
   放在文件末尾，用于统一覆盖早期的视觉细节（硬编码色、旧阴影、旧圆角）。
   所有令牌见文件头 :root 与 design-system/mingli-web/MASTER.md
   ========================================================================== */

/* ---- 基础排版：正文行高放宽，长文友好 ---- */
body {
  font: 400 15px/1.75 var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 页头：衬线标题 + 纸感分隔
   品牌区与账号区必须同轴居中，否则视觉重心割裂（.brand-bar 默认 flex-start 会贴左）
   注意：标题字号统一由文件末尾的 .brand-bar h1 定义，此处不再重复写 header h1 */
header {
  max-width: 1040px;
  margin: 0 auto;
  text-align: center;
  padding: 32px 24px 18px;
  border-bottom: 1px solid var(--line);
}
header .sub { color: var(--muted); font-size: 13px; margin: 0; }

/* 卡片标题：衬线 + 金色竖条 */
h2 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
h3 { font-size: 14px; font-weight: 600; }
.h2note { color: var(--faint); font-weight: 400; font-size: 12.5px; }

/* ---- 卡片：柔和阴影 + 有机圆角 ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5) var(--s-6);
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ---- 页签：浅底 + 白色胶囊 ---- */
.tabgroup {
  background: rgba(42, 46, 44, .045);
  border-radius: var(--r-md);
  padding: 3px;
}
.tab {
  border-radius: var(--r-sm);
  padding: 7px 16px;
  color: var(--muted);
  transition: color var(--t-fast), background var(--t-base), box-shadow var(--t-base);
}
.tab:hover { color: var(--text); }
.tab.on {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ---- 按钮：主按钮金底墨字（白字对比度不达标，故用墨色） ---- */
.btn, button.primary {
  border-radius: var(--r-md);
  transition: background var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), color var(--t-fast);
}
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #2A2E2C;              /* 墨色字，对比度约 7:1 */
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
button.primary:hover, .btn.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;                 /* 加深后白字才达标 */
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.small { border-radius: var(--r-sm); }
a.btn { text-decoration: none; }

/* ---- 表单控件 ---- */
input, select, textarea {
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 107, 100, .14);
}

/* ---- 表格：弱化表头、行 hover、衬线数字 ---- */
table { border-collapse: collapse; }
thead th, table th {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .3px;
  background: var(--surface-sunken);
}
tbody tr.clickable:hover { background: var(--primary-soft); }
tbody td, table td { font-variant-numeric: tabular-nums; }
.tablewrap { border-radius: var(--r-md); }

/* ---- 提示与状态 ---- */
.hint { color: var(--muted); }
.err {
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
  color: var(--danger);
  border-radius: var(--r-sm);
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
button.star.on { color: var(--accent-deep); border-color: var(--accent); }

/* ---- 匹配度分数卡 ---- */
.mtotal { border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.mtotal.lv-great { color: var(--ok); background: var(--ok-bg); border-color: #BCD9C2; }
.mtotal.lv-good  { color: #7A5C05; background: var(--accent-soft); border-color: #E8DAAC; }
.mtotal.lv-mid   { color: var(--muted); background: var(--surface-sunken); border-color: var(--line-strong); }
.mtotal.lv-bad   { color: var(--danger); background: var(--danger-bg); border-color: #F0C9C4; }
.mlevel.lv-great { color: var(--ok); }
.mlevel.lv-good  { color: #7A5C05; }
.mlevel.lv-mid   { color: var(--muted); }
.mlevel.lv-bad   { color: var(--danger); }

/* ---- 账号徽章与个人面板 ---- */
.avatar { background: var(--primary-soft); color: var(--primary); }
.mecard { background: var(--surface-sunken); border-radius: var(--r-md); }
.mecard-n { color: var(--primary); }
.aicheck { color: #6B5A2A; }
#mAIOpts { background: var(--accent-soft); border-color: #E8DAAC; border-radius: var(--r-md); }

/* ---- 无障碍：键盘焦点可见 ---- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---- 可点击元素一律 cursor:pointer（交付前检查项） ---- */
button, [role="button"], .clickable, .tab, .userchip, label input[type="checkbox"] {
  cursor: pointer;
}

/* ---- 尊重系统"减少动效"偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- 响应式：375 / 768 / 1024 / 1440 ---- */
@media (max-width: 1024px) {
  main, header, footer, .tabs { max-width: 100%; }
}
@media (max-width: 768px) {
  header { padding: 24px 16px 14px; }
  main { padding: 0 16px 32px; }
  .tabs { padding: 0 16px; }
  .tabgroup { overflow-x: auto; max-width: 100%; }
  .card { padding: var(--s-4); border-radius: var(--r-md); }
  .grid { grid-template-columns: 1fr 1fr; gap: var(--s-3); }
  .mestats { grid-template-columns: 1fr; }
  .meacts { gap: var(--s-2); }
  .dialog { width: min(92vw, 360px); }
}
@media (max-width: 375px) {
  .grid { grid-template-columns: 1fr; }
  .tab { padding: 6px 12px; font-size: 13px; }
  .card { padding: var(--s-3); }
}

/* 页头居中，账号区随之居中，视觉重心一致 */
.userbar { justify-content: center; margin-top: 12px; }

/* ---- 候选表的导出按钮组 ----
   四个入口里「图文报告」是主要落点，其余是格式导出，故分两级：
   报告＝浅金底描金（强调），导出＝白底细边 pill；中间一条细分隔。 */
.exports { display: inline-flex; align-items: center; gap: 6px; }
.exports .exp-sep {
  width: 1px; height: 16px; background: var(--line-strong); flex: none;
}
.btn.export {
  padding: 4px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  border-radius: var(--r-pill);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  transition: color var(--t-fast), border-color var(--t-fast),
              background var(--t-fast), box-shadow var(--t-fast);
}
.btn.export:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-xs);
}
.btn.export.report {
  color: #7A5C05;
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.export.report:hover {
  color: #2A2E2C;
  background: var(--accent);
  border-color: var(--accent-deep);
  box-shadow: var(--shadow-xs);
}

/* 操作行（含导出按钮组）与紧随其后的表格之间留出呼吸感。
   只作用于"紧跟表格"的那一行，不影响表单区的其它 .actions。 */
.actions + .tablewrap { margin-top: 12px; }

/* ---- 下拉框：去掉系统默认箭头，改为自绘 SVG chevron ----
   系统箭头无法调色/对齐，且贴在最右边显得单薄。
   这里 appearance:none 去掉它，用内联 SVG（不依赖任何外部资源，
   项目不联网）画一个与文字同色的箭头，右侧留出点击热区。 */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366625A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast);
}
select:hover { border-color: var(--primary); background-color: var(--primary-soft); }
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 107, 100, .14);
}
select:disabled { cursor: not-allowed; opacity: .55; }
/* 部分浏览器会给下拉项继承浅色，这里兜底保证可读 */
select option { color: var(--text); background: var(--surface); }

/* 档案快捷录入那种"宽下拉"，箭头位置随之靠右，内边距也放宽 */
.pquick select { padding: 8px 34px 8px 12px; }

/* ==========================================================================
   自定义下拉（custom select）
   --------------------------------------------------------------------------
   原生 <option> 的弹出列表由操作系统绘制，CSS 无法定制（macOS 尤其如此），
   所以自绘一套：原生 <select> 仍留在 DOM 里（JS 取值、change 事件、
   无障碍与自动化测试都照旧可用），只是视觉上藏起来，由 .csel 接管外观。
   ========================================================================== */

select.csel-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.csel { position: relative; display: block; width: 100%; margin-top: 5px; }

.csel-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%;
  padding: 7px 10px 7px 12px;
  font: inherit; font-size: 14px; text-align: left;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              background var(--t-fast);
}
.csel-trigger::after {
  content: ''; flex: none; width: 12px; height: 12px;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366625A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center / 12px;
  transition: transform var(--t-base);
}
.csel.open .csel-trigger::after { transform: rotate(180deg); }
.csel-trigger:hover { border-color: var(--primary); background: var(--primary-soft); }
.csel.open .csel-trigger,
.csel-trigger:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 107, 100, .14);
  outline: none;
}
.csel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel.disabled .csel-trigger {
  opacity: .55; cursor: not-allowed; background: var(--surface-sunken);
}

.csel-panel {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 264px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.csel-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.5; color: var(--text); cursor: pointer;
}
.csel-opt:hover, .csel-opt.active { background: var(--primary-soft); color: var(--primary); }
.csel-opt[aria-selected="true"] { font-weight: 600; color: var(--primary); }
.csel-opt[aria-selected="true"]::after {
  content: ''; flex: none; width: 12px; height: 12px;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233F6B64' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / 12px;
}

/* 触发器是 div（见 app.js 里的说明），补齐原生 button 默认没有的部分 */
.csel-trigger { user-select: none; }
.csel-trigger[aria-disabled="true"] { cursor: not-allowed; }

/* ---- AI 额度提示 ---- */
.quota {
  margin: 8px 0 0; font-size: 12.5px; line-height: 1.6;
  color: var(--primary);
}
.quota.warn { color: var(--danger); }
#mAIOpts + .quota, #aiQuota { margin-top: 8px; }
/* 个人面板统计卡改成自适应列数（多了一张"今日 AI"） */
.mestats { grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); }

/* ==========================================================================
   品牌标识与标题
   ========================================================================== */
/* 品牌区：badge 与 h1 同行成组，整组居中；副标题独立成行（见下方 header .sub）。
   ⚠️ badge 不能放在「标题+副标题」文字块的外面：那样它贴的是文字块左边缘，
   而标题在块内是居中的，实际间隙会被拉开到 130px 以上。
   与 header 的 text-align:center 无关（flex 容器不受 text-align 影响），
   必须显式 justify-content:center，否则整组贴左、与居中的 .userbar 错位。 */
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.brand-badge {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, .06);
}
.brand-bar h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
}
/* 拉丁字母与汉字的垂直定位天然不同：宋体汉字的墨迹会越过基线向下约 0.18em，
   而拉丁大写只落在基线上（下沿反而在基线上方）。同一行里 "AI" 会显得浮在汉字上沿。
   实测 24px 下：汉字墨迹 -18.67…+4.25，拉丁大写 -17.28…-1.34（相对基线）。
   这里把拉丁略放大并下移，使两者光学中心重合。
   line-height:1 是必须的：否则放大+下移会撑高行盒，把副标题一起推下去。 */
.brand-bar h1 .brand-lat {
  font-size: 1.1em;
  line-height: 1;
  letter-spacing: 0;
  vertical-align: -0.11em;
}

/* 品牌标题的窄屏缩放。
   必须写在此处（.brand-bar h1 之后）：媒体查询不提升特异性，靠顺序取胜，
   放在文件前部的响应式区会被上面的 font-size:24px 压掉。 */
@media (max-width: 768px) {
  .brand-bar h1 { font-size: 22px; letter-spacing: 1px; }
}
@media (max-width: 375px) {
  .brand-bar h1 { font-size: 20px; }
  .brand-badge { width: 28px; height: 28px; font-size: 16px; }
}

/* ==========================================================================
   账号闭环：注册确认密码、找回码、改密码、注销
   ========================================================================== */
.auth-switch-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.auth-switch-links a {
  color: var(--primary);
  text-decoration: none;
}
.auth-switch-links a:hover {
  text-decoration: underline;
}
.recovery-dialog {
  width: min(92vw, 420px);
}
.recovery-code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent);
  color: #7A5C05;
  font-size: 20px;
  font-weight: 700;
  padding: 16px;
  border-radius: var(--r-md);
  text-align: center;
  letter-spacing: 2px;
  margin: 16px 0;
  user-select: all;
  -webkit-user-select: all;
}
.mepwd-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mepwd-form {
  margin-top: 4px;
  background: var(--surface-sunken);
  padding: 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.mepwd-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}
.mepwd-form input {
  margin-top: 4px;
  width: 100%;
}

/* ==========================================================================
   名字详情弹窗（与小程序端对齐）
   ========================================================================== */
.name-modal {
  width: min(94vw, 680px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
}
.namemodal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  flex: none;
}
.namemodal-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.namemodal-name {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .04em;
}
.namemodal-pinyin {
  color: var(--muted);
  font-size: 14px;
}
.namemodal-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.namemodal-score-badge {
  font-size: 16px;
  font-weight: 700;
  color: #7A5C05;
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent);
}
.namemodal-body {
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
  line-height: 1.7;
}
.namemodal-chars {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.namemodal-ch-card {
  flex: 1 1 200px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}
.namemodal-ch-zi {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--primary);
  margin-right: 8px;
}
.namemodal-sec {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}
.namemodal-sec-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--primary);
  margin-bottom: 6px;
}
.namemodal-foot {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: none;
}
.btn.highlight {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #7A5C05;
  font-weight: 600;
}
.btn.highlight:hover {
  background: var(--accent);
  color: #2A2E2C;
}

/* ==========================================================================
   AI 智能起名顾问（独立视图与流式对话）
   ========================================================================== */
.tab.tab-ai {
  color: #7A5C05;
  font-weight: 600;
}
.tab.tab-ai.on {
  background: var(--accent);
  color: var(--text);
  border-color: var(--accent-deep);
}
.advisor-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.advisor-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.advisor-title-row h2 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.advisor-model-lbl {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.advisor-ctx-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 6px 12px;
  background: var(--surface-sunken);
  border-radius: var(--r-sm);
  font-size: 13px;
  flex-wrap: wrap;
}
.ctx-tag {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 4px;
  font-weight: 600;
  flex: none;
}
.ctx-desc {
  color: var(--muted);
  flex: 1;
  min-width: 200px;
}

/* 快捷提示 Prompts */
.quick-prompts-wrap {
  margin-bottom: 16px;
}
.quick-prompts-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.quick-prompts-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.prompt-pill {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.prompt-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #7A5C05;
}

/* 对话流容器 */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 280px;
  max-height: 520px;
  overflow-y: auto;
  padding: 10px 4px;
  margin-bottom: 16px;
  scroll-behavior: smooth;
}
.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 92%;
}
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg.ai {
  align-self: flex-start;
}
.chat-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.chat-msg.user .chat-avatar {
  background: var(--primary);
  color: #fff;
}
.chat-msg.ai .chat-avatar {
  background: var(--accent);
  color: var(--text);
}
.chat-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-xs);
  font-size: 14.5px;
  line-height: 1.7;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--primary-soft);
  border-color: #d1deda;
  color: var(--text);
  border-bottom-right-radius: 2px;
}
.chat-msg.ai .chat-bubble {
  background: #FFFDF8;
  border-color: #E8E2D5;
  border-bottom-left-radius: 2px;
}
.chat-sender {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.chat-tip {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}

/* 流式打字光标 */
.typing-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: -2px;
  animation: blink 0.8s infinite;
}

/* 思考过程折叠块 */
.reasoning-box {
  background: #F4F1EA;
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--muted);
}
.reasoning-title {
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 4px;
  user-select: none;
}

/* 消息动作操作 */
.msg-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(0, 0, 0, .05);
  font-size: 12px;
}
.msg-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.msg-action-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

/* 聊天输入栏 */
.chat-input-bar {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.chat-input-actions {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.chat-quota-hint {
  color: var(--primary);
  font-weight: 500;
}
.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input-row textarea {
  flex: 1;
  resize: vertical;
  min-height: 54px;
  max-height: 160px;
  font-family: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
}
.chat-input-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 107, 100, .14);
}
.chat-input-row button {
  height: 44px;
  padding: 0 20px;
  flex: none;
}
.chat-err {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--danger);
}

/* ==========================================================================
   全局悬浮 AI 顾问唤起按钮
   ========================================================================== */
.floating-ai-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--text);
  border: 1px solid var(--accent-deep);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all var(--t-base);
}
.floating-ai-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--accent-deep);
}
.floating-ai-btn .ai-spark {
  font-size: 16px;
  color: #7A5C05;
}

@media (max-width: 768px) {
  .floating-ai-btn {
    right: 16px;
    bottom: 16px;
    padding: 8px 14px;
    font-size: 13px;
  }
  .name-modal {
    padding: 16px;
  }
  .namemodal-title-row {
    flex-wrap: wrap;
  }
}
