/* ============================================================
   主题系统 · 四套配色 + 时间天气块 + 粒子层
   2026-11-25

   设计原则：
   1. 只覆盖 CSS 变量，不动任何组件规则 —— 现有 1200 行样式自动跟随
   2. 主题挂在 <html data-theme="..."> 上，JS 写入 localStorage 持久化
   3. 「自动」模式按天气码映射：晴→蓝白、雨→蓝白(雨)、雪→蓝白(雪)、夜间时段→夜间
   4. 粒子用 requestAnimationFrame + Canvas，低性能设备自动降级
   ============================================================ */

/* ---------- 一、粉红主题（照参考图：奶油底 + 樱粉主色 + 奶茶字） ---------- */
html[data-theme="pink"] {
  --bg: #fdf5f2;
  --bg-2: #f9ecec;
  --card: #ffffff;
  --line: #f2ddd9;
  --line-2: #f8ecea;
  --text: #38262a;
  --muted: #926e75;
  --faint: #c0a3a9;
  --accent: #d4627e;
  --accent-soft: #fde6eb;
  --blue: #a8627c;
  --blue-soft: #f9e4ea;
  --red: #c0395a;
  --red-soft: #fde8ee;
  --amber: #b5762f;
  --amber-soft: #faeeda;
  --shadow: 0 1px 2px rgba(212,98,126,.07), 0 8px 24px -12px rgba(212,98,126,.2);
  --topbar-bg: rgba(253,245,242,.93);
}

