:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #eef4f1;
  --ink: #18212b;
  --muted: #657384;
  --line: #d8dee6;
  --blue: #2456a6;
  --green: #057a55;
  --red: #b42318;
  --amber: #a15c07;
  --shadow: 0 8px 22px rgba(24, 33, 43, .07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.topbar p,
.section-head span,
footer,
.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button,
.icon-link {
  min-width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button:hover,
.icon-link:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  overflow-x: auto;
}

.tabs button {
  width: auto;
  min-width: 72px;
  height: 34px;
  padding: 0 12px;
}

.tabs .active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 18px 18px 58px;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

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

.metrics article,
.stock-card,
.band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metrics article {
  min-height: 86px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.band {
  margin-top: 14px;
  padding: 14px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.stock-card {
  min-height: 210px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.stock-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: #234036;
  font-size: 12px;
  white-space: nowrap;
}

.score {
  font-size: 28px;
  font-weight: 800;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

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

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

.neutral {
  color: var(--amber);
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfd;
}

td a {
  color: var(--blue);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

pre {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #e5edf5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 38px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  font-size: 13px;
}

@media (max-width: 760px) {
  .topbar {
    padding: 14px;
    align-items: flex-start;
  }

  h1 {
    font-size: 20px;
  }

  .tabs {
    padding: 8px 12px;
  }

  main {
    padding: 12px 10px 58px;
  }

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

  .section-head {
    display: grid;
  }
}
