/* 短线情绪周期管理系统 —— 浅底研报风 */
:root {
  --bg: #e9eef5;
  --bg-top: #f5f8fc;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #d9e0ea;
  --line-2: #e8edf3;
  --text: #1c2430;
  --text-2: #5b6879;
  --text-3: #93a0b1;
  --accent: #1f6feb;
  --accent-soft: #e6f0ff;
  --red: #d9423a;
  --green: #0f9d63;
  --head: #2f7ed8;
  --head-2: #eaf2fd;
  /* 顶栏（深色导航）配色 */
  --nav-1: #16273f;
  --nav-2: #22395d;
  --nav-3: #2b4670;
  --nav-line: #ff7a45;
  --nav-text: rgba(255, 255, 255, .72);
  --nav-text-on: #ffffff;
  --nav-hover: rgba(255, 255, 255, .10);
  --nav-active: rgba(255, 255, 255, .16);
  /* 周期矩阵表头：蓝底 + 淡蓝亮色描边 + 白色标题字 */
  --mx-head-bg: #2f7ed8;
  --mx-head-bg-2: #3789e2;
  --mx-head-line: #8ec6f9;
  --mx-head-text: #ffffff;
  --shadow: 0 1px 2px rgba(24, 39, 75, .05), 0 8px 22px rgba(24, 39, 75, .07);
  --radius: 10px;
  --row-h: 31px;
  /* 底部版权页脚高度（fixed 悬浮，分组页卡片据此留出让位空间） */
  --footer-h: 30px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-top) 0, #eaf0f7 240px, var(--bg) 620px);
  background-repeat: no-repeat;
  color: var(--text);
  font: 13px/1.5 "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 滚动条：细而柔和，接近专业客户端观感 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #e9eef5; }
