:root {
  /* 白底 + 金 主题（页面回到浅色，金作为主色/强调，沿用 logo 同色系） */
  --bg: #ffffff;            /* 页面背景：白 */
  --panel: #ffffff;         /* 面板：白（靠描边 + 浅阴影分块） */
  --panel-2: #f5f6f8;       /* 次级面板 / 表头 / 输入框 */
  --border: #e8eaed;        /* 浅描边 */
  --text: #1f2733;          /* 深色正文 */
  --muted: #8a94a6;         /* 灰次要文字 */
  --accent: #C49A4A;        /* 雅金：主激活 / 链接 / 强调 */
  --accent-d: #9E6308;      /* 深赤金：强强调 / 数字（白底可读） */
  --gold-bright: #F6CE63;   /* 黄金：仅作渐变/点缀，不作白底正文 */
  --up: #e03636;            /* 涨 / 高于均线：红 */
  --down: #15a85a;          /* 跌 / 低于均线：绿 */
  --head: #f5f6f8;          /* 表头浅底 */
  --shadow: 0 1px 3px rgba(20,40,80,.06), 0 6px 18px rgba(20,40,80,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 16px 40px; }

/* ===== Hero 头部 · 墨黑 + 金 ===== */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background:
    radial-gradient(820px 360px at 88% -12%, rgba(196,154,74,.24), transparent 62%),
    linear-gradient(135deg, #0A0A0B 0%, #100d07 55%, #1a1407 100%);
  color: #F5F5F7; border-radius: 14px; padding: 18px 22px; margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.18);
  border: 1px solid rgba(196,154,74,.18);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 48px; height: 48px; border-radius: 12px; flex: none;
  box-shadow: 0 0 0 1px rgba(196,154,74,.40), 0 4px 14px rgba(0,0,0,.45);
}
.brand-text h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .5px; color: #F5F5F7; }
.brand-text .tagline { margin: 3px 0 0; font-size: 12.5px; color: #C9A96A; }
.brand-text .tagline b { font-weight: 700; color: #F6CE63; }
.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px;
  transition: .15s; font-weight: 500;
}
.btn:hover { border-color: var(--accent); color: var(--accent-d); }
.btn.primary { background: linear-gradient(135deg,#F6CE63,#DDA024); color: #1a1206; border-color: #DDA024; font-weight: 600; }
.btn.primary:hover { background: linear-gradient(135deg,#FFF3C8,#F6CE63); }
.btn.sm { padding: 5px 10px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ===== KPI 概览卡 ===== */
.kpis {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-val { font-size: 26px; font-weight: 700; color: var(--gold-bright); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 12px; color: var(--muted); margin-top: -4px; }

.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter label { font-size: 11px; color: var(--muted); }
.filter select, .filter input {
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px;
  font-size: 13px; background: var(--panel-2); color: var(--text); min-width: 96px; transition: .15s;
}
.filter select:focus, .filter input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,154,74,.18); }
.filter.search input { min-width: 150px; }
.result-count { margin-left: auto; color: var(--muted); font-size: 12px; align-self: center; }

.table-scroll {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  overflow: auto;   /* 不设高度上限，表格随内容自然展开 */
  box-shadow: var(--shadow);
}
table { border-collapse: collapse; width: 100%; table-layout: fixed; }
thead th {
  position: sticky; top: 0; background: var(--head); z-index: 2;
  text-align: right; padding: 9px 8px; font-weight: 600; white-space: normal; line-height: 1.3;
  border-bottom: 2px solid var(--border); cursor: pointer; user-select: none; font-size: 12.5px;
}
thead th.left { text-align: left; }
thead th.no-sort { cursor: default; }
thead th .arrow { color: var(--accent); margin-left: 3px; font-size: 10px; }

/* 列宽：固定布局下为前 16 列定宽，末列(auto)吸收剩余宽度。
   关键：定宽列之和(≈1138px) 必须 < 容器可用宽(≤1248px)，否则 table-layout:fixed
   会让表格溢出容器、末列被推到横向滚动区外（最大化窗口也显示不全）。 */
thead th:nth-child(1)  { width: 78px; }  /* 行业 */
thead th:nth-child(2)  { width: 82px; }  /* 股名 */
thead th:nth-child(3)  { width: 64px; }  /* 收盘价 */
thead th:nth-child(4)  { width: 68px; }  /* 股息率% */
thead th:nth-child(5)  { width: 98px; } /* 股息率走势(小折线) */
thead th:nth-child(6)  { width: 78px; }  /* 股息支付率% */
thead th:nth-child(7)  { width: 54px; }  /* PE */
thead th:nth-child(8)  { width: 54px; }  /* PB */
thead th:nth-child(9)  { width: 56px; }  /* ROE% */
thead th:nth-child(10) { width: 72px; }  /* 近5年ROE% */
thead th:nth-child(11) { width: 68px; }  /* 250分位线 */
thead th:nth-child(12) { width: 64px; }  /* MA250 */
thead th:nth-child(13) { width: 68px; }  /* 日偏离度 */
thead th:nth-child(14) { width: 70px; }  /* 日偏离率% */
thead th:nth-child(15) { width: 58px; }  /* 日布林% */
thead th:nth-child(16) { width: 58px; }  /* 周布林% */
thead th:nth-child(17) { width: 58px; }  /* 月布林% */
tbody td {
  padding: 7px 8px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td.left { text-align: left; }
tbody tr:hover { background: rgba(196,154,74,.08); }
tbody tr:nth-child(even) { background: #f7f8fa; }
tbody tr:nth-child(even):hover { background: rgba(196,154,74,.12); }
.code { color: var(--muted); font-size: 11px; }
.f10name { color: inherit; text-decoration: none; }
.f10name:hover { color: var(--accent-d); }
.f10name:hover b { text-decoration: underline; }
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }
.pct-cell { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.spark { vertical-align: middle; display: inline-block; }

.toolbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; box-shadow: var(--shadow);
}
.toolbar .show-label { color: var(--muted); font-size: 12px; }
.toolbar .size { min-width: 44px; }
.toolbar .size.active { background: var(--accent); color: #1a1206; border-color: var(--accent); font-weight: 600; }
.toolbar .range { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ===== 看板说明面板（置于最上方） ===== */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 8px; font-size: 14px; color: var(--accent-d); }
.panel .note-body { line-height: 1.7; color: #43505f; font-size: 12.5px; }
.panel .note-body p { margin: 6px 0; }
.panel .note-body ul { margin: 6px 0; padding-left: 20px; }
.panel .note-body li { margin: 4px 0; }
.panel .note-body b { color: var(--text); }

/* 看板说明折叠（原生 details） */
.explain > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  user-select: none;
}
.explain > summary::-webkit-details-marker { display: none; }
.explain > summary h2 { margin: 0; }
.explain[open] > summary { margin-bottom: 8px; }
.explain .fold-caret { color: var(--muted); font-size: 12px; transition: transform .2s ease; }
.explain[open] > summary .fold-caret { transform: rotate(180deg); }
/* 注册表单提示 */
.reg-tip { margin-top: 2px; text-align: center; }
.reg-tip b { color: var(--accent-d); }

/* ===== 页脚 ===== */
.site-footer {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px; box-shadow: var(--shadow);
}
.site-footer h2 { margin: 0 0 8px; font-size: 14px; color: var(--accent-d); }
.site-footer .about p { margin: 0; line-height: 1.8; color: #43505f; font-size: 12.5px; }
.site-footer .about b { color: var(--text); }
.disclaimer { margin: 12px 0 0; font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 10px; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-direction: column; align-items: flex-start; }
  .brand-text h1 { font-size: 19px; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
}

/* ===== 用户系统 / 收藏 ===== */
.auth { display: flex; align-items: center; gap: 8px; flex: none; }
.auth .user-email { color: #F6CE63; font-size: 13px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 收藏星标（内联在股名单元格，不新增列） */
.star {
  background: none; border: none; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--gold-bright); padding: 0 5px 0 0; vertical-align: middle;
}
.star.locked { color: #9a9486; }
.star:hover { color: var(--accent-d); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,18,24,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-mask[hidden] { display: none; }
.modal {
  position: relative; width: 320px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.modal .tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.modal .tab {
  flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); border-radius: 8px; cursor: pointer; font-size: 13px;
}
.modal .tab.active { background: var(--accent); color: #1a1206; font-weight: 600; border-color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form[hidden] { display: none; }
.auth-form input {
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 13px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,154,74,.18); }
.auth-form .btn { margin-top: 4px; }
.modal-close {
  position: absolute; top: 6px; right: 12px; background: none; border: none;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.link { color: var(--accent); font-size: 12px; text-align: right; cursor: pointer; user-select: none; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.auth-msg { font-size: 12px; color: var(--muted); min-height: 16px; margin: 4px 0 0; }
.auth-msg.err { color: var(--up); }
