/* ============================================================
   ui.css — A股量化工具箱 PRO 统一皮肤层（2026-10-20 改版）
   用法：在页面 </head> 前引入 <link rel="stylesheet" href="ui.css">
   定位：不推翻各页既有配色（浅色系 #f5f6f8），只做统一的
   「专业级」质感层：品牌栏 / 卡片 / 按钮 / 表格 / 输入 / 折叠块。
   红涨绿跌（A股惯例）由各页既有变量承担，这里不反转。
   ============================================================ */

/* ---------- 1. 基础质感 ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1 { letter-spacing: -.02em; }
h2 { letter-spacing: -.01em; }
table, .num, td, th { font-variant-numeric: tabular-nums; }

/* ---------- 2. 品牌顶栏（ui.js 注入 .pro-topbar） ---------- */
.pro-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 54px; padding: 0 clamp(14px, 4vw, 32px);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(15, 27, 45, .08);
  box-shadow: 0 6px 18px -12px rgba(15, 27, 45, .25);
}
.pro-topbar .brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15.5px; font-weight: 700; color: #14213d; text-decoration: none; letter-spacing: -.01em;
}
.pro-topbar .logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; color: #fff; font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, #1f5eff 0%, #123bb8 100%);
  box-shadow: 0 4px 10px -3px rgba(31, 94, 255, .55), 0 0 0 1px rgba(255, 255, 255, .25) inset;
}
.pro-topbar .pro-badge {
  font-size: 10.5px; font-weight: 800; letter-spacing: .12em; padding: 2px 7px 1.5px; border-radius: 6px;
  color: #6b4a08; background: linear-gradient(135deg, #f7d98a, #e9b64d 55%, #d19a2f);
  box-shadow: 0 2px 6px -1px rgba(209, 154, 47, .5);
}
.pro-topbar .right { display: flex; align-items: center; gap: 6px; }
.pro-topbar .right a {
  font-size: 13px; color: #44506b; text-decoration: none; padding: 6px 11px; border-radius: 9px;
  transition: background .15s ease, color .15s ease; white-space: nowrap;
}
.pro-topbar .right a:hover { background: rgba(31, 94, 255, .08); color: #1f5eff; }
.pro-topbar .right a.vip {
  color: #6b4a08; font-weight: 700;
  background: linear-gradient(135deg, #f9e3a8, #ecc160);
  box-shadow: 0 2px 8px -2px rgba(209, 154, 47, .45);
}
.pro-topbar .right a.vip:hover { filter: brightness(1.04); color: #59390a; }
@media (max-width: 560px) {
  .pro-topbar { height: 50px; }
  .pro-topbar .brand span.brandname { display: none; }
  .pro-topbar .right a:not(.vip) { display: none; }
}

/* ---------- 3. 卡片 ---------- */
.card {
  border-radius: 16px !important;
  border: 1px solid #e6e8ef !important;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -14px rgba(16, 24, 40, .14) !important;
  overflow: hidden;
}
.card > h2, .card > h3 {
  display: flex; align-items: center; gap: 9px;
  font-size: 15.5px; font-weight: 700; color: #17233f;
}
.card > h2::before {
  content: ""; flex: 0 0 auto; width: 4px; height: 15px; border-radius: 3px;
  background: linear-gradient(180deg, #2e6bff, #1f4fd8);
}

/* ---------- 4. 按钮（统一主次两级） ---------- */
button, .btn, .go, .primary {
  font-family: inherit; cursor: pointer; transition: transform .12s ease, box-shadow .16s ease, filter .16s ease;
}
button:active { transform: translateY(1px) scale(.99); }
button.go, button.primary, .btn.primary, button.btn-primary {
  color: #fff !important; font-weight: 600; letter-spacing: .01em;
  background: linear-gradient(135deg, #2e6bff, #1c4fd6) !important;
  border: none; border-radius: 10px !important;
  box-shadow: 0 6px 16px -6px rgba(30, 94, 235, .55), 0 1px 0 rgba(255, 255, 255, .2) inset !important;
  padding: 9px 20px !important; font-size: 14px !important;
}
button.go:hover, button.primary:hover, .btn.primary:hover { filter: brightness(1.07); box-shadow: 0 10px 22px -8px rgba(30, 94, 235, .6) !important; }
button.mini, .gh, button.tagbtn, button.sub {
  background: #fff !important; color: #2c4170 !important;
  border: 1px solid #d7dce8 !important; border-radius: 9px !important;
  font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  padding: 7px 14px !important; font-size: 13px !important;
}
button.mini:hover, .gh:hover, button.tagbtn:hover { border-color: #9fb6e8 !important; color: #1f5eff !important; }

/* ---------- 5. 输入控件 ---------- */
input[type="text"], input[type="number"], input:not([type]), select, textarea {
  font-family: inherit; font-size: 14px; color: #17233f;
  background: #fff; border: 1.5px solid #d9dee9 !important; border-radius: 10px !important;
  padding: 9px 12px; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #2e6bff !important;
  box-shadow: 0 0 0 3.5px rgba(46, 107, 255, .14) !important;
}
input::placeholder { color: #a3adc0; }
label.t { font-weight: 600; color: #3a4763; }

/* ---------- 6. 表格 ---------- */
table { border-collapse: collapse; }
thead th {
  position: sticky; top: 0; z-index: 5; /* 2026-10-20 修复：54px 会顶住 .card(overflow:hidden) 滚动容器，把表头压进数据区 */
  background: #f2f5fa !important; color: #3a4763 !important;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  border-bottom: 1.5px solid #dfe4ee !important;
}
tbody tr { transition: background .1s ease; }
tbody tr:nth-child(even) { background: rgba(242, 245, 250, .55); }
tbody tr:hover { background: #eaf1ff !important; }
td, th { padding: 7px 10px; }

/* ---------- 7. 徽章 / 标签 ---------- */
.tag, .badge {
  font-weight: 600; letter-spacing: .01em; border-radius: 999px;
  border: 1px solid transparent;
}
.tag { padding: 2px 9px; font-size: 11px; }
.t1 { background: #e8f6ee !important; color: #0d7a43 !important; border-color: #bfe6d0; }
.t2 { background: #fdf3e0 !important; color: #9a6a10 !important; border-color: #f0dcb2; }
.t3 { background: #e9f0ff !important; color: #1f5eff !important; border-color: #c6d8fa; }

/* ---------- 8. 方法论折叠块（ui.js 自动收纳） ---------- */
details.pro-fold {
  margin-top: 10px; border: 1px dashed #dfe4ee; border-radius: 12px;
  background: #fafbfd; padding: 0;
}
details.pro-fold > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 8px 14px; font-size: 12.5px; color: #7c8aa5; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}
details.pro-fold > summary::-webkit-details-marker { display: none; }
details.pro-fold > summary::before {
  content: "▸"; font-size: 11px; color: #9fb6e8; transition: transform .15s ease;
}
details.pro-fold[open] > summary::before { transform: rotate(90deg); }
details.pro-fold[open] > summary { border-bottom: 1px dashed #e8ecf3; }
details.pro-fold > summary:hover { color: #44506b; }
details.pro-fold > *:not(summary) { margin: 10px 14px; }
details.pro-fold[open] { padding-bottom: 4px; }

/* ---------- 9. 统一页脚（ui.js 注入） ---------- */
.pro-footer {
  margin-top: 34px; padding: 18px 16px 8px; border-top: 1px solid #e8ecf3;
  text-align: center; font-size: 11.5px; color: #97a2b6; line-height: 1.8;
}
.pro-footer b { color: #7c8aa5; font-weight: 600; }

/* ---------- 10. 滚动条 / 选中色 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #ccd4e2; border-radius: 8px; border: 2px solid #f5f6f8; }
::-webkit-scrollbar-thumb:hover { background: #aab6cc; }
::selection { background: rgba(46, 107, 255, .22); }

/* ---------- 11. 动效收敛 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
