/* ==========================================================================
   宝链 V1.01 五池看板 —— 样式
   约定：
     · 涨/盈利 = 红色，跌/亏损 = 绿色（国内行情惯例，与欧美相反）
     · 深色底 + 浅色字，长时间盯盘不刺眼
   ========================================================================== */

:root {
  --bg:        #0b0f17;
  --bg-soft:   #111725;
  --panel:     #141b2a;
  --panel-2:   #1a2233;
  --border:    #232d42;
  --border-2:  #2e3a52;
  --text:      #e6edf7;
  --text-dim:  #9aa9c2;
  --text-mute: #6b7a94;

  --up:        #ff4d4f;   /* 涨 / 盈利 */
  --down:      #22c55e;   /* 跌 / 亏损 */
  --accent:    #4c8dff;
  --warn:      #f5a524;
  --danger:    #ff4d4f;

  --pool-a:    #f5b301;
  --pool-b:    #4c8dff;
  --pool-c:    #34d399;
  --pool-d:    #a78bfa;
  --pool-e:    #8b9bb4;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 6px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: 12px;
}

.wrap { max-width: 1560px; margin: 0 auto; padding: 16px 20px 56px; }

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(11, 15, 23, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 16px; margin: 0; letter-spacing: .3px; }
.brand .ver { font-size: 11px; color: var(--text-mute); }
.brand .sub { font-size: 11px; color: var(--text-mute); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; line-height: 18px;
  border: 1px solid var(--border-2); color: var(--text-dim);
  white-space: nowrap;
}
.badge.mock  { color: #ffd479; border-color: #6b5518; background: #2a2213; }
.badge.live  { color: #86efac; border-color: #1c4d31; background: #10281c; }
.badge.sim   { color: #ffd479; border-color: #6b5518; background: #2a2213; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute); }
.dot.on  { background: var(--down); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 77, 79, .18); }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  appearance: none; cursor: pointer;
  padding: 6px 13px; border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-2); font-size: 12px;
  transition: .15s;
}
.btn:hover { background: #212c42; border-color: #3b4a67; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: #1e3a6b; border-color: #2f5da8; color: #cfe0ff; }
.btn.primary:hover { background: #24478a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  appearance: none; border: 0; background: var(--panel-2); color: var(--text-dim);
  padding: 6px 11px; font-size: 12px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border-2); }
.seg button.active { background: #22314e; color: var(--text); }

input[type="text"], input[type="search"], select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 5px 9px; font-size: 12px; outline: none; min-width: 90px;
}
input:focus, select:focus { border-color: #3b5fa8; }
label.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-dim); cursor: pointer; }

/* ---------------------------------------------------------------- 提示条 */

.notice {
  display: none; gap: 8px; align-items: flex-start;
  margin: 12px 0 0; padding: 9px 13px;
  border-radius: var(--radius-sm); font-size: 12px;
  border: 1px solid #6b5518; background: #221c10; color: #ffd479;
}
.notice.show { display: flex; }
.notice.err { border-color: #7a2020; background: #2a1414; color: #ffb3b3; }

/* ---------------------------------------------------------------- 指标条 */

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px; margin: 16px 0 6px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px;
}
.kpi .k { font-size: 11px; color: var(--text-mute); display: flex; justify-content: space-between; gap: 6px; }
.kpi .v { font-size: 21px; font-weight: 600; margin-top: 3px; letter-spacing: .3px; }
.kpi .n { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.v.up { color: var(--up); }
.v.down { color: var(--down); }

/* ---------------------------------------------------------------- 区块 */

.section { margin-top: 22px; }
.section-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.section-head h2 { font-size: 14px; margin: 0; font-weight: 600; }
.section-head .hint { font-size: 11px; color: var(--text-mute); margin-right: auto; }
.section-head .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

/* ---------------------------------------------------------------- 五池卡片 */

.pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 12px; }