html[data-theme="pink"] body {
  background:
    radial-gradient(880px 460px at 12% -8%, rgba(224,150,170,.15), transparent 60%),
    radial-gradient(760px 400px at 92% 104%, rgba(240,190,200,.14), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- 二、蓝白主题（清爽、专业，默认） ---------- */
html[data-theme="blue"] {
  --bg: #f2f7fd;
  --bg-2: #e9f1fa;
  --card: #ffffff;
  --line: #d6e4f2;
  --line-2: #e6eef8;
  --text: #12233f;
  --muted: #54709a;
  --faint: #8fa9c8;
  --accent: #1d6fd4;
  --accent-soft: #ddebfd;
  --blue: #1d6fd4;
  --blue-soft: #ddebfd;
  --red: #c43a44;
  --red-soft: #fce9ec;
  --amber: #96690d;
  --amber-soft: #fcf2d9;
  --shadow: 0 1px 2px rgba(29,111,212,.06), 0 8px 24px -12px rgba(29,111,212,.22);
  --topbar-bg: rgba(242,247,253,.93);
}

html[data-theme="blue"] body {
  background:
    radial-gradient(900px 470px at 8% -10%, rgba(80,150,220,.12), transparent 60%),
    radial-gradient(760px 400px at 96% 106%, rgba(120,180,230,.1), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- 三、绿橙主题（照参考图：米白底 + 橙金强调 + 墨绿辅色） ---------- */
html[data-theme="green"] {
  --bg: #faf9f4;
  --bg-2: #f3f2e7;
  --card: #ffffff;
  --line: #e5e2d2;
  --line-2: #efeddf;
  --text: #20301f;
  --muted: #67755d;
  --faint: #9dab92;
  --accent: #2d6a4f;
  --accent-soft: #e4efe7;
  --blue: #c47a16;
  --blue-soft: #fcf0d8;
  --red: #b3402c;
  --red-soft: #fbeae6;
  --amber: #c47a16;
  --amber-soft: #fcf0d8;
  --shadow: 0 1px 2px rgba(45,106,79,.06), 0 8px 24px -12px rgba(45,106,79,.22);
  --topbar-bg: rgba(250,249,244,.93);
}

html[data-theme="green"] body {
  background:
    radial-gradient(880px 460px at 10% -8%, rgba(230,180,110,.14), transparent 60%),
    radial-gradient(780px 420px at 94% 104%, rgba(120,170,140,.11), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- 四、夜间主题 ---------- */
html[data-theme="dark"] {
  --bg: #151a22;
  --bg-2: #1b222c;
  --card: #202834;
  --line: #2c3644;
  --line-2: #242e3a;
  --text: #e6edf5;
  --muted: #9aabc0;
  --faint: #6b7c92;
  --accent: #5aa7ff;
  --accent-soft: rgba(90,167,255,.14);
  --blue: #5aa7ff;
  --blue-soft: rgba(90,167,255,.14);
  --red: #f2797f;
  --red-soft: rgba(242,121,127,.12);
  --amber: #e8ba58;
  --amber-soft: rgba(232,186,88,.12);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px -14px rgba(0,0,0,.65);
  --topbar-bg: rgba(21,26,34,.92);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(900px 480px at 10% -10%, rgba(74,158,255,.1), transparent 60%),
    radial-gradient(800px 420px at 94% 106%, rgba(140,90,220,.08), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

/* 夜间模式下输入框与表格的细节补偿 */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--bg-2);
  color: var(--text);
}

html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .nav-item:hover {
  background: rgba(255,255,255,.055);
}

html[data-theme="dark"] .topbar {
  background: var(--topbar-bg);
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .brand-mark {
  box-shadow: 0 0 22px -6px var(--accent);
}

html[data-theme="dark"] .auth-mask {
  background: rgba(8,11,15,.88);
}

/* ---------- 五、通用：卡片阴影与顶栏模糊（四套共用） ---------- */
.card,
.project-item,
.kpi {
  box-shadow: var(--shadow, none);
  transition: box-shadow .22s ease, border-color .18s ease, transform .18s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.topbar {
  background: var(--topbar-bg, rgba(255,255,255,.92));
}

/* 主题切换时不做彩虹过渡，只让底色平滑 0.28s */
body,
.card,
.topbar {
  transition: background-color .28s ease, border-color .28s ease, color .28s ease;
}

/* ============================================================
   时间 + 天气小卡
   ============================================================ */

/* 顶栏里塞得下就放顶栏，塞不下（窄屏）就收成图标按钮 */
.wx-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  user-select: none;
  cursor: default;
  transition: border-color .18s, box-shadow .18s;
  flex: 0 0 auto;
}

.wx-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  box-shadow: 0 2px 10px -4px color-mix(in srgb, var(--accent) 40%, transparent);
}

.wx-chip-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  flex: 0 0 26px;
  font-size: 14px;
  line-height: 1;
}

/* 天气图标：用 CSS 画，不依赖字体图标库 */
.wx-ico { width: 15px; height: 15px; display: block; }

.wx-chip-main { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.wx-chip-time {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  color: var(--text);
  white-space: nowrap;
}
.wx-chip-sub {
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 108px;
}

.wx-chip-temp {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  padding-left: 8px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .wx-chip { padding: 4px 9px 4px 5px; gap: 6px; }
  .wx-chip-main { display: none; }
  .wx-chip-temp { border-left: 0; padding-left: 0; font-size: 12px; }
}

/* ============================================================
   配色切换器：单按钮 + 弹出面板
   原来五个小圆点横排在顶栏，吃掉 115px，导航项被挤到只剩两项。
   改成一颗按钮，点开才展开，省空间也更有「高级感」。
   ============================================================ */

.theme-wrap { position: relative; flex: 0 0 auto; }

.theme-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition: border-color .16s, transform .16s;
}

.theme-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: scale(1.05); }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 环上的颜色代表当前主题，用 conic 做出四色环 */
.theme-btn-ring {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #d4788f, #2b6cb0, #d97f2b, #2a3441, #d4788f);
  position: relative;
}
.theme-btn-ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--card);
}

.theme-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 168px;
  padding: 6px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px -10px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.05);
  animation: popIn .16s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.theme-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .13s;
}

.theme-opt:hover { background: var(--bg-2); }
.theme-opt.is-on { background: var(--accent-soft); }
.theme-opt.is-on > span { font-weight: 600; color: var(--accent); }
.theme-opt > span { display: flex; flex-direction: column; line-height: 1.3; }

.theme-opt-sub {
  font-size: 10.5px;
  font-style: normal;
  color: var(--faint);
  font-weight: 400;
  margin-top: 1px;
}

.theme-swatch {
  width: 16px; height: 16px;
  border-radius: 50%;
  flex: 0 0 16px;
  border: 1px solid rgba(0,0,0,.08);
}

