/* ============================================================
   资金流向管理平台 —— 金融终端美学设计系统
   琥珀金 × 深空黑 × 等宽数字 × 玻璃质感
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 背景层级（从深到浅）*/
  --bg-0: #06070b;          /* 最深背景 */
  --bg-1: #0a0c12;          /* 页面背景 */
  --bg-2: #11141c;          /* 卡片背景 */
  --bg-3: #181c26;          /* 卡片内部 / 表头 */
  --bg-4: #20252f;          /* hover 状态 */

  /* 边框 */
  --border: #252b36;
  --border-bright: #3a4150;

  /* 文字 */
  --text: #e8eaed;
  --text-2: #b4bac4;
  --text-3: #6b7280;
  --text-4: #4b5563;

  /* 品牌色：琥珀金 */
  --gold: #ffb800;
  --gold-2: #ffd75e;
  --gold-dim: rgba(255, 184, 0, 0.12);
  --gold-glow: rgba(255, 184, 0, 0.25);

  /* 涨跌色（中国市场：红涨绿跌）*/
  --up: #ff3b3b;
  --up-bg: rgba(255, 59, 59, 0.1);
  --down: #00d68f;
  --down-bg: rgba(0, 214, 143, 0.1);

  /* 辅助色 */
  --info: #4d8dff;
  --warn: #ffa940;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 0 24px rgba(255, 184, 0, 0.15);

  /* 圆角 */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* 字体（使用系统字体，秒加载，不依赖外部 CDN） */
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Menlo", "Monaco", "Consolas", "Courier New", monospace;

  /* 缓动 */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
}

/* ---------- 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

::selection { background: var(--gold-dim); color: var(--gold-2); }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg-1);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 微妙的网格背景纹理 */
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 184, 0, 0.06), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--gold-2); }

/* 自定义滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- 导航栏 ---------- */
.nav {
  background: rgba(10, 12, 18, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim) 30%, var(--gold-dim) 70%, transparent);
}

