/* ============================================================
 * theme.css — 宏观量化分析系统 V8.88 主题层
 * 依据《系统全新UI设计方案》§1.2 配色方案 / §9.3 主题切换补丁
 * 机制：不修改模板 styles.css，仅覆盖其 :root CSS 变量，
 *       通过 body[data-theme] 实现多主题切换。
 *
 * 主题清单（2026-08-27 改版）：
 *   默认（待命名·红金喜庆）—— 正红为体、金色为脉，红金配比参考
 *       战衣色块占比（红约八成、金点睛），金色承担结构划分：
 *       品牌区金框包裹、导航上方金线、板块间金色横杠、表格金色网格
 *   deep-red   深红 · 金（月报气质，沉稳版红金）
 *   research   券商研报经典（藏蓝 + 金）
 *   east-orange 东财橙（互联网券商活力橙）
 *   terminal-blue 终端蓝（金融数据终端蓝青）
 *   amber      Bloomberg 琥珀（黑底琥珀字，经典终端致敬）
 *   dark       深色模式（重做：深蓝灰底 + 红金点睛）
 *   自定义配色 —— 由 app.js ThemeManager 实时注入变量
 * ============================================================ */

/* ---------- 默认主题：正红 · 金（喜庆红金，待命名） ---------- */
:root {
  /* 模板变量重皮（映射到主题色） */
  --White: #FFFFFF;          /* 卡片/表面 */
  --Primary: #C0111F;        /* 主色：正红（标题/强调/按钮） */
  --YellowGreen: #C9A227;    /* 金色 */
  --Khaki: #C9A227;          /* 金色（模板高亮卡片底） */
  --Orchid: #1E88E5;         /* 信息/中性蓝 */
  --LightSkyBlue: #43A047;   /* 下跌/成功绿 */
  --Black: #1F1F1F;          /* 文字主色 */
  --GrayDark: #666666;       /* 文字次色 */
  --Gray: #999999;           /* 文字弱色 */
  --Gainsboro: #F7F4EE;      /* 主内容区背景（暖米白，配红金） */
  --Salmon: #E53935;         /* 上涨/警告红 */
  --LightGray: #E7DFC9;      /* 边框（浅金米） */
  --Orange: #2A1418;         /* 深色底 */
  --LimeGreen: #2A1418;
  --Green: #2E7D32;          /* 成功深绿 */

  /* 语义与结构变量 */
  --brand-red: #C0111F;
  --brand-gold: #C9A227;
  --bg-dark: #2A1418;
  --bg-light: #F7F4EE;
  --card-bg: #FFFFFF;
  --text-main: #1F1F1F;
  --text-sub: #666666;
  --text-weak: #999999;
  --up: #E53935;             /* A股习惯：红涨 */
  --down: #43A047;           /* A股习惯：绿跌 */
  --warn: #FB8C00;
  --info: #1E88E5;
  --danger: #B71C1C;
  --success: #2E7D32;
  --border: #C9A227;         /* 金色网格：表格行列划分 */
  --border-soft: #E7DFC9;    /* 弱分隔 */
  --table-hover: #FBF3DC;    /* 浅金悬停 */
  --table-stripe: #FDFBF6;
  --gold-bar: #C9A227;       /* 板块间金色横杠 */
  --brand-frame: #C9A227;    /* 品牌区金框 */
  --chart-colors: #C0111F, #C9A227, #1E88E5, #43A047;
}

/* ---------- 主题：鸿运金来（原深红·金，月报气质，红底金纹更喜庆） ---------- */
body[data-theme="deep-red"] {
  --Primary: #8B0000;
  --brand-red: #8B0000;
  --Gainsboro: #F5F0E8;
  --bg-light: #F5F0E8;
  --table-hover: #F3E7CE;
  --chart-colors: #8B0000, #C9A227, #1E88E5, #43A047;
}