.pool {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px;
  cursor: pointer; transition: .18s; position: relative; overflow: hidden;
}
.pool:hover { border-color: var(--border-2); transform: translateY(-2px); }
.pool.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(76, 141, 255, .5); }
.pool::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--pool-e);
}
.pool[data-level="A"]::before { background: var(--pool-a); }
.pool[data-level="B"]::before { background: var(--pool-b); }
.pool[data-level="C"]::before { background: var(--pool-c); }
.pool[data-level="D"]::before { background: var(--pool-d); }
.pool[data-level="E"]::before { background: var(--pool-e); }

.pool-head { display: flex; align-items: center; gap: 8px; }
.lvl {
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: #22314e; color: #cfe0ff; flex: none;
}
.pool[data-level="A"] .lvl { background: #3d3012; color: var(--pool-a); }
.pool[data-level="B"] .lvl { background: #1b3055; color: #9dc0ff; }
.pool[data-level="C"] .lvl { background: #12362a; color: #7fe0bb; }
.pool[data-level="D"] .lvl { background: #2b2145; color: #c7b3ff; }
.pool[data-level="E"] .lvl { background: #232c3d; color: #b6c1d4; }

.pool-name { font-weight: 600; font-size: 13px; }
.pool-thr { font-size: 11px; color: var(--text-mute); margin-left: auto; text-align: right; }

.pool-count { display: flex; align-items: baseline; gap: 6px; margin: 11px 0 7px; }
.pool-count .num { font-size: 27px; font-weight: 700; line-height: 1; }
.pool-count .unit { font-size: 11px; color: var(--text-mute); }
.pool-count .avg { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.pool-count .avg b { color: var(--text); font-size: 13px; }

.bar { height: 5px; border-radius: 3px; background: #1d2534; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.pool[data-level="A"] .bar > i { background: var(--pool-a); }
.pool[data-level="B"] .bar > i { background: var(--pool-b); }
.pool[data-level="C"] .bar > i { background: var(--pool-c); }
.pool[data-level="D"] .bar > i { background: var(--pool-d); }
.pool[data-level="E"] .bar > i { background: var(--pool-e); }

.pool-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 9px; font-size: 11px; color: var(--text-mute); }
.pool-meta b { color: var(--text-dim); font-weight: 500; }
.ladder { display: flex; gap: 4px; margin-top: 9px; flex-wrap: wrap; }
.stage {
  font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  background: #1a2233; border: 1px solid var(--border); color: var(--text-dim);
}
.stage.stop { color: #ffb3b3; border-color: #5c2626; background: #241416; }

/* ---------------------------------------------------------------- 表格 */

table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  text-align: left; padding: 9px 11px; font-weight: 600; font-size: 11px;
  color: var(--text-mute); background: var(--panel-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
tbody td { padding: 8px 11px; border-bottom: 1px solid #1b2434; vertical-align: middle; }
tbody tr:hover { background: #172033; }
tbody tr.clickable { cursor: pointer; }
tbody tr.rejected { opacity: .62; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-scroll { max-height: 460px; overflow: auto; }
.empty { padding: 26px; text-align: center; color: var(--text-mute); font-size: 12px; }

.sym { font-weight: 600; }
.addr { font-size: 11px; color: var(--text-mute); font-family: Consolas, monospace; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; line-height: 17px; border: 1px solid var(--border-2);
  color: var(--text-dim); white-space: nowrap;
}
.tag.lv-A { color: var(--pool-a); border-color: #6b5518; background: #241d0f; }
.tag.lv-B { color: #9dc0ff; border-color: #24427a; background: #131f36; }
.tag.lv-C { color: #7fe0bb; border-color: #1c4d3b; background: #102420; }
.tag.lv-D { color: #c7b3ff; border-color: #453465; background: #1d1830; }
.tag.lv-E { color: #b6c1d4; border-color: #313c52; background: #1a2130; }
.tag.rej  { color: #ffb3b3; border-color: #5c2626; background: #241416; }
.tag.buy  { color: #ffb3b3; border-color: #5c2626; background: #241416; }
.tag.sell { color: #86efac; border-color: #1c4d31; background: #10281c; }
.tag.stop { color: #ffd479; border-color: #6b5518; background: #241d0f; }

.score-bar { display: inline-flex; align-items: center; gap: 7px; }
.score-bar .sb { width: 46px; height: 5px; border-radius: 3px; background: #1d2534; overflow: hidden; }
.score-bar .sb > i { display: block; height: 100%; }

/* ---------------------------------------------------------------- 抽屉 */

.drawer-mask {
  position: fixed; inset: 0; background: rgba(4, 7, 12, .6);
  opacity: 0; pointer-events: none; transition: .2s; z-index: 60;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw);
  background: var(--bg-soft); border-left: 1px solid var(--border-2);
  box-shadow: var(--shadow); z-index: 61;
  transform: translateX(102%); transition: transform .24s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 { margin: 0; font-size: 14px; }
.drawer-head .close { margin-left: auto; }
.drawer-body { overflow: auto; padding: 14px 16px 40px; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; margin-bottom: 14px; }
.kv > div { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.kv .k { font-size: 10.5px; color: var(--text-mute); }
.kv .v { font-size: 14px; font-weight: 600; margin-top: 2px; }

.sub { font-size: 12px; color: var(--text-dim); margin: 16px 0 7px; font-weight: 600; }
.dim-row { display: grid; grid-template-columns: 30px 1fr 58px 74px; gap: 8px; align-items: center;
           padding: 6px 0; border-bottom: 1px solid #1b2434; }
.dim-row .id { color: var(--text-mute); font-size: 11px; }
.dim-row .nm { font-size: 12px; }
.dim-row .sc { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.dim-row .mb { height: 5px; border-radius: 3px; background: #1d2534; overflow: hidden; }
.dim-row .mb > i { display: block; height: 100%; background: var(--accent); }
.dim-row .mb > i.full { background: var(--down); }
.dim-row .mb > i.zero { background: #3a4459; }
.dim-sub { font-size: 11px; color: var(--text-mute); padding: 3px 0 3px 30px; display: flex; gap: 10px; flex-wrap: wrap; }
.dim-sub span { white-space: nowrap; }

.layer { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 7px; }
.layer.ok    { border-color: #1c4d3b; background: #10211c; }
.layer.bad   { border-color: #5c2626; background: #241416; }
.layer.warn  { border-color: #6b5518; background: #221c10; }
.layer .lh { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.layer .lh .tag { margin-left: auto; }
.layer p { margin: 5px 0 0; font-size: 11.5px; color: var(--text-dim); }

/* ---------------------------------------------------------------- 图表 */

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.chart-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 4px; }
.chart-card h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.chart { height: 208px; width: 100%; }

/* ---------------------------------------------------------------- 实时流 */

.stream { max-height: 260px; overflow: auto; font-family: Consolas, "Cascadia Mono", monospace; font-size: 11.5px; }
.stream-line { display: flex; gap: 8px; padding: 3px 11px; border-bottom: 1px solid #161e2c; }
.stream-line:hover { background: #172033; }
.stream-line .t { color: var(--text-mute); flex: none; }
.stream-line .c { color: #7b8aa5; flex: none; width: 108px; overflow: hidden; text-overflow: ellipsis; }
.stream-line .l { flex: none; width: 62px; font-weight: 600; }
.stream-line .m { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-DEBUG   { color: #6b7a94; }
.lv-INFO    { color: #7dd3fc; }
.lv-SUCCESS { color: var(--down); }
.lv-TRADE   { color: #d8b4fe; }
.lv-WARNING { color: var(--warn); }
.lv-ERROR   { color: var(--danger); }

/* ---------------------------------------------------------------- 时间线 */

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 9px 0 9px 4px; }
.tl-item::before {
  content: ""; position: absolute; left: -23px; top: 14px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--border-2);
}
.tl-item.danger::before  { background: var(--danger); }
.tl-item.success::before { background: var(--down); }
.tl-item .tl-t { font-size: 11px; color: var(--text-mute); }
.tl-item .tl-h { font-size: 12.5px; margin-top: 1px; }
.tl-item .tl-d { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.tl-item a { font-size: 11.5px; }

.footer { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-mute); }
.footer code { color: #7b8aa5; }

@media (max-width: 720px) {
  .wrap { padding: 12px; }
  .kpi .v { font-size: 18px; }
  thead th, tbody td { padding: 7px 8px; }
}