.nav .brand {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-right: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav .brand::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--gold-glow);
  animation: pulse 2.4s var(--ease) infinite;
}
.nav .brand span { color: var(--gold); font-weight: 600; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.nav .nav-links { display: flex; gap: 4px; }
.nav a.nav-link {
  color: var(--text-3);
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  position: relative;
  transition: all 0.2s var(--ease);
}
.nav a.nav-link:hover { color: var(--text); background: var(--bg-3); }
.nav a.nav-link.active {
  color: var(--gold);
  background: var(--gold-dim);
}

.nav .right { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.nav .user {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav .user::before {
  content: "";
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  border-radius: 50%;
  display: inline-block;
  /* 用户首字母 */
  font-size: 12px;
  color: var(--bg-0);
  text-align: center;
  line-height: 28px;
  font-weight: 800;
}
.nav .user.has-initial::before { content: attr(data-initial); }
.nav .logout {
  color: var(--text-3);
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: all 0.2s var(--ease);
}
.nav .logout:hover { color: var(--up); border-color: var(--up); background: var(--up-bg); }

/* ---------- 布局 ---------- */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 32px 64px;
  animation: pageIn 0.5s var(--ease-out);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.page-title .accent { color: var(--gold); }
.page-subtitle {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 4px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: cardIn 0.5s var(--ease-out) backwards;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-bright) 20%, var(--border-bright) 80%, transparent);
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}
.card-title::before {
  content: "";
  width: 3px; height: 16px;
  background: var(--gold);
  border-radius: 2px;
}
.card-title .badge {
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid var(--gold-glow);
}
/* 通用徽章：行业/概念 */
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid transparent;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.industry {
  background: var(--up-bg);
  color: var(--up);
  border-color: rgba(255, 59, 59, 0.3);
}
.badge.concept {
  background: var(--down-bg);
  color: var(--down);
  border-color: rgba(0, 214, 143, 0.3);
}
.card-title .date {
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
}

/* ---------- 网格 ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg-3);
  color: var(--text-3);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 14px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
/* 可排序表头 */
th.sortable { cursor: pointer; user-select: none; transition: color 0.15s var(--ease); }
th.sortable:hover { color: var(--gold); }
th.sortable .sort-icon {
  display: inline-block;
  width: 0; height: 0;
  margin-left: 4px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.3;
  transition: opacity 0.15s var(--ease);
}
th.sortable.asc .sort-icon {
  opacity: 1;
  border-bottom: 5px solid var(--gold);
}
th.sortable.desc .sort-icon {
  opacity: 1;
  border-top: 5px solid var(--gold);
}
thead th:first-child, tbody td:first-child { text-align: center; }
thead th.name, tbody td.name { text-align: left; }
tbody td {
  padding: 11px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s var(--ease);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover td { background: var(--bg-3); }
tbody td.code { font-family: var(--font-mono); color: var(--gold); font-size: 12px; }
tbody td.num { font-family: var(--font-mono); }

/* 表格底部统计行 */
tfoot .summary-row td {
  background: var(--bg-3);
  border-top: 2px solid var(--gold);
  border-bottom: none;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  padding: 14px;
}
tfoot .summary-row td.num { font-family: var(--font-mono); font-size: 14px; }
tfoot .summary-row td.muted { color: var(--text-3); font-weight: 400; }

/* ---------- 表格前 3 列固定（横向滚动时）---------- */
/* 列宽由 JavaScript 动态计算（adjustStickyColumns） */
.table-wrap { --col1-w: 48px; --col2-w: 90px; }
/* 第一列：固定在最左 */
.table-wrap table:not(.summary-table) thead th:nth-child(1),
.table-wrap table:not(.summary-table) tbody td:nth-child(1) {
  position: sticky;
  left: 0;
  min-width: var(--col1-w);
  z-index: 2;
  background: var(--bg-2);
}
.table-wrap table:not(.summary-table) thead th:nth-child(1) {
  z-index: 4;
  background: var(--bg-3);
}
/* 第二列：紧跟第一列右侧 */
.table-wrap table:not(.summary-table) thead th:nth-child(2),
.table-wrap table:not(.summary-table) tbody td:nth-child(2) {
  position: sticky;
  left: var(--col1-w);
  z-index: 2;
  background: var(--bg-2);
}
.table-wrap table:not(.summary-table) thead th:nth-child(2) {
  z-index: 4;
  background: var(--bg-3);
}
/* 第三列：紧跟第二列右侧 */
.table-wrap table:not(.summary-table) thead th:nth-child(3),
.table-wrap table:not(.summary-table) tbody td:nth-child(3) {
  position: sticky;
  left: calc(var(--col1-w) + var(--col2-w));
  z-index: 2;
  background: var(--bg-2);
}
.table-wrap table:not(.summary-table) thead th:nth-child(3) {
  z-index: 4;
  background: var(--bg-3);
}
/* hover 时保持背景色（避免透视）*/
.table-wrap table:not(.summary-table) tbody tr:hover td:nth-child(1),
.table-wrap table:not(.summary-table) tbody tr:hover td:nth-child(2),
.table-wrap table:not(.summary-table) tbody tr:hover td:nth-child(3) {
  background: var(--bg-4);
}
/* 汇总行第一列固定（可能是 colspan，只固定第一个 td）*/
.table-wrap table:not(.summary-table) tfoot .summary-row td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg-3);
}

/* 涨跌色 */
.pos { color: var(--up); }
.neg { color: var(--down); }
.pos-bg { background: var(--up-bg); }
.neg-bg { background: var(--down-bg); }

