:root {
  --bg0: #e9eef2;
  --bg1: #f7fafc;
  --ink: #14212b;
  --muted: #5a6b78;
  --line: #c5d0d8;
  --up: #b42318;
  --down: #0f6b45;
  --accent: #0b5f7a;
  --accent-soft: #d4e8ef;
  --chip: #ffffffcc;
  --shadow: 0 8px 24px rgba(20, 33, 43, 0.07);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 0% 0%, #d9e8e4 0%, transparent 55%),
    radial-gradient(800px 380px at 100% 0%, #dce4ec 0%, transparent 50%),
    linear-gradient(180deg, #eef3f6, var(--bg0));
  color: var(--ink);
  font-family: var(--sans);
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 0;
  align-items: start;
  min-height: 100vh;
  position: relative;
}

.app-shell.side-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.side-hidden .pool-side {
  display: none;
}

.app-shell.side-hidden .side-reopen {
  display: inline-flex;
}

.page {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 18px 40px;
  min-width: 0;
}

.pool-side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(247, 250, 252, 0.92);
  backdrop-filter: blur(6px);
}

.pool-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--line);
}

.pool-head strong {
  display: block;
  font-size: 0.95rem;
}

.pool-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--mono);
}

.pool-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.side-block {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.side-block#symbolPoolBlock {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-block#symbolPoolBlock .pool-list {
  flex: 1;
  min-height: 0;
}

.side-block.folded .side-block-body,
.side-block.folded .pool-list,
.side-block.folded .basket-sector-list,
.side-block.folded .pool-scout-toggle {
  display: none;
}

.side-block-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.45);
}

.side-fold-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.side-fold-btn .fold-mark {
  color: var(--muted);
  font-size: 0.72rem;
}

.side-block.folded .side-fold-btn .fold-mark {
  transform: rotate(-90deg);
  display: inline-block;
}

.side-block-head small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.side-block-head .pool-actions {
  margin-left: auto;
}

.basket-sector-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 8px 10px;
  flex-shrink: 0;
  max-height: none;
  overflow: visible;
}

.basket-sec-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  flex-direction: row;
}

.basket-sec-item.off {
  color: var(--muted);
  background: #f1f4f6;
  border-style: dashed;
  text-decoration: line-through;
}

.basket-sec-item input {
  margin: 0;
  width: 12px;
  height: 12px;
  accent-color: var(--accent);
}

.side-reopen {
  display: none;
  position: fixed;
  left: 0;
  top: 72px;
  z-index: 20;
  writing-mode: vertical-rl;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--bg1);
  color: var(--accent);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 12px 6px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.pool-scout-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-direction: row;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.55);
}

.pool-scout-toggle input {
  margin: 0;
  accent-color: var(--accent);
}

.pool-scout-toggle small {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.68rem;
}

.pool-scout-toggle:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-tiny {
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}

.btn-tiny:hover {
  background: var(--accent-soft);
}

.pool-list {
  flex: 1;
  overflow: auto;
  padding: 6px 8px 12px;
}

.pool-sector {
  margin-bottom: 8px;
}

.pool-sector-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 2px 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
}