.sw-pink  { background: linear-gradient(135deg, #fbe0e6, #d4788f); }
.sw-blue  { background: linear-gradient(135deg, #dceafb, #2b6cb0); }
.sw-green { background: linear-gradient(135deg, #fbe7c9, #d97f2b); }
.sw-dark  { background: linear-gradient(135deg, #39424f, #0f1419); }
.theme-swatch-auto {
  background: conic-gradient(from 0deg, #f4c95d, #d4788f, #2b6cb0, #d97f2b, #f4c95d);
}

.theme-pop-foot {
  margin-top: 4px;
  padding: 8px 8px 4px;
  border-top: 1px solid var(--line-2);
}
.fx-label { display: block; font-size: 11px; color: var(--faint); margin-bottom: 6px; }
.fx-opts { display: flex; gap: 4px; }
.fx-opt {
  flex: 1; min-width: 0; padding: 5px 0;
  font-size: 11.5px; text-align: center;
  color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 6px;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.fx-opt:hover { border-color: var(--accent-line); color: var(--accent); }
.fx-opt.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); font-weight: 600; }

/* ============================================================
   粒子层（雨 / 雪）
   ============================================================ */

#fxLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  /* 顶栏 z-index 40，主内容 z-index 默认 0，这里放 1 让它盖在背景上、内容下 */
  opacity: 0;
  transition: opacity .6s ease;
}

#fxLayer.is-on { opacity: 1; }

/* 雨雪只在主题切换时开关；不开时完全不绘制，省电 */
@media (prefers-reduced-motion: reduce) {
  #fxLayer { display: none !important; }
}

/**
 * 内容层要压在粒子层之上，否则文字会被雨滴盖住。
 *
 * 注意只给 .main 设 z-index：
 * .topbar 原本是 position:sticky + z-index:40，被这条同优先级规则覆盖后
 * 会变成 position:relative + z-index:2，既丢了吸顶，配色面板也会被卡片盖住。
 */
.main { position: relative; z-index: 2; }

/* ============================================================
   视觉细节打磨：让整站看起来更「贵」
   ============================================================ */

/* 顶栏品牌标加一点主题光晕 */
.brand-mark {
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--accent) 88%, #fff),
    var(--accent));
  box-shadow: 0 2px 10px -3px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* 主按钮同样的渐变，避免大面积纯色显得平 */
.btn-primary {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 92%, #fff),
    var(--accent));
  border-color: var(--accent);
  box-shadow: 0 2px 8px -3px color-mix(in srgb, var(--accent) 65%, transparent);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.055);
  box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* 卡片标题左侧加一根主题色细线，形成视觉锚点 */
.card-head h2 {
  position: relative;
  padding-left: 11px;
}

.card-head h2::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 13px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .85;
}

/* 表格头加轻微渐变底，提升层次 */
.tbl thead th {
  background: linear-gradient(180deg, var(--bg-2), transparent);
}

/* 滚动条也跟随主题 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
  background-clip: content-box;
}

/* 焦点态统一，键盘用户看得见 */
:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 1px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
/* ============================================================
   夜间模式 · 硬编码浅色的系统覆盖
   ------------------------------------------------------------
   原 style.css 里有约 40 处直接写死的浅背景（#fff / #fafbfb / #fcfdfd …），
   单靠换 CSS 变量覆盖不到，深色下就成了「白底 + 浅灰字」看不清。
   这里按「语义」而不是逐个选择器去覆盖，规则更少也更稳。
   ============================================================ */

html[data-theme="dark"] .btn,
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .chip-add,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .dock,
html[data-theme="dark"] .tip,
html[data-theme="dark"] .preset,
html[data-theme="dark"] .auth-box,
html[data-theme="dark"] .tip-card,
html[data-theme="dark"] .now-card,
html[data-theme="dark"] .ai-block,
html[data-theme="dark"] .fail-box {
  background: var(--card);
  color: var(--text);
  border-color: var(--line);
}

/* 悬停/选中的浅底换成语义软色 */
html[data-theme="dark"] .btn:hover { background: rgba(255,255,255,.06); border-color: var(--line); }
html[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .tbl th { background: var(--bg-2); }
html[data-theme="dark"] .tbl tbody tr:hover { background: rgba(255,255,255,.035); }
html[data-theme="dark"] .ap-item:hover,
html[data-theme="dark"] .task-item:hover,
html[data-theme="dark"] .project-item:hover { background: rgba(255,255,255,.04); }
html[data-theme="dark"] .now-card.is-live,
html[data-theme="dark"] .now-card.is-clickable:hover,
html[data-theme="dark"] .task-item.is-current { background: var(--accent-soft); border-color: var(--accent); }
html[data-theme="dark"] .fail-box { background: var(--red-soft); border-color: rgba(240,113,120,.3); }

/* 标签/变量/代码块：灰底改暗底 */
html[data-theme="dark"] .tag-text,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .modal-body code,
html[data-theme="dark"] .tip code,
html[data-theme="dark"] kbd,
html[data-theme="dark"] pre {
  background: var(--bg-2);
  color: var(--text);
}

/* 有颜色的文本块：浅底软色换成语义透明色 */
html[data-theme="dark"] .tag-ok { background: var(--accent-soft); color: var(--accent); }

/* 表格/输入框的默认白底 */
html[data-theme="dark"] .tbl td { border-bottom-color: var(--line-2); }

/* 分析面板里那块「目标 vs 实测」白卡（截图问题点） */
html[data-theme="dark"] .report-box,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .p05-quote,
html[data-theme="dark"] .p05-config {
  background: var(--bg-2);
  border-color: var(--line);
}

html[data-theme="dark"] .p05-check { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .p05-check-warn { background: var(--red-soft); border-color: rgba(240,113,120,.28); }

/* 三线表：黑线在深色下反成白线 */
html[data-theme="dark"] table.tbl-three-line,
html[data-theme="dark"] table.tbl-three-line thead th {
  border-color: var(--text);
}
html[data-theme="dark"] table.tbl-three-line tbody td { border-bottom-color: var(--line-2); }
html[data-theme="dark"] table.tbl-three-line tbody tr:hover td { background: var(--accent-soft); }

/* 表单控件默认白底 */
html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input[type=number],
html[data-theme="dark"] input[type=tel],
html[data-theme="dark"] input[type=search],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] option { background: var(--card); color: var(--text); }

/* 结构分组标题（截图里「基础 / 信效度」的白底条） */
html[data-theme="dark"] .ap-group,
html[data-theme="dark"] .ap-g-title,
html[data-theme="dark"] .group-head,
html[data-theme="dark"] [class*="group-title"] {
  background: var(--bg-2);
  color: var(--muted);
  border-color: var(--line-2);
}

/* 进度条/滑块的浅底 */
html[data-theme="dark"] .bar,
html[data-theme="dark"] .progress { background: rgba(255,255,255,.07); }

/* 徽标上的白点要跟着换 */
html[data-theme="dark"] .nav-item.is-active .nav-badge { background: var(--accent); color: #fff; }

/* 空白/提示态 */
html[data-theme="dark"] .empty,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .log { color: var(--muted); }

/* ============================================================
   移动端顶栏压缩
   ------------------------------------------------------------
   390px 宽下原来的问题：芯片 + 配色按钮 + 项目名 + 三个按钮
   一行放不下，导航被挤到第二行，末尾的「⑤ 管理台」直接被裁掉。
   处理：隐藏项目名，按钮收成小尺寸，导航独占一行可横滑。
   ============================================================ */

@media (max-width: 760px) {
  /* 项目名最长，第一个牺牲 */
  .topbar-right .proj-name { display: none; }

  /* 右侧按钮收小，省出横向空间 */
  .topbar-right { gap: 5px; }
  .topbar-right .btn {
    padding: 5px 9px;
    font-size: 12px;
    height: 30px;
    line-height: 1;
  }

  /* 用户昵称在手机上只显示头像圆点，避免「张雨」这种两字也占 40px */
  .user-chip {
    max-width: 32px;
    overflow: hidden;
    padding: 0;
    justify-content: center;
  }

  /* 时间天气芯片：只留图标 + 温度（已有规则），再把内边距压到最小 */
  .wx-chip { padding: 3px 7px 3px 4px; gap: 5px; }
  .wx-chip-icon { width: 22px; height: 22px; flex-basis: 22px; font-size: 12px; }

  /* 导航独占一行并横滑，这是原来就有的规则，补一个右侧渐隐提示可滑动 */
  .nav {
    position: relative;
    padding-right: 14px;
  }
}

/* 极窄（≤400px）：再砍一个按钮的文字，只留图标语义 */
@media (max-width: 400px) {
  .topbar-right .btn { padding: 5px 7px; }
}

/* 390px 下右侧四个元素 still 差几个像素，把设置/退出按钮的左右内边距再收 1px */
@media (max-width: 420px) {
  .topbar-right { gap: 4px; }
  .topbar-right .btn { padding: 5px 6px; font-size: 11.5px; }
  .wx-chip { padding: 3px 5px 3px 3px; }
  .theme-btn { width: 26px; height: 26px; }
}

/* ============================================================
   分析页数据源选择器（2026-11-25）
   ============================================================ */
.source-card { padding-bottom: 14px; }
.source-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.source-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 360px; min-width: 240px; }
.source-field > span { font-size: 11.5px; color: var(--faint); }
.source-field select {
  width: 100%; padding: 8px 10px;
  font-size: 13px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px;
  outline: none; transition: border-color .15s;
}
.source-field select:focus { border-color: var(--accent-line); }
.source-meta { font-size: 12px; color: var(--muted); padding-bottom: 9px; }
@media (max-width: 760px) {
  .source-field { flex-basis: 100%; }
  .source-meta { padding-bottom: 0; }
}

/* ============================================================
   AI 深度分析面板 + 本地分析折叠（2026-11-25）
   ============================================================ */
.ai-analysis-card { border-color: var(--accent-line); }
.ai-tip {
  font-size: 12.5px; color: var(--muted); line-height: 1.7;
  padding: 10px 13px; margin: 4px 0 12px;
  background: var(--accent-soft); border-radius: 8px;
}
.ai-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ai-pick-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 12.5px; color: var(--muted); background: var(--card);
  cursor: pointer; user-select: none; transition: border-color .15s, background .15s;
}
.ai-pick-item:hover { border-color: var(--accent-line); }
.ai-pick-item.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.ai-pick-item input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.ai-pick-name { font-weight: 500; }
.ai-rec {
  font-size: 10px; padding: 1px 6px; border-radius: 20px;
  color: #fff; background: var(--accent); font-weight: 600;
}
.ai-result { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.ai-result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.ai-result-head b { font-size: 14px; color: var(--text); }
.ai-result-head .hint { margin-left: 8px; font-size: 11.5px; }
.ai-sec {
  padding: 14px 0; border-bottom: 1px dashed var(--line);
}
.ai-sec h3, .ai-summary h3 {
  font-size: 14px; color: var(--accent); margin: 0 0 8px; font-weight: 600;
}
.ai-para {
  font-size: 13.5px; line-height: 1.9; color: var(--text);
  margin: 0 0 10px; text-align: justify;
}
.ai-table-wrap { margin: 12px 0; }
.ai-table-cap { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.ai-table-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.ai-limit {
  font-size: 12px; color: var(--muted); background: var(--bg-2);
  padding: 8px 11px; border-radius: 7px; margin: 10px 0; line-height: 1.7;
}
.ai-limit b { color: var(--amber); }
.ai-copy { margin-top: 4px; }
.ai-summary { padding: 14px 0; }

.local-analysis-fold {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); margin-top: 4px;
}
.local-analysis-fold > summary {
  list-style: none; cursor: pointer; padding: 13px 16px;
  font-size: 13px; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 10px; user-select: none;
}
.local-analysis-fold > summary::-webkit-details-marker { display: none; }
.local-analysis-fold > summary::before {
  content: '▸'; color: var(--accent); font-size: 12px; transition: transform .18s;
}
.local-analysis-fold[open] > summary::before { transform: rotate(90deg); }
.local-analysis-fold > summary:hover { color: var(--text); }
.fold-badge {
  font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 20px;
  background: var(--bg-2); color: var(--faint);
}
.fold-body { padding: 0 0 14px; }
.fold-body .card { box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
@media (max-width: 760px) {
  .ai-pick-item { padding: 6px 9px; font-size: 12px; }
  .ai-result-head { align-items: flex-start; }
}