/* ========== 资金流向柱状图（红涨绿跌水平条） ========== */
.bar-cell {
  position: relative;
  width: 120px;
  min-width: 120px;
  height: 22px;
  vertical-align: middle;
}
.bar-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}
.bar-half {
  flex: 1;
  height: 16px;
  position: relative;
}
.bar-half.left { display: flex; justify-content: flex-end; }
.bar-half.right { display: flex; justify-content: flex-start; }
.bar-fill {
  height: 100%;
  border-radius: 2px;
  min-width: 1px;
  transition: width 0.3s var(--ease);
}
.bar-fill.up { background: linear-gradient(90deg, var(--up-bg), var(--up)); }
.bar-fill.down { background: linear-gradient(270deg, var(--down-bg), var(--down)); }
.bar-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
  padding: 0 4px;
}
.bar-label.up { left: 4px; color: var(--up); }
.bar-label.down { right: 4px; color: var(--down); }
.bar-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  z-index: 1;
}

/* 分页 */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.15s var(--ease);
}
.pagination a:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.pagination .current {
  background: var(--gold);
  color: var(--bg-0);
  border-color: var(--gold);
  font-weight: 700;
}
.pagination .ellipsis { border: none; }

/* 排名徽章 */
.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-4);
  color: var(--text-3);
}
.rank.top-1 { background: linear-gradient(135deg, #ffd75e, #ffb800); color: var(--bg-0); }
.rank.top-2 { background: linear-gradient(135deg #c0c5cc, #8a929e); color: var(--bg-0); }
.rank.top-3 { background: linear-gradient(135deg #cd7f32, #a05a1c); color: var(--bg-0); }

/* 标签 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.tag.industry { background: var(--gold-dim); color: var(--gold); border-color: var(--gold-glow); }
.tag.concept { background: rgba(77, 141, 255, 0.12); color: var(--info); border-color: rgba(77, 141, 255, 0.3); }

/* 个股查询列表中的所属板块单元格 */
.sectors-cell { max-width: 220px; }
.sectors-cell .tag {
  margin: 2px 3px 2px 0;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.1s;
}
.sectors-cell .tag:hover { transform: translateY(-1px); }

/* 所属板块超过 3 个时折叠：点击展开，鼠标离开收回 */
.sectors-wrap { cursor: pointer; display: inline; }
.sectors-wrap .sector-extra { display: none; }
.sectors-wrap.expanded .sector-extra { display: inline-block; }
.sectors-wrap.expanded .sector-more { display: none; }
.sectors-wrap .sector-more {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-3);
  border: 1px dashed var(--border);
  border-radius: 12px;
  margin: 2px 0 0 2px;
  user-select: none;
}
.sectors-wrap .sector-more:hover { color: var(--gold); border-color: var(--gold-glow); }

/* 帮助按钮（?）—— 用于点击展开规则说明 */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--gold-glow);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  font-family: serif;
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.2s;
}
.help-btn:hover {
  background: var(--gold);
  color: var(--bg-0);
  transform: scale(1.15);
}

/* ---------- 统计盒 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.stat-box {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s var(--ease);
}
.stat-box::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--gold);
  opacity: 0.6;
  transition: opacity 0.25s var(--ease);
}
.stat-box:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-box:hover::before { opacity: 1; }
.stat-box .label {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.stat-box .value {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
.stat-box .value.pos { color: var(--up); }
.stat-box .value.neg { color: var(--down); }
.stat-box .sub {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* ---------- 表单 ---------- */
label {
  display: block;
  color: var(--text-3);
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
input, select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: var(--font-ui);
  width: 100%;
  transition: all 0.2s var(--ease);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
input::placeholder { color: var(--text-4); }
input[type="date"] { font-family: var(--font-mono); }

.form-row { margin-bottom: 20px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: end;
}
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--bg-0);
  padding: 10px 24px;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-ui);
  letter-spacing: 0.02em;
  transition: all 0.2s var(--ease);
  box-shadow: 0 4px 12px rgba(255, 184, 0, 0.2);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 184, 0, 0.35);
  color: var(--bg-0);
}
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: none;
}
.btn.ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
  box-shadow: none;
  transform: none;
}
.btn.full { width: 100%; }
.btn.small {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* 按钮加载状态 */
.btn.loading {
  pointer-events: none;
  opacity: 0.75;
  position: relative;
  color: transparent !important;
}
.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(10, 12, 18, 0.3);
  border-top-color: var(--bg-0);
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
.btn.disabled, .btn:disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}
.btn.ghost.loading::after {
  border-color: rgba(255, 184, 0, 0.2);
  border-top-color: var(--gold);
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* 全局加载指示器（顶部进度条 + 遮罩）*/
.app-loader {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.app-loader.active { opacity: 1; }
.app-loader::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-2));
  box-shadow: 0 0 12px var(--gold-glow);
  animation: loader-slide 1.2s var(--ease) infinite;
}
@keyframes loader-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* 页面切换遮罩（轻微，不阻挡交互）*/
.app-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 11, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.app-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.app-overlay .spinner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tabs a {
  padding: 12px 24px;
  color: var(--text-3);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s var(--ease);
  position: relative;
  bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  color: var(--gold);
  border-color: var(--gold);
}