::-webkit-scrollbar-thumb { background: #c2cfe0; border-radius: 6px; border: 2px solid #e9eef5; }
::-webkit-scrollbar-thumb:hover { background: #a6b7cf; }
::-webkit-scrollbar-corner { background: #e9eef5; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------------------------------------------------------------- 布局 */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* 顶栏：深色渐变 + 底部品牌色高亮线，专业金融终端观感 */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 18px; height: 54px; flex: 0 0 auto;
  background: linear-gradient(90deg, var(--nav-1) 0%, var(--nav-2) 58%, var(--nav-3) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  box-shadow: inset 0 -2px 0 0 var(--nav-line), 0 6px 20px rgba(15, 26, 45, .16);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 700; letter-spacing: .6px; margin-left: auto;
  color: var(--nav-text-on);
}
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }
.brand .logo { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand .logo svg { width: 26px; height: 26px; display: block; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .3)); }
.brand .brand-text { white-space: nowrap; }
.brand small { font-weight: 400; color: var(--text-3); font-size: 12px; }

/* 菜单：胶囊 + 底部指示条 */
.tabs { display: flex; gap: 2px; margin-left: 0; align-items: center; }
.tabs button {
  position: relative;
  border: 1px solid transparent; background: transparent; color: var(--nav-text);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; letter-spacing: .4px;
  transition: background .16s ease, color .16s ease;
}
.tabs button:hover { background: var(--nav-hover); color: #fff; }
.tabs button.on { background: var(--nav-active); border-color: transparent; color: var(--nav-text-on); }
.tabs button.on::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: 3px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, #ffb08a, var(--nav-line));
}

/* ------------------------------------------------ 登录按钮（顶栏菜单右侧） */
.topbar .auth-btn {
  margin-left: 14px; padding: 7px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .34); background: rgba(255, 255, 255, .10);
  color: #fff; font-weight: 600; font-size: 13px; letter-spacing: .3px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .16s ease, border-color .16s ease;
}
.topbar .auth-btn:hover { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .6); }
.topbar .auth-btn.on { background: rgba(46, 190, 118, .24); border-color: rgba(130, 235, 180, .65); color: #dcffec; }

/* 游客只读：写类按钮弱化，提示需先登录 */
body.guest .btn.danger { opacity: .55; }
body.guest #btnAddRecord,
body.guest #btnNewRecord,
body.guest #btnAddGroup,
body.guest #btnAddDivider,
body.guest #btnPaste { opacity: .72; }
/* 游客只读：表格内编辑控件置灰 + 顶部只读提示 */
/* !important：名称颜色等处用内联 style 上了色，普通规则盖不过内联样式 */
body.guest #rgTable input:disabled,
body.guest #rgTable select:disabled { background: #f4f5f7; color: #9aa0a6 !important; opacity: .72; cursor: not-allowed; }
body.guest #view-settings input:disabled,
body.guest #view-settings select:disabled { background: #f4f5f7; color: #9aa0a6; opacity: .72; cursor: not-allowed; }
.ro-tip { color: #c2410c; font-weight: 700; }

/* 登录弹窗 */
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input[type=text],
.auth-form input[type=password] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; color: var(--text); background: #fff;
}
.auth-form input[type=text]:focus,
.auth-form input[type=password]:focus { outline: 2px solid rgba(43, 122, 239, .35); border-color: #2b7aef; }
.auth-remember { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.auth-tip { font-size: 12px; color: var(--text-3); min-height: 16px; line-height: 1.5; }
.auth-tip.err { color: var(--red); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; }

main { flex: 1 1 auto; overflow: hidden; position: relative; }

/* ---------------------------------------------------------------- 页脚版权条 */
/* 固定在窗口最底部（悬浮），不挤占 main 的可视高度：
   矩阵/按日期等页 .view 底部本就留 5% 空白（≈38px @900h）足以容纳 30px 页脚；
   分组页卡片改用 0.96 系数（见下）保证底边不被页脚压住。 */
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  height: var(--footer-h, 30px); line-height: var(--footer-h, 30px);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #7d8a9c; letter-spacing: .3px; white-space: nowrap;
  background: linear-gradient(180deg, #eef2f8, #e5ebf4);
  border-top: 1px solid var(--line);
  user-select: none;
}
/* 页脚右侧状态栏：登录态/保存中/已保存等反馈（store.js setStatus 写入） */
.site-footer .status { position: absolute; right: 14px; top: 0; bottom: 0;
  line-height: var(--footer-h, 30px); font-size: 12px; color: #7d8a9c; letter-spacing: .3px; }
.site-footer .status.ok { color: #2e9e5b; }
.site-footer .status.saving { color: #1f4e79; font-weight: 600; }
.site-footer .status.err { color: #d9423a; font-weight: 600; }
/* 界面最底部保留 5% 空白，表格不贴窗口底边，观感更舒适 */
.view { position: absolute; left: 0; right: 0; top: 0; bottom: 5%; display: none; flex-direction: column; }
.view.on { display: flex; }

/* 通用件 */
.btn {
  border: 1px solid var(--line); background: linear-gradient(180deg, #ffffff, #fbfcfe); border-radius: 7px;
  padding: 5px 11px; color: var(--text-2); font-weight: 600;
  transition: background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.btn:hover { border-color: #b9c6d8; background: #f5f8fc; color: var(--text); }
.btn:active { background: #eef3fa; }
.btn:focus-visible { outline: 2px solid #cfe0ff; outline-offset: 1px; }
.btn.primary { background: linear-gradient(180deg, #2b7aef, #1f6feb); border-color: #1f6feb; color: #fff; }
/* 两个主操作按钮（日期【查询】/【＋短线股票】）等宽：对齐且更显眼 */
#btnApplyRange, #btnExportMatrix, #btnAddRecord { min-width: 93px; text-align: center; justify-content: center; }
/* 时间轴缩放档位（日 / 紧凑 / 月） */
.seg { display: inline-flex; vertical-align: middle; }
.seg .btn { padding: 3px 10px; font-size: 12px; border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; }
.seg .btn.active { background: linear-gradient(180deg, #2b7aef, #1f6feb); border-color: #1f6feb; color: #fff; z-index: 1; }
.btn.primary:hover { background: linear-gradient(180deg, #2f80f3, #1a61d0); border-color: #1a61d0; color: #fff; }
.btn.danger { color: var(--red); border-color: #f0c6c3; }
.btn.danger:hover { background: #fdf2f1; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 12px; border-radius: 6px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--text-3); font-weight: 600; }
/* 输入代码后自动带出名称的状态提示 */
.fm-tip { font-size: 11px; line-height: 1.4; color: var(--text-3); }
.fm-tip.loading { color: #1f4e79; }
.fm-tip.ok { color: #256f43; }
.fm-tip.err { color: #c0392b; }
input[type=text], input[type=date], input[type=number], select, textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: #fff; min-width: 0;
}
/* 多行文本框（登记弹窗「备注」）：可纵向拉伸，默认 3 行 */
.field textarea { resize: vertical; min-height: 62px; line-height: 1.55; }
input[type=text]:focus, input[type=date]:focus, select:focus, textarea:focus { outline: 2px solid #cfe0ff; border-color: var(--accent); }

.toolbar {
  flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(24, 39, 75, .04);
}
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.toolbar .spacer { flex: 1 1 auto; }
.toolbar .tb-group { display: flex; align-items: center; gap: 6px; }
.toolbar .tb-group.compact { gap: 12px; flex-wrap: wrap; }
.hint { color: var(--text-3); font-size: 12px; }

/* 两行式工具栏：第一行查询/筛选，第二行操作按钮 */
.toolbar.stacked { flex-direction: column; align-items: stretch; gap: 6px; padding: 7px 14px; }
.toolbar.stacked .tb-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-right: 76px; }
.toolbar.stacked .tb-row + .tb-row { padding-top: 5px; border-top: 1px dashed var(--line-2); }
.toolbar .tb-label { font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.toolbar .hint.ck { display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; user-select: none; }
.toolbar .hint.ck input { cursor: pointer; }

/* 工具栏折叠：按钮常驻右上角，收起后只留一条窄条 */
.toolbar.stacked { position: relative; }
.toolbar .bar-toggle { position: absolute; right: 10px; top: 7px; z-index: 3; padding: 2px 10px; font-size: 12px; color: var(--text-2); }
.toolbar.stacked.collapsed .tb-row { display: none; }
.toolbar.stacked.collapsed { gap: 0; padding: 6px 14px; min-height: 32px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.scroll { overflow: auto; }
.body-pad { padding: 14px; }

.tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: #eef2f8; color: var(--text-2); font-size: 11px; margin-right: 4px; }
.tag.red { background: #fdecea; color: var(--red); }
.tag.blue { background: var(--accent-soft); color: var(--accent); }
.kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 11px; color: var(--text-3); background: #fff; }

/* ---------------------------------------------------------------- 矩阵看板 */
.mx-wrap { flex: 1 1 auto; overflow: auto; background: var(--panel); position: relative; }
table.mx { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
table.mx th, table.mx td {
  height: var(--row-h); padding: 0 4px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; vertical-align: middle;
}
table.mx thead th { background: var(--head-2); color: #24435f; font-weight: 700; text-align: center; position: sticky; z-index: 5; }
table.mx thead tr:nth-child(1) th { top: 0; }
table.mx thead tr:nth-child(2) th { top: var(--row-h); }
/* 左侧 8 个固定列标题（周期名称→高度）：蓝底 + 淡蓝亮色描边 + 白字 */
table.mx thead th.leftcol {
  background: var(--mx-head-bg);
  color: var(--mx-head-text);
  border-right: 1px solid var(--mx-head-line);
  border-bottom: 1px solid var(--mx-head-line);
}
/* 表头（含左侧固定列）全部居中 */
table.mx thead th.leftcol { text-align: center; padding-left: 4px; }
table.mx thead th.leftcol.th-gl { text-align: center; padding-left: 4px; }
table.mx tbody td.leftcol, table.mx tbody td.gl { position: sticky; z-index: 3; background: #fff; }
table.mx thead th.leftcol { z-index: 7; }
table.mx td.gl { text-align: center; font-weight: 700; color: #2b3a4d; padding: 4px 6px; white-space: normal; line-height: 1.25; }
table.mx td.gl.divider, table.mx tr.divider td.leftcol { background: #A3FFA5; }
table.mx tr.divider td.gl.divider { background: #A3FFA5; }
table.mx tr.gsep td { border-top: 2px solid var(--head); }
/* 末尾自动空行：仅占位展示，无交互、无 hover 高亮 */
table.mx tbody tr.blankrow td { background: #fff; }
table.mx tbody tr.blankrow td.dc { cursor: default; }
table.mx tbody tr.blankrow td.dc:hover { box-shadow: none; }
table.mx tbody tr.blankrow td.leftcol { cursor: default; }
table.mx tbody tr:hover td.leftcol { background: #f8fbff; }
table.mx tbody tr.blankrow:hover td.leftcol { background: #fff; }
table.mx tbody tr.sel td.leftcol { background: var(--accent-soft); }
/* 空记录（代码与名称都留空）：在本周期内只起上下分割作用，整行留白、淡灰底 */
table.mx tbody tr.emptyrow td { background: #f6f7f9; }
table.mx tbody tr.emptyrow:hover td.leftcol { background: #f6f7f9; }
table.mx tbody tr.emptyrow td.dc:hover { box-shadow: none; }

.th-date { font-size: 10px; font-weight: 700; letter-spacing: 0; padding: 0 1px !important; }
.th-date.wk0 { background: #F0A02A; color: #3a2600; border-color: #d98c1a; }
.th-date.wk1 { background: #3FA45B; color: #ffffff; border-color: #338a4c; }
.th-wd { font-size: 10px; color: #40566e; background: #eef4fb; padding: 0 1px !important; }
th.leftcol { font-size: 11px; padding: 0 6px !important; }

table.mx td.dc { position: relative; padding: 0; text-align: center; cursor: cell; overflow: visible; }
table.mx td.dc .bg { position: absolute; inset: 0; }
/* 连续横条：整段只画一条，覆盖中间格线，两端圆角内收 1px */
table.mx td.dc .bg.bar { inset: auto; left: 1px; top: 3px; bottom: 3px; z-index: 1;
  border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.14); }
table.mx td.dc.bar-cell .bg.bar { cursor: grab; }
table.mx td.dc .bg.bar .blabel { left: 0; right: 0; }
/* 细列档（紧凑/月）：条内文字裁切不溢出，字号略收 */
table.mx td.dc .bg.bar.tight .blabel { overflow: hidden; text-overflow: ellipsis; font-size: 10px; padding: 0 4px; }
table.mx td.dc .bg.bar.tight .blabel.calign { justify-content: center; }
table.mx td.dc .mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #1b2a3a; overflow: hidden; }
table.mx td.dc .blabel { position: absolute; left: 0; top: 0; bottom: 0; display: flex; align-items: center;
  font-size: 11px; font-weight: 700; color: #3a2a00; white-space: nowrap; pointer-events: none; z-index: 2; }
table.mx td.dc .blabel.calign { justify-content: center; }
table.mx td.dc .blabel.lalign { justify-content: flex-start; padding-left: 5px; width: auto; }
td.dc.bar-start { border-left: 1px solid rgba(0,0,0,.14); }
td.dc.bar-end { border-right: 1px solid rgba(0,0,0,.14); }
/* 周期条可拖动 */
table.mx td.dc.bar-cell .bg { cursor: grab; }

/* ---------- 跨周期演进连线：同名标的「上一段末端 → 下一段起点」---------- */
.mx-evo { position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; overflow: visible; }
.mx-evo .evo-link { pointer-events: none; }
/* 点线只有 1.4px，垫一条 14px 的透明粗线专门用来 hover / 命中（否则鼠标根本挨不上） */
.mx-evo .evo-hit { fill: none; stroke: transparent; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; }
/* 细点线主线 + 白色底衬（压在周期条上仍看得清）+ 小实心箭头（尖端停在方框边线上） */
.mx-evo .evo-halo { fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.mx-evo .evo-line { fill: none; stroke: var(--evo-c, #7b5ea7); stroke-width: 1.4; stroke-dasharray: .1 4.2; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.mx-evo .evo-arrow { fill: var(--evo-c, #7b5ea7); stroke: #fff; stroke-width: .9; stroke-linejoin: round; opacity: 1; }
.mx-evo .evo-dot { fill: var(--evo-c, #7b5ea7); stroke: #fff; stroke-width: .9; }
.mx-evo .evo-link:hover .evo-halo { stroke-width: 4.6; opacity: .92; }
.mx-evo .evo-link:hover .evo-line { stroke: #d9423a; stroke-dasharray: none; stroke-width: 2; opacity: 1; }
.mx-evo .evo-link:hover .evo-arrow { fill: #d9423a; }
.mx-evo .evo-link:hover .evo-dot { fill: #d9423a; }
/* 悬停才出现的删除按钮（自动线＝拉黑，手动线＝删除） */
.mx-evo .evo-del { opacity: 0; pointer-events: none; }
.mx-evo .evo-link:hover .evo-del { opacity: 1; pointer-events: auto; cursor: pointer; }
.mx-evo .evo-del-bg { fill: #fff; stroke: #d9423a; stroke-width: 1.2; }
.mx-evo .evo-del-x { fill: none; stroke: #d9423a; stroke-width: 1.6; stroke-linecap: round; }
.mx-evo .evo-del:hover .evo-del-bg { fill: #d9423a; }
.mx-evo .evo-del:hover .evo-del-x { stroke: #fff; }
/* 手动拖拽生成的连线：点距更密一点，配合暗蓝色与自动线区分 */
.mx-evo .evo-manual .evo-line { stroke-dasharray: .1 3.4; }
/* 两端手柄：hover 出现，按住可把这一端拖到别的日期格（换格 / 换边都行） */
.mx-evo .evo-knob { fill: #fff; stroke: var(--evo-c, #1f4e79); stroke-width: 1.4; opacity: 0; pointer-events: none; }
.mx-evo .evo-link:hover .evo-knob { opacity: 1; pointer-events: all; cursor: grab; }
.mx-evo .evo-knob:hover { fill: var(--evo-c, #1f4e79); stroke: #fff; }
/* 拖拽过程中的预览线（单独一层，不参与连线统计）。
   注意：SVG 根元素的 pointer-events:none 管不住内部图元，必须连子元素一起关掉，
   否则预览线会挡住鼠标、导致 mousemove 命中不到下面的日期格。 */
.mx-evo-preview, .mx-evo-preview * { pointer-events: none; }
.mx-evo-preview { position: absolute; left: 0; top: 0; z-index: 3; overflow: visible; }
/* 连线模式下已有连线同样完全让路，保证拖拽全程命中的都是日期格 */
#mxWrap.linkmode .mx-evo, #mxWrap.linkmode .mx-evo * { pointer-events: none; }
/* 拖动已有连线端点时同样让路：连线层不挡命中、周期条不抢 mousedown、目标格高亮 */
#mxWrap.linkdrag .mx-evo, #mxWrap.linkdrag .mx-evo * { pointer-events: none; }
#mxWrap.linkdrag table.mx td.dc { cursor: grabbing; }
#mxWrap.linkdrag table.mx td.dc:hover::after {
  content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  border: 2px solid #1f4e79; box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
}
#mxWrap.linkdrag table.mx td.dc .bg.bar,
#mxWrap.linkdrag table.mx td.dc .bar-handle { pointer-events: none; }
.mx-evo-preview .evo-preview-line { fill: none; stroke: #1f4e79; stroke-width: 1.8; stroke-dasharray: 5 3; stroke-linejoin: round; opacity: .9; }
.mx-evo-preview .evo-preview-dot { fill: #1f4e79; stroke: #fff; stroke-width: 1; }
.mx-evo-preview .evo-preview-arrow { fill: #1f4e79; stroke: #fff; stroke-width: .9; stroke-linejoin: round; }
/* 「画连线」模式：十字光标 + 格子描边高亮 + 屏蔽周期条拖拽（避免抢走 mousedown）
   （用法说明不再用常驻提示条，改挂在按钮 title 上，见 index.html #mxLink） */
#mxWrap.linkmode table.mx td.dc { cursor: crosshair; }
#mxWrap.linkmode table.mx td.dc:hover::after {
  content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  border: 2px solid #1f4e79; box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
}
#mxWrap.linkmode table.mx td.dc .bg.bar,
#mxWrap.linkmode table.mx td.dc .bar-handle { pointer-events: none; }
#mxLink.active { background: linear-gradient(180deg, #2b7aef, #1f6feb); border-color: #1f6feb; color: #fff; }
/* 拖动周期条时不挡手、连线淡出 */
table.mx.dragging ~ .mx-evo { pointer-events: none; opacity: .28; }
table.mx td.dc.bar-cell .bar-handle {
  position: absolute; top: 0; bottom: 0; width: 7px; z-index: 3;
  cursor: ew-resize; background: rgba(36,67,95,.0); transition: background .12s; }
table.mx td.dc.bar-cell .bar-handle.left { left: 0; border-left: 2px solid rgba(36,67,95,.55); border-radius: 3px 0 0 3px; }
table.mx td.dc.bar-cell .bar-handle.right { right: 0; border-right: 2px solid rgba(36,67,95,.55); border-radius: 0 3px 3px 0; }
table.mx td.dc.bar-cell:hover .bar-handle { background: rgba(36,67,95,.18); }
table.mx td.dc.bar-cell .bar-handle:hover { background: rgba(217,66,58,.32); }

/* ---------- 周期矩阵「导出 Excel」弹窗 ---------- */
.mx-exp { display: flex; flex-direction: column; gap: 8px; }
.mx-exp-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mx-exp-bar .spacer { flex: 1 1 auto; }
.mx-exp-stat { font-size: 12px; color: var(--text-2); font-weight: 600; }
.mx-exp-grp { font-size: 12px; font-weight: 700; color: var(--text-3); padding-top: 2px; }
.mx-exp-cols {
  display: flex; flex-wrap: wrap; gap: 4px 10px; max-height: 190px; overflow: auto;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe;
}
.mx-exp-ck { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text); cursor: pointer; user-select: none; }
.mx-exp-ck input { cursor: pointer; margin: 0; }
.mx-exp-ck.isdate { min-width: 96px; }
.mx-exp-ck .wd { color: var(--text-3); font-size: 11px; }
.mx-exp-prev { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.mx-exp-grid { border-collapse: collapse; font-size: 12px; width: max-content; min-width: 100%; }
.mx-exp-grid th, .mx-exp-grid td { border: 1px solid var(--line-2); padding: 3px 7px; white-space: nowrap; }
.mx-exp-grid th { position: sticky; top: 0; z-index: 1; background: #e8f0fa; color: #1f4e79; font-weight: 700; }
.mx-exp-grid td { color: var(--text-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.mx-exp-grid td:empty::after { content: '·'; color: #c7cfda; }
.mx-exp-grid .empty-hint { color: var(--text-3); padding: 10px 12px; }
table.mx.dragging, table.mx.dragging * { user-select: none; }
/* 拖拽预览高亮 */
td.dc.bar-preview { box-shadow: inset 0 0 0 2px var(--red); background: rgba(217,66,58,.10); }
td.dc.bar-preview-start { box-shadow: inset 3px 0 0 0 var(--red); }
td.dc.bar-preview-end { box-shadow: inset -3px 0 0 0 var(--red); }
.bar-drag-tip {
  background: #1b2a3a; color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.28); white-space: nowrap; pointer-events: none; }
.bar-drag-tip b { color: #ffd45e; }
td.dc:hover { box-shadow: inset 0 0 0 2px var(--accent); }
td.dc.marked::after { content: ''; position: absolute; right: 2px; top: 2px; width: 4px; height: 4px; border-radius: 50%; background: #24435f; opacity: .55; }
td.namecell { font-weight: 700; cursor: pointer; }
td.namecell.red { color: var(--red); }
/* 名称颜色：红 / 暗黄 / 淡黄 / 暗蓝 / 深绿 / 淡绿 */
.ns-red, td.namecell.ns-red { color: #d9423a; }
.ns-amber, td.namecell.ns-amber { color: #b8860b; }
.ns-yellow, td.namecell.ns-yellow { color: #e0a11b; }
.ns-blue, td.namecell.ns-blue { color: #1f4e79; }
.ns-green, td.namecell.ns-green { color: #0f7b3f; }
.ns-lgreen, td.namecell.ns-lgreen { color: #3cb371; }
/* 短线股票页：名称颜色下拉（选中项即显示对应色） */
select.ns-pick { width: 92px; font-weight: 700; }
select.ns-pick option[value="red"] { color: #d9423a; }
select.ns-pick option[value="amber"] { color: #b8860b; }
select.ns-pick option[value="yellow"] { color: #e0a11b; }
select.ns-pick option[value="blue"] { color: #1f4e79; }
select.ns-pick option[value="green"] { color: #0f7b3f; }
select.ns-pick option[value="lgreen"] { color: #3cb371; }
td.datecell { color: var(--text-2); font-variant-numeric: tabular-nums; }
td.midcell { text-align: center; color: var(--text-2); }
td.htcell { text-align: center; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
/* 高度列为 '-'（无实际板数）→ 绿色，弱化显示；负值（如 -20%）→ 绿色加粗 */
td.htcell.ht-dash { color: var(--green); font-weight: 400; }
td.htcell.ht-neg { color: var(--green); }
td.typecell { text-align: center; color: var(--text-2); }
td.nodetype { color: #6b4b00; background: #fffaf0 !important; }
td.cyccell { color: var(--text); font-weight: 600; }

/* 行尾快捷操作 */
.rowmenu {
  /* z-index 95：高于 fixed 页脚(90)、低于弹窗遮罩(100)，保证菜单不被页脚盖住点不到 */
  position: absolute; z-index: 95; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); padding: 4px; min-width: 132px;
}
.rowmenu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; color: var(--text-2); }
.rowmenu button:hover { background: #f0f5fc; color: var(--text); }

/* 单元格编辑器 */
.celled {
  position: absolute; z-index: 40; width: 262px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(20, 35, 60, .18); padding: 10px;
}
.celled .hd { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.celled .hd b { color: var(--text); }
.swatches { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.swatches button { width: 24px; height: 24px; border-radius: 6px; border: 2px solid #cfd8e4; }
.swatches button.on { border-color: var(--accent); box-shadow: 0 0 0 2px #cfe0ff; }
.quickwords { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
/* 高度档位 1B-5B 与前面的情绪状态词之间加一条分隔线 */
.quickwords .qw-sep { width: 1px; height: 16px; background: #cfd8e4; margin: 0 3px; flex: none; }
.quickwords .hw { color: var(--text-2); }
.celled .ops { display: flex; gap: 6px; justify-content: flex-end; }


/* ---- 连板高度梯队 ---- */
.ladder-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.ladder-row { display: flex; align-items: stretch; gap: 10px; }
.ladder-tier { flex: 0 0 64px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #d9423a; background: #fff4f3; border: 1px solid #f3d2cf; border-radius: 8px; }
.ladder-tier.top { color: #fff; background: #d9423a; border-color: #d9423a; }
.ladder-items { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ladder-tag { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.ladder-empty { color: var(--text-3); }
.kpi.down .kpi-v { color: #0f9d63; }

/* ---- 周期分组管理 ---- */
/* 列表区：分组页去掉全局 5% 底部留白，卡片高度 = （可视区 - 18px）× 96%，内部表格自行滚动。
   0.96（而非 0.98）是为了让卡片底边让开固定在窗口底部的版权页脚（30px）。 */
#view-groups { bottom: 0; }
#view-groups > .scroll { flex: 1 1 0; min-height: 0; padding: 0 14px 6px; }
/* 下移 2%（约等于卡片高度的 2%，用 vh 保证随窗口等比缩放；margin 的百分比按宽度解析会过量，勿用 %） */
.gm-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: stretch; margin-top: 1.5vh; height: calc((100% - 18px) * 0.96); }
.gm-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.gm-card.gm-list { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.gm-card > .hd {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; flex: 0 0 auto;
  background: var(--panel-2); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px;
}
.gm-card > .bd { flex: 1 1 0; min-height: 0; max-height: none; overflow: auto; }
.gm-empty { padding: 30px 16px; text-align: center; color: var(--text-3); }
table.gm td.center { text-align: center; }
table.gm td.name { white-space: pre-line; font-weight: 700; color: #2b3a4d; line-height: 1.3; }
table.gm tr.divider td.name { color: #0b6b3a; }
table.gm td.cyc { font-weight: 600; }
table.gm td.code { color: var(--text-2); font-family: Consolas, monospace; }
table.gm td.nm { font-weight: 700; }
table.gm td.ht { text-align: center; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; }
table.gm td.date { color: var(--text-2); font-size: 11px; }
table.gm td.note { color: var(--text-2); font-size: 11px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.gm tbody tr.gm-row:hover td { background: #f8fbff; }
table.gm tbody tr.gm-row.divider:hover td { background: #f3fbf6; }
.tag.green { background: #e6f7ec; color: #0f7a44; }

/* 图例 */
.legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--text-2); font-size: 12px; }
.legend i { display: inline-block; width: 14px; height: 12px; border: 1px solid #b9c4d2; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---------------------------------------------------------------- 表格 */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th, table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; font-size: 12px; }
table.grid thead th { position: sticky; top: 0; background: var(--head-2); color: #24435f; z-index: 2; }
table.grid tbody tr:hover td { background: #f8fbff; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--text-3); }

/* ---------------------------------------------------------------- 按日期查看 */
.datechips {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  border-bottom: 1px solid var(--line);
}
.datechips button {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; min-width: 62px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.15;
}
.datechips button b { font-size: 12px; }
.datechips button span { font-size: 10px; color: var(--text-3); }
.datechips button.on { border-color: var(--accent); background: var(--accent-soft); }
.datechips button.on span { color: var(--accent); }
.datechips button.wk0 { border-top: 3px solid #F0A02A; }
.datechips button.wk1 { border-top: 3px solid #3FA45B; }

.daygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 10px; }
.daycard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); }
.daycard h5 { margin: 0 0 6px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.daycard h5 .h { color: var(--red); font-weight: 800; }
.daycard .meta { color: var(--text-3); font-size: 11px; margin-bottom: 8px; }
.daycard .mine { display: flex; flex-wrap: wrap; gap: 4px; }
.daycard .mine button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 7px; font-size: 11px; }
.daycard .mine button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi { background: linear-gradient(180deg, #ffffff, #fbfcfe); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; min-width: 108px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 20px; line-height: 1.2; }
.kpi span { color: var(--text-3); font-size: 11px; }
.kpi.up b { color: var(--red); }
.kpi.down b { color: var(--green); }

/* ---------------------------------------------------------------- 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(20, 32, 52, .38); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; box-shadow: 0 24px 60px rgba(15, 28, 50, .3); width: 720px; max-width: 100%; display: flex; flex-direction: column; overflow: hidden; }
.modal header {
  position: relative;
  flex: 0 0 auto; display: flex; align-items: center; gap: 2px; padding: 10px 12px 10px 18px;
  background: linear-gradient(180deg, #f9fbfd, #f1f5fa);
  border-bottom: 1px solid var(--line); font-weight: 700; cursor: move; user-select: none;
}
.modal header::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, #ff8a5c, #e8493c);
}
.modal header .mtitle { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal header .win-btn { margin-left: auto; border: 1px solid var(--line); background: #fff; width: 24px; height: 22px; border-radius: 5px; font-size: 12px; line-height: 1; color: var(--text-2); }
.modal header .win-btn + .win-btn { margin-left: 4px; }
.modal header .win-btn:hover { background: var(--panel-2); color: var(--text); }
.modal header .x { margin-left: 6px; border: 0; background: transparent; font-size: 18px; color: var(--text-3); }
.modal .content { flex: 1 1 auto; padding: 16px; max-height: 70vh; overflow: auto; }
.modal footer { flex: 0 0 auto; display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel-2); }
.modal .rz-handle { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 0 46%, var(--text-3) 46% 54%, transparent 54% 70%, var(--text-3) 70% 78%, transparent 78%); opacity: .65; }
.modal .rz-handle:hover { opacity: 1; }
.modal.maxed { border-radius: 8px; }
.modal.maxed .rz-handle { display: none; }
.formgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.formgrid .span2 { grid-column: span 2; }
.formgrid .span3 { grid-column: span 3; }
.barline { display: grid; grid-template-columns: 1fr 1fr 1.6fr 88px 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.markline { display: grid; grid-template-columns: 1fr 1.4fr 88px 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.subhead {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: #2b3a4d; letter-spacing: .3px;
  margin: 14px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line-2);
}
.subhead::before { content: ''; width: 3px; height: 12px; border-radius: 2px; background: var(--accent); flex: 0 0 auto; }

/* 登记弹窗分区卡片：基本信息(蓝) / 周期条(橙) / 单元格标记(绿) */
.fmcard { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0 0; overflow: hidden; background: #fff; }
.fmcard + .fmcard { margin-top: 12px; }
.fmcard-hd {
  font-size: 12px; font-weight: 700; line-height: 1.5;
  padding: 6px 10px; border-bottom: 1px solid;
  display: flex; align-items: center; gap: 6px;
}
.fmcard-hd::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: currentColor; opacity: .75; }
.fmcard-bd { padding: 10px 10px 11px; }
.fmcard-bd .formgrid { margin: 0; }
.fmcard-bd .hint { padding-left: 2px; }
/* 基本信息 · 蓝 */
.fm-basic { border-color: #7aa7d6; }
.fm-basic > .fmcard-hd { color: #1f4e79; background: #eef4fb; border-bottom-color: #c9dcf0; }
/* 周期条 · 橙 */
.fm-bar { border-color: #e3ab63; }
.fm-bar > .fmcard-hd { color: #96560a; background: #fdf4e7; border-bottom-color: #f2dcbe; }
/* 单元格标记 · 绿 */
.fm-mark { border-color: #86c39a; }
.fm-mark > .fmcard-hd { color: #256f43; background: #eef7f1; border-bottom-color: #c9e6d4; }

/* ---------------------------------------------------------------- 提示 */
#toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#toast div { background: #22304a; color: #fff; padding: 8px 16px; border-radius: 8px; box-shadow: var(--shadow); opacity: .96; font-size: 12px; }
#toast div.err { background: var(--red); }

.saving { color: var(--accent); }
.ok { color: var(--green); }

/* ============================================================
 * 底部爆量选股视图
 * ============================================================ */
/* --- 筛选进度面板 --- */
.bv-panel {
  flex: 0 0 auto; margin: 10px 14px 0; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); animation: bv-in .22s ease;
}
.bv-panel[hidden], .bv-result[hidden] { display: none; }
.bv-panel.fading, .bv-result.fading { opacity: 0; transition: opacity .25s ease; }
.bv-prog-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bv-stage { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.bv-pct { font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.bv-spin {
  width: 13px; height: 13px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid #dbe6f5; border-top-color: var(--accent); animation: bv-spin .7s linear infinite;
}
.bv-bar { height: 8px; background: #e6eaf0; border-radius: 6px; overflow: hidden; }
.bv-bar > span {
  display: block; height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--head), #66b0f5); transition: width .45s ease;
}
/* 候选池阶段没有进度信号 → 条纹流动，表示「进行中但无法量化」 */
.bv-bar.indeterminate > span { width: 35% !important; animation: bv-slide 1.1s ease-in-out infinite; }
.bv-stat { margin-top: 7px; font-size: 12px; color: var(--text-2); line-height: 1.5; }
@keyframes bv-spin { to { transform: rotate(360deg); } }
@keyframes bv-slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
@keyframes bv-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* --- 筛选结果提示条 --- */
.bv-result {
  flex: 0 0 auto; margin: 10px 14px 0; padding: 9px 12px;
  display: flex; align-items: flex-start; gap: 9px;
  border-radius: var(--radius); border: 1px solid; font-size: 13px; line-height: 1.55;
  background: var(--panel); animation: bv-in .22s ease;
}
.bv-result[hidden] { display: none; }
.bv-res-icon { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.bv-res-body { flex: 1; min-width: 0; }
.bv-res-title { font-weight: 600; }
.bv-res-sub { margin-top: 2px; font-size: 12px; opacity: .82; }
.bv-res-close { flex: 0 0 auto; cursor: pointer; border: none; background: transparent; color: inherit; opacity: .5; font-size: 15px; line-height: 1; padding: 2px 4px; }
.bv-res-close:hover { opacity: 1; }
/* 三态：命中 / 无结果 / 出错 */
.bv-result.ok { border-color: #b7e6cd; background: #f2fbf6; color: #14664a; }
.bv-result.ok .bv-res-icon { background: var(--green); }
.bv-result.none { border-color: var(--line); background: var(--panel-2); color: var(--text-2); }
.bv-result.none .bv-res-icon { background: #90a0b5; }
.bv-result.err { border-color: #f3c4c1; background: #fdf4f3; color: #8f2b25; }
.bv-result.err .bv-res-icon { background: var(--red); }
.bv-result b { font-variant-numeric: tabular-nums; }

/* 底部爆量选股：结果表边框（复用系统 --line-2 细线 + --head-2 表头底色） */
.bv-grid { margin-top: 4px; border-collapse: separate; border-spacing: 0; width: 100%; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.bv-grid th, .bv-grid td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 7px 10px; font-size: 13px; }
.bv-grid th:last-child, .bv-grid td:last-child { border-right: none; }
.bv-grid tbody tr:last-child td { border-bottom: none; }
/* 表头：蓝色底 + 白色加粗字，可点击排序（参考周期矩阵表头色系） */
.bv-grid thead th {
  background: linear-gradient(180deg, #3d8ce9, var(--head)); color: #fff; font-weight: 700;
  cursor: pointer; user-select: none; white-space: nowrap;
  border-right-color: rgba(255, 255, 255, .28); border-bottom-color: rgba(255, 255, 255, .38);
}
.bv-grid thead th:hover { filter: brightness(1.12); }
.bv-grid thead th.sorted { background: linear-gradient(180deg, var(--head), #2464b8); }
.bv-grid tbody tr:nth-child(even) { background: #fafbfd; }
.bv-grid tbody tr:hover { background: #f0f6ff; }
.bv-grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bv-grid td.rank { text-align: center; color: #8a93a0; width: 34px; }
.bv-grid td.ind { white-space: nowrap; }   /* 行业「一级-二级」不折行 */
.bv-grid td.hot { color: #d9423a; font-weight: 600; }
.bv-grid td.up { color: #d9423a; font-weight: 600; }   /* 涨：红（A 股习惯） */
.bv-grid td.down { color: #0f7b3f; font-weight: 600; } /* 跌：绿 */
/* 自选行（右键「加入自选」）：左侧蓝条 + 淡蓝底。只染代码/名称列，涨跌幅等数值列保持红涨绿跌 */
.bv-grid tbody tr.fav { background: var(--accent-soft); }
.bv-grid tbody tr.fav td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.bv-grid tbody tr.fav td:nth-child(2),
.bv-grid tbody tr.fav td:nth-child(3) { color: #14448f; font-weight: 700; }
.bv-grid tbody tr.fav:hover { background: #d8e8ff; }

/* 自选清单：悬停名称 → 自绘日 K 线浮窗（数据来自东方财富/腾讯公开行情接口，免登录） */
/* 不用 cursor: help —— 光标旁的「?」不好看，名称格保持普通箭头 */
.bv-grid td.nm { cursor: default; text-decoration: underline dotted rgba(20,68,143,.55); text-underline-offset: 3px; }
/* 周期矩阵：悬停「股票名称」看日K（.nm）、悬停「品种类型」看信息小窗（.tipcell），同一套虚线提示 */
table.mx td.namecell.nm, table.mx td.tipcell { cursor: default; text-decoration: underline dotted rgba(20,68,143,.55); text-underline-offset: 3px; }
#bvKline {
  position: fixed; z-index: 96;   /* > 行菜单 95 / 页脚 90，< 弹窗遮罩 100 */
  width: 784px; height: 524px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(20, 35, 60, .22);
  display: flex; flex-direction: column; overflow: hidden;
}
/* 标题栏＝拖动把手 */
#bvKline .bv-kline-head {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px;
  background: #f5f8fd; border-bottom: 1px solid var(--line); font-size: 13px; flex: none;
  cursor: move; user-select: none; -webkit-user-select: none;
}
#bvKline .bv-kline-head > * { cursor: auto; }
#bvKline.dragging { box-shadow: 0 18px 48px rgba(20, 35, 60, .3); }
#bvKline.pinned .bv-kline-head { background: #eef4fd; }
#bvKline .bv-kline-head::before {
  content: ''; flex: none; width: 12px; height: 10px; margin-right: -4px;
  background-image: radial-gradient(circle, #9aa5b1 1px, transparent 1.2px);
  background-size: 6px 5px; opacity: .85;
}
#bvKline .bv-kline-title { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bvKline .bv-kline-open { color: #14448f; text-decoration: none; font-size: 12px; }
#bvKline .bv-kline-open:hover { text-decoration: underline; }
#bvKline .bv-kline-refresh,
#bvKline .bv-kline-close {
  border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--text-2);
  border-radius: 5px; padding: 1px 7px; font-size: 12px; line-height: 1.6;
}
#bvKline .bv-kline-close { border: 0; font-size: 16px; padding: 0 4px; }
#bvKline .bv-kline-refresh:hover { color: var(--text); border-color: #b9c6d8; }
#bvKline .bv-kline-close:hover { color: var(--text); }
/* 悬停读数条：日期 / 开高低收 / 涨跌幅 / 量额 */
#bvKline .bv-kline-quote {
  flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 12px; font-size: 12px; color: var(--text-2); background: #fbfcfe;
  border-bottom: 1px solid var(--line); min-height: 22px;
}
#bvKline .bv-kline-quote b { color: var(--text); }
#bvKline .bv-kline-quote .up { color: #d9423a; font-weight: 600; }
#bvKline .bv-kline-quote .down { color: #0f7b3f; font-weight: 600; }
#bvKline .bv-kline-quote .hint { color: #9aa5b1; }
#bvKline .bv-kline-body { flex: 1; min-height: 0; padding: 2px 6px 4px; }
#bvKline .bv-kline-loading,
#bvKline .bv-kline-err {
  height: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center;
  color: #7b8794; font-size: 13px;
}
#bvKline .bv-kline-err { color: #b4534e; }
/* 逐源诊断：东方财富：请求超时；腾讯财经：成功 */
#bvKline .bv-kline-tried { color: #8b939c; font-weight: 400; font-size: 12px; line-height: 1.7; max-width: 640px; }
#bvKline .bv-kline-retry {
  border: 1px solid var(--line); background: #fff; border-radius: 5px;
  padding: 2px 10px; cursor: pointer; color: var(--text-2);
}

/* 底部爆量选股：筛选/自选/导出筛选/导出自选按钮与【周期矩阵】查询按钮同宽（93px） */
#bvRun, #bvFavView, #bvExport, #bvExportFav { min-width: 93px; text-align: center; box-sizing: border-box; }
/* 「自选」激活＝当前展示自选清单 */
#bvFavView.active {
  background: linear-gradient(180deg, #2b7aef, #1f6feb);
  border-color: #1f6feb; color: #fff;
}
#bvFavView.active:hover { background: linear-gradient(180deg, #3a86f5, #2472e8); }
#bvSearch { width: 160px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; color: var(--text-2); }
#bvSearch:focus-visible { outline: 2px solid #cfe0ff; outline-offset: 1px; }

/* 周期矩阵：名称格悬停 → 个股信息小窗（起止 / 代码名称 / 标签 / 备注 四行） */
#mxNameTip {
  position: fixed; z-index: 96;        /* > 行菜单 95 / 页脚 90，< 弹窗遮罩 100 */
  pointer-events: none;                /* 纯提示，不吃鼠标事件 */
  min-width: 200px; max-width: 360px;
  padding: 8px 11px; background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 26px rgba(20, 35, 60, .18);
  font-size: 12px; line-height: 1.75;
}
#mxNameTip .mx-tip-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
#mxNameTip .mx-tip-k { flex: none; color: #98a2ad; }
#mxNameTip .mx-tip-k.sep { margin-left: 10px; }
/* 值可能多行（备注支持 textarea 换行）：pre-wrap 保留 \n 并原样折行 */
#mxNameTip .mx-tip-v { color: var(--text); word-break: break-all; white-space: pre-wrap; flex: 1 1 auto; min-width: 0; }
/* 登录状态与访客只读反馈。 */
.auth-controls { color:var(--nav-text-on); display:flex; align-items:center; gap:8px; margin-left:auto; white-space:nowrap; font-size:12px; }
.auth-controls [hidden] { display:none; }
.login-form { display:grid; gap:10px; }
.login-form input { width:100%; box-sizing:border-box; }
.login-error { color:#c0392b; min-height:20px; }
.read-only button:disabled { opacity:.45; cursor:not-allowed; }
.read-only #rgTable input:disabled, .read-only #rgTable select:disabled,
.read-only #settingsBox input:disabled, .read-only #settingsBox textarea:disabled,
.read-only #bdNote:disabled { color:inherit; opacity:1; -webkit-text-fill-color:currentColor; }
.read-only #settingsBox .tag { cursor:default !important; }
@media (max-width:1100px) { .topbar { flex-wrap:wrap; height:auto; } .auth-controls { margin-left:8px; } }

/* 日期栏保持完整高度，内容列表独立滚动。 */
#view-bydate > .datechips { flex: 0 0 auto; }
#view-bydate > .scroll { flex: 1 1 0; min-height: 0; }
.datechips button { flex: 0 0 auto; white-space: nowrap; }