/* ---------- 主题：锦红鎏金（蜀锦绸缎亮光红 + 真金/金线亮金，成都色调） ---------- */
body[data-theme="jinhong"] {
  --Primary: #DE3A25;        /* 蜀锦红：绸缎面亮红，带光泽感而非粉红 */
  --brand-red: #DE3A25;
  --YellowGreen: #E9B949;    /* 金线亮金 */
  --Khaki: #E9B949;
  --brand-gold: #E9B949;
  --gold-bar: #F0C752;       /* 真金横杠 */
  --brand-frame: #F0C752;    /* 金线描框 */
  --Gainsboro: #FFF8EC;      /* 亮锦缎米金底 */
  --bg-light: #FFF8EC;
  --LightGray: #F0DFB8;
  --border: #E9B949;
  --border-soft: #F0DFB8;
  --table-hover: #FCEFD2;
  --table-stripe: #FFFCF4;
  --chart-colors: #DE3A25, #E9B949, #F26B4A, #B8860B;
}

/* ---------- 主题：券商研报经典（藏蓝 + 金） ---------- */
body[data-theme="research"] {
  --Primary: #16305B;
  --YellowGreen: #C9A227;
  --Khaki: #C9A227;
  --Gainsboro: #F4F6FA;
  --LightGray: #C9D3E4;
  --Orange: #0E1F3D;
  --LimeGreen: #0E1F3D;
  --bg-dark: #0E1F3D;
  --bg-light: #F4F6FA;
  --brand-red: #16305B;
  --table-hover: #E8EEF9;
  --table-stripe: #F8FAFD;
  --border: #C9A227;
  --border-soft: #C9D3E4;
  --gold-bar: #16305B;
  --brand-frame: #16305B;
  --chart-colors: #16305B, #C9A227, #4A7BC8, #2E7D32;
}

