:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e5e9f0;
  --text: #1a2233;
  --muted: #6b7280;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --up: #dc2626;    /* 涨=红（中国习惯） */
  --down: #16a34a;  /* 跌=绿 */
  --gold: #f59e0b;
  --dark: #10141f;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 20, 31, 0.08), 0 4px 14px rgba(16, 20, 31, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-strong); text-decoration: none; }
b { font-weight: 600; }

/* 顶部公告栏 */
.topbar { background: var(--dark); color: #e6e9f0; font-size: 13px; }
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.topbar-notice { color: #ffd58a; font-weight: 600; }
.topbar-qq { flex: 1; }
.topbar-qq b { color: #fff; }
.topbar-upgrade {
  background: var(--gold); color: #1a1a1a; font-weight: 700;
  padding: 4px 14px; border-radius: 999px; font-size: 12px;
}
.topbar-upgrade:hover { filter: brightness(1.05); }

/* 导航 */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.nav, .nav-inner { display: flex; align-items: center; }
.nav { padding: 0 16px; }
.nav { display: flex; }
.nav-inner { max-width: 1080px; margin: 0 auto; width: 100%; height: 56px; }
.nav { justify-content: center; }
.nav-inner { justify-content: space-between; }
.nav-brand { font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.nav-tabs { display: flex; gap: 6px; }
.nav-tab {
  border: none; background: transparent; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; font-size: 14px; color: var(--muted);
}
.nav-tab:hover { background: var(--panel-soft); }
.nav-tab.is-active { background: #fff1e6; color: var(--accent-strong); font-weight: 700; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.user-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-soft); color: var(--muted); border: 1px solid var(--line);
}
.user-badge.vip { background: #fef3c7; color: #92400e; border-color: #fcd34d; font-weight: 700; }
.ghost-btn {
  border: 1px solid var(--line); background: var(--panel); cursor: pointer;
  padding: 6px 14px; border-radius: 8px; font-size: 13px; color: var(--text);
}
.ghost-btn:hover { background: var(--panel-soft); }

/* 页面容器 */
.page { max-width: 1080px; margin: 20px auto 60px; padding: 0 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 20px; }
.eyebrow { display: block; font-size: 12px; color: var(--accent-strong); font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.panel-badge { font-size: 12px; background: var(--panel-soft); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.status { padding: 10px 0; }

/* 筛选下拉 */
.filter-select {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; color: var(--text); cursor: pointer;
}
.home-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.home-summary .chip { background: var(--panel-soft); border: 1px solid var(--line); padding: 5px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.home-summary .chip b { color: var(--text); }

/* 卡片网格 */
.section-sub { font-size: 15px; margin: 16px 0 10px; color: var(--text); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pager { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .ghost-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 180px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rank-pill { background: var(--dark); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 6px; }
.cat-tag { font-size: 11px; color: var(--muted); background: var(--panel-soft); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; }
.card-name { font-weight: 600; font-size: 14px; line-height: 1.35; }
.card-name a { color: var(--text); }
.card-name a:hover { color: var(--accent-strong); }
.card-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.metric { background: var(--panel-soft); border-radius: 8px; padding: 6px 9px; }
.metric small { display: block; font-size: 10px; color: var(--muted); }
.metric b { font-size: 13px; }
.up { color: var(--up); }
.down { color: var(--down); }
.card-reason { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 按钮 */
.primary-btn {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 10px 18px; border-radius: 9px; font-size: 14px; font-weight: 700;
}
.primary-btn:hover { background: var(--accent-strong); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.primary-btn.full { width: 100%; }

/* 游客开卡 */
.quota-badge { font-size: 13px; background: #fff1e6; color: var(--accent-strong); padding: 5px 12px; border-radius: 999px; font-weight: 700; }
.open-card-result { margin-top: 14px; }

/* 历史列表 */
.history-list { display: grid; gap: 10px; }
.history-day { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.history-day summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.history-items { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.history-item { display: flex; gap: 10px; align-items: center; font-size: 13px; padding: 6px 8px; background: var(--panel-soft); border-radius: 8px; flex-wrap: wrap; }
.history-item .rank-pill { font-size: 11px; }

/* 库存分析 */
.lock-box { text-align: center; padding: 30px 10px; color: var(--muted); }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.text-input {
  flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; font-size: 14px; color: var(--text); background: var(--panel);
}
.text-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.inventory-result { margin-top: 16px; overflow-x: auto; }
.inventory-result table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.inventory-result th, .inventory-result td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; }
.inventory-result th { background: var(--panel-soft); font-size: 12px; color: var(--muted); position: sticky; top: 0; }
.action-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.action-buy { background: #fee2e2; color: var(--up); }
.action-hold { background: #e0f2fe; color: #0369a1; }
.action-sell { background: #dcfce7; color: var(--down); }
.action-exit { background: #f1f5f9; color: #475569; }

/* 会员介绍 */
.vip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.vip-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel-soft); }
.vip-card h3 { margin: 0 0 10px; font-size: 16px; }
.vip-card ul { margin: 0; padding-left: 18px; color: var(--muted); }
.vip-card li { margin: 6px 0; }
.service-note { margin-top: 16px; border: 1px solid #fed7aa; background: #fff7ed; border-radius: var(--radius); padding: 16px; color: #9a3412; }
.service-note h3 { margin: 0 0 8px; }
.service-note p { margin: 4px 0; }
.contact { font-size: 15px; font-weight: 600; }

/* 登录弹窗 */
.modal { position: fixed; inset: 0; background: rgba(16, 20, 31, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 380px; position: relative; }
.modal-close { position: absolute; top: 10px; right: 14px; border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); }
.modal-box h3 { margin: 0 0 4px; }
.error-text { color: var(--up); font-size: 13px; margin: 8px 0 0; }

/* 移动端 */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vip-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .nav-inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 8px; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; }
  .topbar-qq { flex-basis: 100%; }
  .form-row { flex-direction: column; align-items: stretch; }
  .text-input { min-width: 0; }
}