/* ---------- 提示框 ---------- */
.flash {
  padding: 12px 18px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  background: var(--up-bg);
  color: var(--up);
  border: 1px solid rgba(255, 59, 59, 0.3);
  font-size: 13px;
  font-weight: 500;
  animation: cardIn 0.3s var(--ease-out);
}

.hint {
  background: var(--gold-dim);
  border: 1px solid var(--gold-glow);
  border-radius: var(--r-md);
  padding: 14px 18px;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.7;
}
.hint code {
  font-family: var(--font-mono);
  background: var(--bg-3);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  color: var(--gold);
  font-size: 12px;
}
.hint.warn {
  background: rgba(255, 59, 59, 0.08);
  border-color: rgba(255, 59, 59, 0.3);
  color: #ff7b7b;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  max-width: 420px;
  margin: 80px auto;
  animation: pageIn 0.6s var(--ease-out);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
  position: relative;
}
.login-logo .icon::after {
  content: "¥";
  font-size: 28px;
  font-weight: 800;
  color: var(--bg-0);
  font-family: var(--font-mono);
}
.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.login-logo h1 .accent { color: var(--gold); }
.login-logo .sub {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 6px;
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.login-hint {
  text-align: center;
  color: var(--text-4);
  font-size: 12px;
  margin-top: 20px;
  font-family: var(--font-mono);
}

/* ---------- 日期标签云 ---------- */
.date-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.date-tag {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
}
.date-tag:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.date-tag.latest {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty-state .icon {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  border: 2px dashed var(--border-bright);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-4);
}
.empty-state code {
  font-family: var(--font-mono);
  background: var(--bg-3);
  padding: 4px 12px;
  border-radius: var(--r-sm);
  color: var(--gold);
  font-size: 12px;
  display: inline-block;
  margin-top: 8px;
}

/* ---------- 趋势预测：龙头/中军/杂毛 分区 ---------- */
.rank-section {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.rank-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-3);
  border-left: 4px solid var(--border);
}
.rank-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.rank-desc {
  flex: 1;
  font-size: 13px;
  color: var(--text-2);
}
.rank-count {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.rank-section .table-wrap {
  border: none;
  border-radius: 0;
}
.btn.ghost.small.active {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold-glow);
}
/* 移动端：预测页两列改一列 */
@media (max-width: 768px) {
  .predict-trend,
  .flow-charts,
  .flow-lists {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- 工具类 ---------- */
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.scroll-x { overflow-x: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav { padding: 0 16px; }
  .nav .brand { margin-right: 16px; font-size: 14px; }
  .nav .nav-links { gap: 0; }
  .nav a.nav-link { padding: 6px 10px; font-size: 12px; }
  .container { padding: 20px 16px 40px; }
  .card { padding: 16px; }
  .page-title { font-size: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-box .value { font-size: 18px; }
}
