/* ============ 情报雷达 · mosaic-grid-architecture-style ============ */
:root {
  --paper: #F7F7F5;
  --ink: #1F1F1D;
  --ink-soft: #2B2B28;
  --forest: #1A3C2B;
  --forest-soft: #24513A;
  --coral: #FF8C69;
  --coral-deep: #C24E2A;
  --mint: #9EFFBF;
  --mint-deep: #177A45;
  --gold: #F4D35E;
  --line: rgba(58, 58, 56, 0.2);
  --muted: #6E6E66;
  --disp: 'Space Grotesk', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --sans: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@font-face {
  font-family: 'Space Grotesk';
  src: url('./vendor/space-grotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('./vendor/jetbrains-mono.ttf') format('truetype');
  font-weight: 100 800;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--disp); font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--forest); }
.mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--forest-soft); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--forest);
  position: relative; flex: none;
}
.brand-mark::before {
  content: ''; position: absolute; inset: 5px; border-radius: 50%;
  border: 1px solid var(--coral);
}
.brand-mark::after {
  content: ''; position: absolute; inset: 12px; border-radius: 50%;
  background: var(--gold);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.75; }
}
.brand-text h1 { font-size: 19px; line-height: 1.1; }
.brand-sub {
  margin: 2px 0 0; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.18em; color: var(--muted);
}
.top-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.status { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #B9B9B1; flex: none; }
.dot.live { background: var(--mint); animation: pulse-dot 1.6s ease-in-out infinite; }
.dot.dead { background: var(--coral); }
.sep { opacity: 0.5; }

/* 开关 */
.switch { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch-track { width: 30px; height: 16px; border: 1px solid rgba(58,58,56,.35); border-radius: 2px; background: transparent; position: relative; transition: background .2s; }
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px;
  background: var(--muted); border-radius: 1px; transition: left .2s, background .2s;
}
.switch input:checked + .switch-track { background: var(--forest); border-color: var(--forest); }
.switch input:checked + .switch-track::after { left: 16px; background: var(--paper); }

/* 搜索 */
.search { position: relative; width: 240px; max-width: 40vw; }
#searchInput {
  width: 100%; padding: 7px 10px;
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: transparent; border: 1px solid rgba(58,58,56,.35); border-radius: 2px; outline: none;
}
#searchInput:focus { border-color: var(--forest); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--paper); border: 1px solid var(--line); border-radius: 2px;
  max-height: 280px; overflow-y: auto;
}
.search-item {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.key { background: var(--forest); color: var(--paper); }
.search-item .si-name { font-size: 13px; font-weight: 600; }
.search-item .si-code { font-family: var(--mono); font-size: 10px; opacity: 0.75; }
.search-item .si-badge { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--gold); }
.search-empty { padding: 10px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- 指数条 ---------- */
.ticker {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.ticker::-webkit-scrollbar { display: none; }
.idx-card {
  flex: none; min-width: 196px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 2px;
}
.idx-name { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.idx-row { display: flex; align-items: baseline; gap: 8px; }
.idx-price { font-family: var(--mono); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.idx-chg { font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.idx-off { color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* ---------- 主网格 ---------- */
.grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px;
  padding: 14px 20px; max-width: 1500px; margin: 0 auto;
}
.panel { border: 1px solid var(--line); border-radius: 2px; background: var(--paper); min-width: 0; }
.panel-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 14px; letter-spacing: 0.02em; }
.tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  color: var(--forest-soft); border: 1px solid rgba(26,60,43,.35);
  padding: 1px 6px; border-radius: 2px; text-transform: uppercase;
}
.panel-ops { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mini-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  padding: 4px 8px; color: var(--forest); background: transparent;
  border: 1px solid rgba(26,60,43,.45); border-radius: 2px;
}
.mini-btn:hover { background: var(--forest); color: var(--paper); }
.meta { font-size: 10px; color: var(--muted); }

/* ---------- 行情表 ---------- */
.table-wrap { overflow-x: auto; }
#quoteTable { width: 100%; border-collapse: collapse; }
#quoteTable th {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 400; text-align: left;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
#quoteTable th.num { text-align: right; }
#quoteTable td {
  padding: 8px 10px; border-bottom: 1px solid rgba(58,58,56,.1);
  font-size: 13px; white-space: nowrap;
}
#quoteTable td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
#quoteTable tbody tr { transition: background .4s; }
#quoteTable tbody tr:hover { background: rgba(26,60,43,.05); }
#quoteTable tr.flash { animation: row-flash 1.4s ease-out; }
@keyframes row-flash {
  0% { background: rgba(244,211,94,.4); }
  100% { background: transparent; }
}
#quoteTable tr.alert { background: rgba(255,140,105,.12); }
.q-name { font-weight: 600; }
.q-code { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--muted); margin-top: 1px; }
.up { color: var(--coral-deep); }
.down { color: var(--mint-deep); }
.flat { color: var(--muted); }
.pill {
  display: inline-block; min-width: 56px; text-align: right;
  padding: 2px 6px; border-radius: 2px; font-family: var(--mono); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.pill.up { background: rgba(255,140,105,.16); color: var(--coral-deep); }
.pill.down { background: rgba(158,255,191,.22); color: var(--mint-deep); }
.pill.flat { background: rgba(58,58,56,.08); color: var(--muted); }
.q-time { font-size: 11px; }
.rm-btn {
  border: none; background: transparent; color: #B9B9B1; font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 2px;
}
.rm-btn:hover { color: var(--coral-deep); background: rgba(255,140,105,.12); }

/* ---------- 快讯 ---------- */
.feed { display: flex; flex-direction: column; }
.feed-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 690px; overflow-y: auto;
}
.feed-item { padding: 10px 14px; border-bottom: 1px solid rgba(58,58,56,.1); }
.feed-item:last-child { border-bottom: none; }
.feed-item.new { animation: feed-in 1s ease-out; }
@keyframes feed-in {
  0% { background: rgba(244,211,94,.45); transform: translateY(-6px); }
  100% { background: transparent; transform: translateY(0); }
}
.feed-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.feed-time { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.feed-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  color: var(--gold); background: rgba(26,60,43,.9);
  padding: 1px 5px; border-radius: 2px;
}
.feed-title { font-size: 13px; line-height: 1.65; color: var(--ink-soft); display: block; }

/* ---------- 异动雷达 ---------- */
.movers { margin: 0 20px 14px; }
.tabs { display: flex; gap: 2px; }
.tabs button {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  padding: 4px 10px; background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 2px;
}
.tabs button.active { color: var(--paper); background: var(--forest); }
.tabs button:not(.active):hover { color: var(--forest); border-color: rgba(26,60,43,.35); }
.thresh {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--muted); letter-spacing: 0.08em;
}
.thresh select {
  font-family: var(--mono); font-size: 11px; color: var(--forest);
  background: transparent; border: 1px solid rgba(26,60,43,.35); border-radius: 2px; padding: 2px 4px;
}
.mover-body {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px;
  padding: 14px;
}
.mover-card { border: 1px solid var(--line); border-radius: 2px; padding: 10px 12px; }
.mover-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.mover-name { font-size: 13px; font-weight: 600; }
.mover-rank { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.mover-price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.mover-price .pr { font-family: var(--mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mover-price .pct { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.mover-bar { position: relative; height: 10px; background: rgba(58,58,56,.08); border-radius: 2px; overflow: hidden; }
.mover-bar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px; }
.mover-bar i.up { background: rgba(255,140,105,.55); }
.mover-bar i.down { background: rgba(23,122,69,.45); }
.mover-extra { margin-top: 5px; display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: 0.06em; }

/* ---------- 空态 & 页脚 & Toast ---------- */
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 12px; }
.foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--muted);
}
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.toast {
  background: var(--forest); color: var(--paper);
  border-left: 3px solid var(--gold);
  padding: 9px 12px; font-size: 12px; line-height: 1.5; border-radius: 2px;
  animation: toast-in .25s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .grid { grid-template-columns: 1fr; }
  .feed-list { max-height: 460px; }
}
@media (max-width: 760px) {
  .topbar { padding: 10px 12px; }
  .grid { padding: 10px 12px; }
  .ticker { padding: 10px 12px; }
  .movers { margin: 0 12px 12px; }
  .col-open, .col-range, .col-amount, .col-turnover, .col-cap { display: none; }
  .search { width: 170px; }
  #quoteTable td, #quoteTable th { padding: 7px 8px; }
  .toast-wrap { left: 12px; right: 12px; max-width: none; }
}