/* ---------- 主题：东财橙 ---------- */
body[data-theme="east-orange"] {
  --Primary: #FF6600;
  --YellowGreen: #FFC24D;
  --Khaki: #FFE3CC;
  --Black: #262626;
  --Gainsboro: #F7F7F9;
  --LightGray: #E3E3E8;
  --Orange: #222633;
  --LimeGreen: #222633;
  --sidebar-bg: #222633;
  --bg-dark: #222633;
  --bg-light: #F7F7F9;
  --brand-red: #FF6600;
  --table-hover: #FFF1E6;
  --table-stripe: #FAFAFC;
  --border: #2E3A59;
  --border-soft: #E3E3E8;
  --gold-bar: #FF6600;
  --brand-frame: #FF6600;
  --chart-colors: #FF6600, #2E3A59, #1E88E5, #43A047;
}
body[data-theme="east-orange"] .tf-badge,
body[data-theme="east-orange"] .badge-gold { color: #FFFFFF; }
body[data-theme="east-orange"] .metric-card .metric-value { color: #262626; }

/* ---------- 主题：终端蓝（金融数据终端） ---------- */
body[data-theme="terminal-blue"] {
  --Primary: #0B4DA2;
  --YellowGreen: #2AB8B0;
  --Khaki: #D7E9F7;
  --Gainsboro: #F2F6FB;
  --LightGray: #D4DEEA;
  --Orange: #072A55;
  --LimeGreen: #072A55;
  --bg-dark: #072A55;
  --bg-light: #F2F6FB;
  --brand-red: #0B4DA2;
  --table-hover: #E3F0FB;
  --table-stripe: #F8FBFE;
  --border: #2AB8B0;
  --border-soft: #D4DEEA;
  --gold-bar: #0B4DA2;
  --brand-frame: #0B4DA2;
  --chart-colors: #0B4DA2, #2AB8B0, #F2A33C, #43A047;
}
body[data-theme="terminal-blue"] .board-tag,
body[data-theme="terminal-blue"] .top-rank.r2,
body[data-theme="terminal-blue"] .badge-gold { color: #1F1F1F; }

/* ---------- 主题：Bloomberg 琥珀（黑底琥珀字） ---------- */
body[data-theme="amber"] {
  --White: #14140F;          /* 表面：近黑卡片 */
  --Primary: #FFB61A;        /* 琥珀主色 */
  --YellowGreen: #FF8C00;
  --Khaki: #3A3217;          /* 高亮卡片底（暗琥珀） */
  --Orchid: #6FA8DC;
  --LightSkyBlue: #4CAF50;
  --Black: #FFC94D;          /* 琥珀文字 */
  --GrayDark: #C7A85C;
  --Gray: #8A7A4F;
  --Gainsboro: #0D0D0A;      /* 近黑背景 */
  --Salmon: #FF5252;
  --LightGray: #3D3A2C;
  --Orange: #000000;
  --LimeGreen: #000000;
  --Green: #4CAF50;

  --sidebar-bg: #0D0D0A;
  --bg-dark: #000000;
  --bg-light: #0D0D0A;
  --card-bg: #14140F;
  --text-main: #FFC94D;
  --text-sub: #C7A85C;
  --text-weak: #8A7A4F;
  --border: #FFB61A;
  --border-soft: #3D3A2C;
  --table-hover: #26220F;
  --table-stripe: #11110D;
  --gold-bar: #FFB61A;
  --brand-frame: #FFB61A;
  --chart-colors: #FFB61A, #FF8C00, #6FA8DC, #4CAF50;
}
body[data-theme="amber"] .text-White { color: #FFD778; }
body[data-theme="amber"] .metric-card .metric-value { color: #FFD778; }
body[data-theme="amber"] .tf-button.style-1 { color: #1a1200; }
body[data-theme="amber"] .cycle-tab.active,
body[data-theme="amber"] .factor-tag.active,
body[data-theme="amber"] .radio-tabs .rt-item.active { color: #1a1200; }

/* ---------- 主题：深色模式（重做：深蓝灰底 + 红金点睛） ---------- */
body[data-theme="dark"] {
  --White: #161B2E;          /* 表面：深蓝灰卡片 */
  --Primary: #D6455A;        /* 深色下提亮正红 */
  --YellowGreen: #D4AF37;
  --Khaki: #232A45;          /* 高亮卡片底 */
  --Orchid: #64B5F6;
  --LightSkyBlue: #66BB6A;
  --Black: #E8E8E8;
  --GrayDark: #B0B0B8;
  --Gray: #8A8A94;
  --Gainsboro: #0F1322;      /* 主背景 */
  --Salmon: #EF5350;
  --LightGray: #2A3150;
  --Orange: #0A0D18;
  --LimeGreen: #0A0D18;
  --Green: #43A047;

  --sidebar-bg: #0B0F1D;
  --bg-dark: #0A0D18;
  --bg-light: #0F1322;
  --card-bg: #161B2E;
  --text-main: #E8E8E8;
  --text-sub: #B0B0B8;
  --text-weak: #8A8A94;
  --border: #B8912F;         /* 暗金网格 */
  --border-soft: #2A3150;
  --table-hover: #1E2643;
  --table-stripe: #131828;
  --gold-bar: #B8912F;
  --brand-frame: #B8912F;
  --chart-colors: #D6455A, #D4AF37, #64B5F6, #66BB6A;
  /* V8.88-R9-M2'（A7）：K线语义色在深底上的对比度适配——
     亮色主题的红 #E53935/绿 #43A047 在 #0F1322 底上对比度不足（≈3.2:1 / 2.9:1），
     dark 块提亮为 #EF5350 / #66BB6A（≥4.5:1）；信息蓝/金/橙同步提亮。六主题其余为亮底，继承 :root。 */
  --up: #EF5350;             /* 涨红（深底提亮） */
  --down: #66BB6A;           /* 跌绿（深底提亮） */
  --info: #64B5F6;           /* 信息蓝 */
  --brand-gold: #D4AF37;     /* 金 */
  --warn: #FFB74D;           /* 警示橙 */
}
body[data-theme="dark"] .text-White { color: #FFFFFF; }
body[data-theme="dark"] .section-menu-left,
body[data-theme="dark"] .header-dashboard { background-color: #0B0F1D; }

/* ============================================================
 * 结构金色元素（品牌区金框 / 导航金线 / 板块间金横杠）
 * 颜色走 --brand-frame / --gold-bar 变量，各主题自适应
 * ============================================================ */

/* 模板 box-logo 为 position:fixed 主色底块 —— 改为透明，
   让侧栏底色透出，内部放金框包裹的品牌卡片 */
.section-menu-left > .box-logo {
  background: transparent;
  padding: 14px 14px 0;
}
/* 侧栏底色变量化（各主题可独立控制） */
.section-menu-left::before { background: var(--sidebar-bg, var(--Primary)); }
/* 侧栏文字在深底上的对比度适配 */
.section-menu-left .menu-item a .icon i,
.section-menu-left .menu-item a .text { color: rgba(255, 255, 255, 0.78); }
.section-menu-left .menu-item a:hover .icon i,
.section-menu-left .menu-item a:hover .text,
.section-menu-left .menu-item .menu-item-button.active .icon i,
.section-menu-left .menu-item .menu-item-button.active .text,
.section-menu-left .menu-item.has-children.active > a i,
.section-menu-left .menu-item.has-children.active > a .text { color: #FFFFFF !important; }
.section-menu-left .sub-menu a .text { color: rgba(255, 255, 255, 0.62); }
.section-menu-left .sub-menu-item a.active .text { color: #FFFFFF !important; }
.section-menu-left .bottom .text-Gray { color: rgba(255, 255, 255, 0.55) !important; }
.section-menu-left .menu-item.has-children::after,
.section-menu-left .menu-item .sub-menu-toggle { color: rgba(255, 255, 255, 0.5); }
.brand-frame {
  border: 2px solid var(--brand-frame);
  border-radius: 8px;
  background: var(--card-bg);
  padding: 12px 14px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.brand-frame .brand-wrap {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold-bar);   /* 品牌与导航标题间金线 */
  margin-bottom: 8px;
}
.brand-frame .menu-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
}
.brand-frame .menu-heading-row .center-heading { margin-bottom: 0; padding: 0; }
.brand-frame .menu-heading-row .button-show-hide { cursor: pointer; }

/* 侧栏内容下移避开加高后的固定品牌区 */
.section-menu-left { padding-top: 168px; }

/* 导航菜单项金色分隔线（逐行划分） */
.section-menu-left .center-item > ul > .menu-item {
  border-bottom: 1px solid var(--border-soft);
}
.section-menu-left .center-item > ul > .menu-item:last-child { border-bottom: none; }

/* 板块间金色横杠（渐变收边） */
.gold-divider {
  height: 3px;
  border: none;
  border-radius: 2px;
  background: linear-gradient(90deg,
      transparent 0%, var(--gold-bar) 8%, var(--gold-bar) 92%, transparent 100%);
  margin: 28px 0;
  opacity: 0.9;
}
/* 主内容区顶层板块之间自动加金色横杠分隔（绝对定位，避免伪元素成为网格子项） */
.tf-container > * + *:not(.modal) { position: relative; }
.tf-container > * + *:not(.modal):not(.gold-divider)::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg,
      transparent 0%, var(--gold-bar) 8%, var(--gold-bar) 92%, transparent 100%);
  opacity: 0.9;
}
.tf-container > .page-head + *::before { display: none; }  /* 标题后第一板块不加 */

/* ============================================================
 * 字体规范（§1.3）
 * ============================================================ */
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif !important;
  color: var(--text-main);
}
h1, h2, h3, h4, h5, h6, .label-01, .label-02, .body-title, .body-title-2 {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
}
.num, .font-mono, td.num, .metric-value {
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}
/* 全局数字加粗（权重/得分/数值一律加粗） */
.num, td.num, th.num, .metric-value, .verify-card .vc-value,
.board-score .bs-value, .weight-bar-row .wb-val,
.factor-cell .factor-score, .gold-suggest .gs-prev, .gold-suggest .gs-strong { font-weight: 700; }
.page-title   { font-size: 24px; font-weight: 700; color: var(--text-main); }
.card-title   { font-size: 16px; font-weight: 700; color: var(--text-main); }
.text-body    { font-size: 14px; }
.text-aux     { font-size: 12px; color: var(--text-sub); }
.metric-value { font-size: 32px; font-weight: 700; color: var(--text-main); }

/* ============================================================
 * 涨跌语义色（§1.2 · A股红涨绿跌，不随主题改变）
 * ============================================================ */
.up, .text-up   { color: var(--up) !important; }
.down, .text-down { color: var(--down) !important; }
.flat, .text-flat { color: var(--text-weak) !important; }
/* 符号/箭头与数字字体统一：加粗、适度放大 */
.up, .down, .flat, .metric-delta, .advice-prev { font-weight: 700; white-space: nowrap; }
/* V8.88-R31 §5.2-2（V-05 兜底）：`.metric-delta` 的 nowrap 是**数字涨跌行**的本意，
   但报告中心把长脚注一并塞进 `.metric-delta` 容器 → 长句不折行、卡片无裁剪 → 文字
   向右溢出被切（截图「…发往跨域失效地」处截断）。此处限定：`.metric-delta` 内的
   `.text-aux` 脚注恢复正常折行（不影响数字行 nowrap 本意），并治愈同页面「核验率」
   卡脚注等同类嵌套。 */
.metric-delta .text-aux { white-space: normal; font-weight: 400; }
.metric-fallback { white-space: normal; font-weight: 400; line-height: 1.6; font-size:12px; }
/* §5.2-3：`.metric-name` 内右侧按钮改 flex 布局（原 float:right 不参与排版，
   窄屏下与标题文字互踩）——标题左、按钮右，间距 8px，超长标题可换行。 */
.metric-name { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* §5.2-1/2：卡片内长脚注不得横向溢出——脚注容器可换行；数字行 nowrap 本意保留。 */
.metric-card { min-height: 120px; }
.up .sym, .down .sym, .flat .sym, .arrow {
  font-weight: 900;
  font-size: 1.5em;
  line-height: 1;
  vertical-align: -0.12em;
  margin-right: 2px;
}
.metric-delta { font-size: 13px; }
.tf-badge { font-weight: 700; }

/* ============================================================
 * 标签 / 徽章（§1.5）
 * ============================================================ */
.tf-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
  color: #FFFFFF;
  white-space: nowrap;
}
.badge-valid   { background: var(--success); }
.badge-watch   { background: var(--warn); }
.badge-invalid { background: #9E9E9E; }
.badge-warn    { background: var(--danger); }
.badge-info    { background: var(--info); }
.badge-gold    { background: var(--brand-gold); color: #1A1A1A; }

/* ============================================================
 * 数据表格（§1.5 · 金色行列网格划分）
 * ============================================================ */
.table-quant {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
}
.table-quant thead th {
  background: var(--bg-light);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border);
  text-align: center;
  /* V8.88-R41（W12④）：删除 white-space:nowrap——表头单元格不再硬裁（报告/表格单元格裁句治理）。 */
}
.table-quant tbody td {
  height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-main);
  text-align: center;
}
.table-quant tbody tr:nth-child(even) { background: var(--table-stripe); }
.table-quant tbody tr:hover { background: var(--table-hover); }
.table-quant td.num, .table-quant th.num { text-align: right; }
.table-quant td.left, .table-quant th.left { text-align: left; }

/* ============================================================
 * 按钮（§1.5：圆角4px、高36px）
 * ============================================================ */
.tf-button { border-radius: 4px !important; min-height: 36px; }
.tf-button.danger  { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
.tf-button:disabled, .tf-button.disabled {
  background: #E0E0E0 !important;
  color: #9E9E9E !important;
  border-color: #E0E0E0 !important;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
 * 数据卡片（§1.5：圆角8px、阴影）
 * ============================================================ */
.wg-box, .wg-card { border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
body[data-theme="dark"] .wg-box, body[data-theme="dark"] .wg-card,
body[data-theme="amber"] .wg-box, body[data-theme="amber"] .wg-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================================
 * 表单控件（§1.5）
 * ============================================================ */
.form-quant input[type="text"],
.form-quant input[type="password"],
.form-quant input[type="email"],
.form-quant input[type="number"],
.form-quant input[type="date"],
.form-quant select,
.form-quant textarea {
  height: 36px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 14px;
  padding: 0 10px;
  width: 100%;
}
.form-quant textarea { height: auto; padding: 8px 10px; }
.form-quant input:focus,
.form-quant select:focus,
.form-quant textarea:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(192, 17, 31, 0.15);
}
.form-quant .field-label {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.form-quant .is-invalid { border-color: var(--danger) !important; }

/* ============================================================
 * 提示 / 通知（§4.7）
 * ============================================================ */
#toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast-item {
  padding: 12px 16px;
  border-radius: 4px;
  color: #FFFFFF;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in 0.3s ease;
}
.toast-item .toast-close {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.8;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 16px;
  line-height: 1;
}
.toast-success { background: var(--success); }
.toast-warning { background: var(--warn); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }
@keyframes toast-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.toast-item.toast-out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }

/* ============================================================
 * V8.88-P8：系统对话框（app.js QDialog 组件消费，替代浏览器原生 confirm/prompt）
 * 设计令牌与 toast/panel 一致：--card-bg 卡片、--border 描边、--brand-red 主按钮
 * ============================================================ */
.qdialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(10, 12, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: qdialog-fade 0.18s ease;
}
.qdialog-overlay.qdialog-out { animation: qdialog-fade-out 0.18s ease forwards; }
@keyframes qdialog-fade     { from { opacity: 0; } to { opacity: 1; } }
@keyframes qdialog-fade-out { to   { opacity: 0; } }
.qdialog {
  width: min(420px, 90vw);
  background: var(--card-bg, #FFFFFF);
  border: 1px solid var(--border-soft, #E5E7EB);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 20px 22px 16px;
  animation: qdialog-pop 0.2s ease;
}
@keyframes qdialog-pop {
  from { transform: translateY(12px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)     scale(1);    opacity: 1; }
}
.qdialog-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #1F1F1F);
  margin-bottom: 10px;
}
.qdialog-msg {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-sub, #666666);
  word-break: break-all;
}
.qdialog-body { margin-top: 12px; }
.qdialog-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border-soft, #E5E7EB);
  border-radius: 6px;
  background: transparent;
  color: var(--text-main, #1F1F1F);
  outline: none;
}
.qdialog-input:focus { border-color: var(--brand-red, #C0111F); }
.qdialog-btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ============================================================
 * V8.89 L4：系统设置-运行日志查看器（settings.js 动态弹窗消费）
 * ============================================================ */
.log-line    { white-space: pre-wrap; word-break: break-all; padding: 1px 0; }
.log-line.log-err  { color: var(--danger); }
.log-line.log-warn { color: var(--warn); }
.log-line.log-dbg  { color: var(--text-weak); opacity: 0.75; }
.log-line.log-info { color: var(--text-main); }
.log-empty   { color: var(--text-weak); padding: 18px 0; text-align: center; }

/* ============================================================
 * 主题切换下拉
 * ============================================================ */
.theme-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  border: 1px solid var(--border-soft);
  vertical-align: middle;
}
.theme-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-sub);
}
.theme-custom-row input[type="color"] {
  width: 28px; height: 22px; border: none; padding: 0; background: none; cursor: pointer;
}
.theme-custom-guide {
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.7;
  font-weight: 700;
  color: var(--text-sub);
  background: rgba(201, 162, 39, 0.08);
  border-left: 3px solid var(--gold-bar);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
  white-space: normal;
  max-width: 300px;
}

/* ============================================================
 * 图表容器
 * ============================================================ */
.chart-box { width: 100%; height: 320px; }
.chart-box.tall { height: 420px; }
.chart-box.short { height: 220px; }

/* ============================================================
 * 品牌区
 * ============================================================ */
.brand-wrap { display: flex; align-items: center; gap: 10px; }
.brand-wrap .brand-logo { width: 40px; height: 40px; border-radius: 8px; }
.brand-wrap .brand-text .brand-system {
  font-size: 15px; font-weight: 700; color: var(--text-main); line-height: 1.3; white-space: nowrap;
}
.brand-wrap .brand-text .brand-owner {
  font-size:12px; color: var(--text-weak); line-height: 1.2; white-space: nowrap;
}

/* ============================================================
 * 全局可见性保障（body overflow-x:hidden 会裁剪越界内容 ——
 * 任何块级内容不得横向超出视口，超宽内容一律经滚动容器查看）
 * ============================================================ */
.main-content, .main-content-inner, .main-content-wrap,
.section-content-right, .tf-container,
.metric-grid, .row-2col, .row-2col-3-2, .row-2col-2-3,
.dual-board, .verify-grid, .filter-bar, .cycle-tabs, .factor-tags {
  min-width: 0;
  max-width: 100%;
}
.tf-container { overflow-wrap: break-word; word-break: break-word; }
.panel, .metric-card, .verify-card { min-width: 0; }
.chart-box, .table-scroll, .modal-dialog { max-width: 100%; }
.table-quant td, .table-quant th { max-width: 420px; }
img { max-width: 100%; height: auto; }

/* ============================================================
 * 响应式微调
 * ============================================================ */
@media (max-width: 767px) {
  .metric-value { font-size: 24px; }
  .chart-box { height: 260px; }
  .table-quant thead th, .table-quant tbody td { padding: 0 8px; font-size: 13px; }
  .brand-frame { margin: 0 8px 10px; }
}

/* ============================================================
 * V8.88-P13 手机端登录/表单可用性修复
 * 1) iOS Safari 对 font-size < 16px 的输入框聚焦时强制放大页面，
 *    原 .form-quant 控件 14px → 手机登录输密码页面被顶歪，改完还要捏回来
 *    （配合 viewport 去掉 maximum-scale 后体验闭环）。
 * 2) 触控目标 ≥44px（Apple HIG / 44×44 惯例），侧栏菜单按钮同步放大。
 * ============================================================ */
@media (max-width: 767px) {
  .form-quant input[type="text"],
  .form-quant input[type="password"],
  .form-quant input[type="email"],
  .form-quant input[type="number"],
  .form-quant input[type="date"],
  .form-quant select {
    font-size: 16px;
    height: 44px;
  }
  .form-quant textarea { font-size: 16px; }
  .header-dashboard .button-show-hide {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .login-card { padding: 28px 20px 20px; }
}

/* ===== V8.88-R13-F1 行业打分可解释性（证据面板 / 置信度点 / 无输入格 / 名次 / 警示标记） ===== */
.ev-panel { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border-soft);
            border-left: 3px solid var(--brand-red); border-radius: 6px;
            background: var(--bg-light); font-size: 12px; line-height: 1.7; color: var(--text-sub); }
.ev-panel .ev-sum { font-weight: 600; color: var(--text-main); }
.ev-panel .ev-warn { color: var(--danger); font-weight: 600; margin-top: 2px; }
.ev-panel .ev-ok { color: var(--success); }
.ev-panel .ev-note { color: var(--text-weak); margin-top: 2px; }
.ev-panel ul { margin: 2px 0 0 18px; padding: 0; }
.factor-cell .factor-score.na { color: var(--text-weak); font-weight: 600; }
.conf-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%;
            margin: 0 0 0 3px; vertical-align: 6px; }
.conf-dot.high { background: var(--success); }
.conf-dot.mid { background: var(--warning); }
.conf-dot.low { background: var(--text-weak); }
.rk { color: var(--text-weak); font-weight: 400; font-size:12px; }
.adv-flag { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px;
            font-size:12px; font-weight: 600; background: var(--bg-light); color: var(--text-sub);
            border: 1px solid var(--border-soft); }
.adv-flag.warn { color: var(--danger); border-color: var(--danger); }
/* V8.88-R13：词典页「真值 / 派生」徽章色
   V8.88-R46（升级清单 §7）：代理族已全系统删除，注释同步收敛。 */
.badge-ok      { background: var(--success); }
.badge-neutral { background: var(--text-weak); }

/* ============================================================
 * 因子实验室 v3.4 集成层 Token（R36 UI 融合修复）
 * 背景：factor-lab-v2.css 自独立原型迁入时，其引用的 23 个几何/
 * 排版/记忆徽章 token 从未随迁 → var() 全部失效（工作台高度、
 * 圆角、阴影、间距、字号、focus 环、记忆七态圆点色全哑）。
 * 依据「单一 Token 体系」铁律统一补进 theme.css（不新建配色体系）；
 * 因子实验室样式已全部作用域化（#flRoot），本组 token 仅供其消费。
 * ============================================================ */
:root {
  /* 几何：工作台标签条高度 / 顶栏高度（= .header-dashboard 实际占位，
     供 workbar sticky top 与内部面板高度计算对齐） */
  --work-h: 46px;
  --fl-header-h: 84px;
  /* 圆角三档 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  /* 间距两档 */
  --space-3: 12px;
  --space-4: 16px;
  /* 排版四档（caption/body/sub/title） */
  --type-caption: 11.5px;
  --type-body: 13px;
  --type-sub: 14px;
  --type-title: 15px;
  /* 阴影与焦点环（浅色主题基调） */
  --shadow-card: 0 1px 4px rgba(26, 20, 14, 0.06);
  --shadow-pop: 0 8px 28px rgba(26, 20, 14, 0.18);
  --focus-ring: 0 0 0 2px rgba(192, 17, 31, 0.16);
  /* 记忆徽章七态（L1/L2/L3 缓存状态圆点，语义色字面值，深浅底均可辨） */
  --mem-live: #2E7D32;    /* L2 真值·新鲜 */
  --mem-warm: #C9A227;    /* L1 内存·热 */
  --mem-stale: #FB8C00;   /* 真值·陈旧 */
  --mem-cold: #9E9E9E;    /* 需联网 */
  --mem-flight: #1E88E5;  /* 单飞排队中 */
  --mem-pit: #9C27B0;     /* PIT 滞后 */
  --mem-fail: #B71C1C;    /* 拉取失败 */
}
/* 深色主题：七态圆点提亮（对齐 theme.css 既有 dark 块 --up/--down 提亮策略），阴影加深 */
body[data-theme="dark"] {
  --mem-live: #66BB6A;
  --mem-warm: #FFD54F;
  --mem-stale: #FFB74D;
  --mem-cold: #8A8A94;
  --mem-flight: #64B5F6;
  --mem-pit: #CE93D8;
  --mem-fail: #EF5350;
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.40);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55);
}
/* Bloomberg 琥珀（黑底）：阴影同深色处理 */
body[data-theme="amber"] {
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.40);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55);
}
