:root {
  --bg: #0f141b;
  --panel: #161d27;
  --panel2: #1c2531;
  --line: #28323f;
  --text: #d7dee8;
  --muted: #8b97a6;
  --up: #e5484d;     /* A股红涨 */
  --down: #2fb86b;   /* 绿跌 */
  --accent: #4c8dff;
  --warn: #e8a33d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, sans-serif;
}

a { color: var(--accent); text-decoration: none; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .meta { color: var(--muted); font-size: 12px; }
.topbar .spacer { flex: 1; }

.counts { display: flex; gap: 14px; }
.counts b { color: var(--text); }
.counts span { color: var(--muted); }

.pill {
  padding: 2px 8px; border-radius: 10px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
}
.pill.live { color: var(--warn); border-color: var(--warn); }

.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); color: var(--text); }

/* 筛选栏 */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.filters .fitem { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.filters input[type="number"], .filters input[type="text"], .filters select {
  width: 78px; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 5px; padding: 4px 6px; font-size: 12px;
}
.filters input[type="date"] {
  width: 122px; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 5px; padding: 3px 6px; font-size: 12px;
  color-scheme: dark;
}
.filters select { width: auto; }
.filters #industry { max-width: 220px; }
.hide { display: none !important; }
.filters input#keyword { width: 150px; }
.filters #preset_name { width: 96px; }
.filters .preset .btn { padding: 5px 9px; }
.filters label.check { color: var(--muted); display: flex; align-items: center; gap: 4px; }

/* 表格 */
.tablewrap { overflow: auto; padding: 0; max-height: calc(100vh - 210px); }
table.grid { border-collapse: collapse; width: 100%; white-space: nowrap; }
table.grid th, table.grid td {
  padding: 6px 9px; border-bottom: 1px solid var(--line); text-align: right; font-size: 12px;
}
table.grid th {
  position: sticky; top: 0; background: var(--panel2); color: var(--muted);
  font-weight: 600; cursor: default; z-index: 2;
}
table.grid th.sortable { cursor: pointer; }
table.grid th.sortable:hover { color: var(--text); }
table.grid th .arrow { color: var(--accent); margin-left: 3px; }
table.grid td.l, table.grid th.l { text-align: left; }
table.grid tbody tr:hover { background: var(--panel); cursor: pointer; }

/* 人工填写的交易计划价输入框 */
table.grid td:has(.plan-input) { padding: 3px 6px; }
.plan-input {
  width: 66px; padding: 3px 6px; text-align: right; font-size: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  color: var(--text); outline: none; cursor: text;
}
.plan-input::placeholder { color: #46505d; }
.plan-input:focus { border-color: var(--accent); }
.plan-input.saved { border-color: var(--up); }
.plan-input.err { border-color: var(--down); }
/* 无手工值时：系统测算价以灰字斜体 placeholder 展示，虚线框区分于手工保存值 */
.plan-input.plan-sys { border-style: dashed; }
.plan-input.plan-sys::placeholder { color: #74849c; font-style: italic; opacity: .95; }

/* 近10年中枢趋势缩略图：在单元格内居中（冻结列宽度固定，SVG 不随右对齐贴边） */
.spark { display: block; margin: 0 auto; }

/* 左侧冻结列：th 与 td 同一套 sticky 规则，left/宽度由 JS 按列累计注入 */
table.grid th.fz, table.grid td.fz { position: sticky; z-index: 3; }
table.grid td.fz { background: var(--bg); }
table.grid th.fz { background: var(--panel2); z-index: 6; }   /* 表头+左冻结交叉处层级最高 */
table.grid tbody tr:hover td.fz { background: var(--panel); }
table.grid th.fz-last, table.grid td.fz-last { box-shadow: 2px 0 4px -2px rgba(0,0,0,.6); border-right: 1px solid var(--line); }

.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.na { color: #5a6573; }

.grade { padding: 1px 7px; border-radius: 4px; font-weight: 700; }
.grade.A { background: #5b2a86; color: #e9d5ff; }
.grade.B { background: #14436b; color: #cfe4ff; }
.grade.C { background: #3a3417; color: #f3e3a1; }
.grade.D { background: #482022; color: #f3c0c2; }

.act { padding: 1px 7px; border-radius: 4px; }
.act.做T { background: #5b2a86; color: #e9d5ff; }
.act.波段 { background: #14436b; color: #cfe4ff; }
.act.观察 { background: #3a3417; color: #f3e3a1; }
.act.回避 { background: #482022; color: #f3c0c2; }

/* 六维评分热力：单一蓝色色相，分越高底色越实；<40 分用暖色提示，避免与涨跌红绿、等级紫蓝黄红冲突 */
.dim {
  display: inline-block; min-width: 40px; padding: 1px 6px; border-radius: 4px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.dim.h5 { background: rgba(76, 141, 253, .34); color: #e3eeff; font-weight: 700; }
.dim.h4 { background: rgba(76, 141, 253, .20); color: #b6d2ff; }
.dim.h3 { background: rgba(76, 141, 253, .10); color: #8fb6f0; }
.dim.h2 { background: var(--panel2); color: var(--muted); }
.dim.h1 { background: rgba(232, 163, 61, .15); color: #e0b87a; }

.star { cursor: pointer; color: #6b7686; font-size: 14px; }
.star.on { color: var(--warn); }

/* 只读部署（云端快照）：收藏星禁点、计划价改为纯文本 */
body.read-only .star { pointer-events: none; cursor: default; opacity: .65; }
.plan-ro { display: inline-block; min-width: 40px; padding: 1px 6px; text-align: right; font-size: 12px; }
.plan-ro.plan-sys-txt { color: #74849c; font-style: italic; }

/* 分页 */
.pager {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  background: var(--panel); border-top: 1px solid var(--line); color: var(--muted);
}
.pager input { width: 56px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: 5px; padding: 4px 6px; }

.statusline { padding: 8px 18px; color: var(--muted); font-size: 12px; }

/* 详情页 */
.detail { padding: 18px; max-width: 1200px; margin: 0 auto; }
.detail h2 { font-size: 15px; margin: 22px 0 10px; border-left: 3px solid var(--accent); padding-left: 9px; }
.cards { display: flex; flex-wrap: wrap; gap: 10px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; min-width: 120px;
}
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 17px; font-weight: 600; margin-top: 2px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 0; margin-bottom: 8px; }
.caliber-note { margin: -4px 0 8px; font-size: 11px; line-height: 1.6; color: var(--muted); }
.kvtable { width: 100%; border-collapse: collapse; }
.kvtable td { padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.kvtable td.k { color: var(--muted); width: 46%; }
.kvtable tr:last-child td { border-bottom: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 14px; }

table.years { width: 100%; border-collapse: collapse; }
table.years th, table.years td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; }
table.years th { color: var(--muted); background: var(--panel2); font-weight: 600; }
table.years td:first-child, table.years th:first-child { text-align: left; }

/* 当年补充行（年报未披露：ROE 累计 / 营收利润 TTM）——琥珀色与历年年报行视觉区分 */
table.years tr.partial-year td { background: rgba(245, 197, 66, 0.07); }
table.years tr.partial-year td:first-child { box-shadow: inset 3px 0 0 #f5c542; color: #f5c542; }
.cal-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 10px; line-height: 16px;
  color: #f5c542; border: 1px solid rgba(245, 197, 66, 0.5); border-radius: 8px;
  white-space: nowrap; vertical-align: 1px; cursor: help;
}
.ptag { margin-left: 4px; font-size: 10px; color: #b59b57; cursor: help; }
.hl-note { color: #d8b96a; }

.ref li { margin-bottom: 5px; }
.disclaimer {
  margin: 26px 0 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 8px; color: var(--muted); font-size: 12px; background: var(--panel);
}
.backrow { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

/* ================= 到价提醒：铃铛 / 通知中心 / Toast ================= */
.alert-wrap { position: relative; display: flex; align-items: center; }
.bell-btn { position: relative; padding: 5px 9px; font-size: 14px; line-height: 1; }
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: var(--up); color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--panel);
}
.alert-panel {
  position: absolute; top: 38px; right: 0; width: 380px; max-height: 440px; overflow: auto;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); z-index: 30;
}
.alert-panel .hd {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 12.5px; display: flex; align-items: center;
  position: sticky; top: 0; background: var(--panel2);
}
.alert-panel .hd .clear { margin-left: auto; color: var(--accent); font-weight: 400; font-size: 11px; cursor: pointer; }
.alert-panel .hd .clear:hover { text-decoration: underline; }
.alert-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.alert-item:last-child { border-bottom: none; }
.alert-item .unread { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-item.buy .unread { background: var(--down); }
.alert-item.sell .unread { background: var(--up); }
.alert-item.read .unread { background: var(--line); }
.alert-item .t1 { font-size: 12.5px; }
.alert-item .t1 code { color: var(--muted); font-size: 11px; margin-left: 5px; }
.alert-item .t2 { color: var(--muted); font-size: 11.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.alert-item .t2 b { font-weight: 600; }
.alert-item.buy .t2 b { color: var(--down); }
.alert-item.sell .t2 b { color: var(--up); }
.alert-item .t3 { color: #5b6673; font-size: 10.5px; margin-top: 2px; }
.alert-item .test-tag {
  font-size: 10px; color: var(--warn); border: 1px solid rgba(232, 163, 61, .5);
  border-radius: 8px; padding: 0 6px;
}
.alert-item .sys-tag {
  font-size: 10px; color: #7db4ff; border: 1px solid rgba(93, 148, 255, .55);
  border-radius: 8px; padding: 0 6px;
}
.alert-empty { padding: 26px 16px; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.8; }

#toastWrap { position: fixed; top: 64px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 12px; }
.toast {
  width: 380px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  overflow: hidden; display: flex; animation: toastIn .35s ease both;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.toast .bar { width: 3px; flex-shrink: 0; }
.toast.buy .bar { background: var(--down); }
.toast.sell .bar { background: var(--up); }
.toast .inner { display: flex; gap: 11px; padding: 13px 14px; flex: 1; }
.toast .ico {
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 1px;
}
.toast.buy .ico { background: rgba(47, 184, 107, .14); color: var(--down); }
.toast.sell .ico { background: rgba(229, 72, 77, .14); color: var(--up); }
.toast .body { flex: 1; min-width: 0; }
.toast .top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.toast .tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; }
.toast.buy .tag { color: var(--down); background: rgba(47, 184, 107, .13); }
.toast.sell .tag { color: var(--up); background: rgba(229, 72, 77, .13); }
.toast .time { color: var(--muted); font-size: 11px; margin-left: auto; }
.toast .name { font-size: 13px; font-weight: 600; }
.toast .name code { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 5px; }
.toast .kv { display: flex; gap: 18px; margin-top: 7px; }
.toast .kv .k { color: var(--muted); font-size: 11px; }
.toast .kv .v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.toast.buy .kv .v.cur { color: var(--down); }
.toast.sell .kv .v.cur { color: var(--up); }
.toast .src { margin-top: 8px; font-size: 10.5px; color: #5b6673; display: flex; align-items: center; gap: 5px; }
.toast .src .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--down); }
.toast.sell .src .dot { background: var(--up); }
.toast .close { color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; align-self: flex-start; }