.pool-sector-head label {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-direction: row;
  margin: 0;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

.pool-sector-head .n {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.64rem;
}

.pool-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.pool-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 4px 5px;
  border-radius: 6px;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.pool-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pool-item:has(input:checked) {
  border-color: rgba(11, 95, 122, 0.35);
  background: #fff;
}

.pool-item.off,
.pool-item:not(:has(input:checked)) {
  color: var(--muted);
  background: #f1f4f6;
  border-style: dashed;
}

.pool-item.off .sym,
.pool-item:not(:has(input:checked)) .sym {
  text-decoration: line-through;
  opacity: 0.85;
}

.pool-item input {
  margin: 0;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.pool-item .sym {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .pool-side {
    position: relative;
    height: auto;
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.brand { display: flex; gap: 12px; align-items: center; }

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0b5f7a, #0f6b45);
  color: #f4f8fa;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}

h1 { margin: 0; font-size: 1.35rem; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 0.86rem; }

.controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.mode-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  align-self: end;
  margin-bottom: 1px;
}

.mode-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  box-shadow: none;
}

.mode-toggle button:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.mode-toggle button.active {
  background: var(--accent);
  color: #f5fafc;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
}

select, button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #f5fafc;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-secondary {
  background: var(--bg1);
  color: var(--accent);
  border: 1px solid var(--line);
  font-weight: 600;
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}

.btn-link:hover {
  background: var(--accent-soft);
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: stretch;
  padding: 10px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 33, 43, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(20, 33, 43, 0.22);
  overflow: hidden;
}

.modal-card .panel-head {
  flex-shrink: 0;
  flex-wrap: wrap;
}

.scout-meta {
  margin: 0;
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.scout-wrap {
  flex: 1;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

#scoutTable {
  width: 100%;
  table-layout: fixed;
  font-size: 0.68rem;
}

#scoutTable th,
#scoutTable td {
  padding: 3px 2px;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
  vertical-align: middle;
  line-height: 1.25;
}

#scoutTable th:nth-child(1),
#scoutTable td:nth-child(1),
#scoutTable th:nth-child(2),
#scoutTable td:nth-child(2) {
  text-align: left;
}

/* column widths tuned so one screen, no bottom scrollbar */
#scoutTable th:nth-child(1),
#scoutTable td:nth-child(1) { width: 4%; }     /* 品种 */
#scoutTable th:nth-child(2),
#scoutTable td:nth-child(2) { width: 7%; }     /* 合约 */
#scoutTable th:nth-child(3),
#scoutTable td:nth-child(3) { width: 4%; }     /* 中趋 */
#scoutTable th:nth-child(4),
#scoutTable td:nth-child(4) { width: 4%; }     /* lots */
#scoutTable th:nth-child(5),
#scoutTable td:nth-child(5) { width: 4%; }     /* 精选 */
#scoutTable th:nth-child(6),
#scoutTable td:nth-child(6) { width: 6%; }     /* 性价比 */
#scoutTable th:nth-child(7),
#scoutTable td:nth-child(7) { width: 5.5%; }   /* 费率 */
#scoutTable th:nth-child(8),
#scoutTable td:nth-child(8) { width: 5.5%; }   /* 今额 */
#scoutTable th:nth-child(9),
#scoutTable td:nth-child(9) { width: 5.5%; }   /* 昨额 */
#scoutTable th:nth-child(10),
#scoutTable td:nth-child(10) { width: 6%; }    /* 额涨 */
#scoutTable th:nth-child(11),
#scoutTable td:nth-child(11) { width: 6%; }    /* 今ATR */
#scoutTable th:nth-child(12),
#scoutTable td:nth-child(12) { width: 6%; }    /* 昨ATR */
#scoutTable th:nth-child(13),
#scoutTable td:nth-child(13) { width: 5.5%; }  /* ATR率 */
#scoutTable th:nth-child(14),
#scoutTable td:nth-child(14) { width: 6%; }    /* ATR涨 */
#scoutTable th:nth-child(15),
#scoutTable td:nth-child(15) { width: 7%; }    /* 动向 */
#scoutTable th:nth-child(16),
#scoutTable td:nth-child(16) { width: 7%; }    /* 关注 */

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--accent);
}

th.sortable.sort-asc::after,
th.sortable.sort-desc::after {
  font-size: 0.65em;
  color: var(--accent);
}

th.sortable.sort-asc::after { content: " ▲"; }
th.sortable.sort-desc::after { content: " ▼"; }

#scoutTable th {
  cursor: pointer;
  user-select: none;
}

#scoutTable th:hover {
  color: var(--accent);
}

#scoutTable th.sort-asc::after {
  content: " ▲";
  font-size: 0.65em;
  color: var(--accent);
}

