:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #1d252c;
  --muted: #6b7785;
  --line: #dce3e8;
  --green: #13795b;
  --red: #b42318;
  --blue: #1b5f8c;
  --amber: #946200;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px;
}

.topbar,
.paneHeader,
.actions,
.quoteSearch {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 680;
}

h2 {
  font-size: 15px;
  font-weight: 680;
}

#statusLine {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.actions {
  gap: 10px;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #9bb2c3;
}

select {
  min-width: 190px;
  padding: 0 34px 0 10px;
}

button.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.iconButton {
  width: 36px;
  padding: 0;
  font-size: 18px;
}

input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  min-width: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.tablePane,
.detailPane section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 380px;
  gap: 14px;
}

.tablePane {
  min-width: 0;
  overflow: hidden;
}

.paneHeader {
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.paneNote {
  color: var(--muted);
  margin-top: 6px;
  font-size: 12px;
}

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

.poolTabs {
  display: inline-flex;
  padding: 3px;
  background: #eef2f5;
  border-radius: 8px;
}

.poolTab {
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
}

.poolTab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(20, 33, 45, 0.08);
}

.poolTab:disabled {
  cursor: default;
  opacity: 0.65;
}

.paneHeader input {
  width: min(360px, 45%);
}

.tableWrap {
  overflow: auto;
  max-height: calc(100vh - 220px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

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

tr {
  cursor: pointer;
}

tr:hover,
tr.selected {
  background: #eef6fb;
}

.stockName {
  font-weight: 650;
}

.sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef7f3;
  color: var(--green);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detailPane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.detailPane section {
  padding: 14px;
}

.quoteSearch {
  gap: 8px;
  margin-top: 12px;
}

.quoteSearch input {
  flex: 1;
}

.quotePanel,
.sectorList {
  margin-top: 12px;
}

.quoteGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kv {
  background: #f7f9fa;
  border: 1px solid #edf1f4;
  border-radius: 6px;
  padding: 10px;
}

.kv span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kv strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.kv.full {
  grid-column: 1 / -1;
}

.sector {
  padding: 10px 0;
  border-bottom: 1px solid #edf1f4;
}

.sector:last-child {
  border-bottom: 0;
}

.sectorTop {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.sectorMeta {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.sectorStocks {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

pre {
  min-height: 96px;
  max-height: 240px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 10px;
  background: #1f2933;
  color: #e8eef2;
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
}

.pos {
  color: var(--red);
}

.neg {
  color: var(--green);
}

@media (max-width: 980px) {
  .shell {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .paneHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .paneTools {
    align-items: stretch;
    flex-direction: column;
  }

  .paneHeader input {
    width: 100%;
  }
}
