:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d8dee8;
  --black: #111827;
  --blue: #2563eb;
  --teal: #0f766e;
  --amber: #b45309;
  --red: #dc2626;
  --green: #15803d;
  --shadow: 0 12px 30px rgba(24, 32, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button,
table,
pre {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: #101820;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar h1,
.panel h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 26px;
  line-height: 1.2;
}

.panel h2 {
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: inherit;
  opacity: 0.68;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.icon-button,
.command-button {
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: #ffffff;
  color: #111827;
  border-radius: 8px;
  min-height: 40px;
  box-shadow: none;
}

.icon-button {
  width: 42px;
  font-size: 22px;
  line-height: 1;
}

.command-button {
  padding: 0 16px;
  font-weight: 800;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.status-strip > div {
  min-height: 72px;
  padding: 13px 16px;
  background: #fff;
}

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

.status-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.1;
}

#quoteTimeLabel,
#notificationChannels {
  font-size: 16px;
  line-height: 1.25;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1.45fr) minmax(320px, 0.75fr) minmax(320px, 0.75fr);
  gap: 14px;
  align-items: stretch;
}

.quick-grid,
.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 70px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #526070;
  background: #f9fafc;
  font-size: 12px;
  font-weight: 800;
}

tbody tr {
  transition: background 120ms ease, color 120ms ease;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #eef6ff;
}

.rank {
  color: var(--muted);
  font-weight: 800;
}

.score {
  color: var(--blue);
  font-weight: 900;
}

.gain {
  color: var(--red);
  font-weight: 800;
}

.loss {
  color: var(--green);
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 180px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.p0 {
  background: var(--red);
}

.pill.short {
  background: var(--amber);
}

.pill.future {
  background: var(--teal);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 250px;
  padding: 12px 16px 0;
}

.bar-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 84px 1fr 54px;
  align-items: center;
  gap: 10px;
  min-height: 20px;
}

.bar-name,
.bar-value {
  color: #526070;
  font-size: 12px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #e8edf4;
}

.bar-fill {
  height: 100%;
  border-radius: 8px;
  background: var(--blue);
}

.bar-fill.negative {
  background: var(--red);
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #526070;
  font-size: 12px;
}

.legend-swatch {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.detail-panel {
  margin-top: 14px;
}

.sector-panel,
.pool-board-panel,
.ops-grid {
  margin-top: 14px;
}

.brief-box,
.terminal-list,
.rule-list,
.timeline-list {
  display: grid;
  gap: 10px;
  padding: 14px 18px 18px;
}

.brief-item {
  display: grid;
  gap: 4px;
  min-height: 42px;
}

.brief-item strong {
  font-size: 13px;
}

.brief-item span,
.rule-list li,
.timeline-list li {
  color: #445160;
  line-height: 1.55;
}

.terminal-list {
  min-height: 238px;
  align-content: start;
  background: #101820;
  color: #b8f7c2;
  font-family: Consolas, "Microsoft YaHei", monospace;
  border-radius: 0 0 8px 8px;
}

.terminal-line {
  display: grid;
  gap: 4px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.terminal-line:last-child {
  border-bottom: 0;
}

.terminal-line strong {
  color: #fff;
}

.sector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
}

.sector-card,
.pool-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.sector-card h3,
.pool-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.sector-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--amber);
  font-weight: 900;
}

.sector-card p,
.pool-card p {
  margin: 8px 0 0;
  color: #445160;
  line-height: 1.55;
}

.pool-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
}

.pool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.pool-stock {
  padding: 10px 0;
  border-top: 1px solid #edf0f5;
}

.pool-stock strong {
  display: block;
  margin-bottom: 4px;
}

.rule-list ul,
.timeline-list ul {
  margin: 0;
  padding-left: 18px;
}

.timeline-list li {
  margin: 0 0 8px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
}

.stock-card {
  min-height: 250px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.stock-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.stock-card p {
  margin: 9px 0 0;
  color: #445160;
  line-height: 1.55;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: #edf2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.news-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.news-item {
  display: grid;
  gap: 5px;
  padding: 12px 18px;
  background: #fff;
}

.news-item strong {
  line-height: 1.45;
}

.report-preview {
  height: 410px;
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 0;
  background: #fbfcfe;
  color: #263241;
  font-size: 13px;
  line-height: 1.6;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.is-loading {
  opacity: 0.68;
  pointer-events: none;
}

.error {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .dashboard-grid,
  .lower-grid,
  .quick-grid,
  .ops-grid {
    grid-template-columns: 1fr;
  }

  .detail-list,
  .sector-grid,
  .pool-board {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

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

  .topbar h1 {
    font-size: 22px;
  }

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

  .status-strip strong {
    font-size: 18px;
  }

  .detail-list,
  .legend,
  .sector-grid,
  .pool-board {
    grid-template-columns: 1fr;
  }
}