#scoutTable th.sort-desc::after {
  content: " ▼";
  font-size: 0.65em;
  color: var(--accent);
}

td.scout-yes { color: var(--up); font-weight: 600; }
td.scout-focus { color: #9a5b00; font-weight: 600; }
td.scout-mid-long { color: var(--up); }
td.scout-mid-short { color: var(--down); }

.strength-stack {
  margin-bottom: 12px;
  padding: 12px 14px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(11, 95, 122, 0.08), transparent 55%),
    var(--bg1);
  box-shadow: var(--shadow);
}

.stack-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.stack-caption { font-weight: 600; color: var(--ink); }

.stack-table-wrap {
  max-height: none;
  overflow: auto;
  border: 0;
  background: transparent;
}

.stack-table {
  width: 100%;
  border-collapse: collapse;
}

.stack-table th,
.stack-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.stack-table th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.55);
  position: sticky;
  top: 0;
  z-index: 1;
}

.stack-table th:not(:first-child),
.stack-table td:not(:first-child) {
  text-align: right;
  font-family: var(--mono);
}

.stack-table tbody tr.basket-row {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.72);
}

.stack-table tbody tr.basket-row:hover {
  background: rgba(15, 23, 42, 0.04);
}

.stack-table tbody tr.basket-row.active {
  background: var(--accent-soft);
}

.stack-table tbody tr.basket-row td:first-child {
  font-weight: 700;
  font-size: 1rem;
}

.stack-table tbody tr.sector-row {
  cursor: pointer;
}

.stack-table tbody tr.sector-row:hover {
  background: rgba(11, 95, 122, 0.05);
}

.stack-table tbody tr.sector-row.active {
  background: rgba(11, 95, 122, 0.1);
}

.stack-table .name-cell strong {
  font-size: 0.92rem;
}

.stack-table .name-cell small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.stack-table td.up { color: var(--up); font-weight: 600; }
.stack-table td.down { color: var(--down); font-weight: 600; }
.stack-table td.flat { color: var(--muted); }

.status-footer {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.72rem;
}

.status-footer b {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--muted);
}

.status-footer b.up { color: var(--up); }
.status-footer b.down { color: var(--down); }

.th-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}

.layout.single {
  grid-template-columns: 1fr;
}


.panel {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel.wide { min-width: 0; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 { margin: 0; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.75rem; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.table-wrap { overflow: auto; max-height: 62vh; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

table.dense { font-size: 0.8rem; }

th, td {
  padding: 7px 8px;
  border-bottom: 1px solid #e2e8ed;
  text-align: right;
  white-space: nowrap;
}

th:nth-child(1), td:nth-child(1),
th:nth-child(2), td:nth-child(2),
th:nth-child(3), td:nth-child(3) {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #f0f5f8;
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}

tr.active { background: var(--accent-soft); }
tr:hover { background: #f3f7fa; }

.name-cell { display: flex; flex-direction: column; }
.name-cell small { color: var(--muted); font-size: 0.72rem; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

.heat {
  display: inline-block;
  min-width: 42px;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-weight: 600;
}

.mid-tag {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  line-height: 1.15;
}

.mid-tag .mid-day {
  font-size: 0.62rem;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 1px;
}

.mid-tag.long { background: #fde8e6; color: var(--up); }
.mid-tag.short { background: #e5f4ec; color: var(--down); }
.mid-tag.flat, .mid-tag.na { background: #eef2f5; color: var(--muted); }

.bar {
  display: inline-block;
  width: 52px;
  height: 6px;
  background: #dfe7ec;
  border-radius: 99px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 4px;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.error {
  background: #fde8e6;
  color: var(--up);
  border: 1px solid #f0c2bc;
  border-radius: 8px;
  padding: 8px 12px;
}

@media (max-width: 1100px) {
  .layout, .boards { grid-template-columns: 1fr; }
}
