:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66737c;
  --line: #dce3df;
  --blue: #1e6bff;
  --green: #10865f;
  --red: #cf3f3f;
  --amber: #b06c00;
  --violet: #6e4fd8;
  --soft-blue: #eaf1ff;
  --soft-green: #e8f6ef;
  --soft-red: #fdecec;
  --soft-amber: #fff4dd;
  --shadow: 0 16px 45px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(16px, 4vw, 44px);
  background: rgba(245, 247, 243, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar h1,
.section-head h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.status-strip strong {
  color: var(--ink);
}

.shell {
  display: grid;
  gap: 22px;
  padding: 24px clamp(16px, 4vw, 44px) 48px;
}

.shell > *,
.market-grid > *,
.metric-grid > *,
.analysis-grid > *,
.strategy-layout > *,
.section-head > * {
  min-width: 0;
}

.market-panel,
.filters,
.results,
.pool-section,
.llm-section,
.analysis-grid article,
.summary-block,
.visual-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.market-panel,
.pool-section,
.llm-section {
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2 {
  font-size: 21px;
}

.compact {
  margin-bottom: 14px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.ai-console {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.ai-console label,
.ask-grid label {
  display: grid;
  gap: 6px;
  color: #334149;
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input[type="text"] {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 104px;
  padding: 10px;
  resize: vertical;
  line-height: 1.55;
}

.primary-button {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button:disabled,
.icon-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.market-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.4fr);
  gap: 16px;
}

.summary-block,
.visual-block,
.analysis-grid article {
  padding: 16px;
  box-shadow: none;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.block-title h3 {
  margin: 0;
  font-size: 16px;
}

.icon-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.blue {
  background: var(--blue);
}

.green {
  background: var(--green);
}

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

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

.violet {
  background: var(--violet);
}

.muted {
  color: var(--muted);
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.summary-list li {
  padding-left: 14px;
  border-left: 3px solid var(--line);
  color: #334149;
  line-height: 1.55;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 260px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric-card {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.metric-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  font-size: 24px;
}

.metric-card span {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.up {
  color: var(--green);
  background: var(--soft-green);
}

.down {
  color: var(--red);
  background: var(--soft-red);
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 16px;
}

.sector-bars {
  display: grid;
  gap: 12px;
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(86px, 120px) 1fr 62px;
  align-items: center;
  gap: 10px;
}

.sector-row b {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #edf1ee;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item b {
  display: block;
  margin-bottom: 4px;
}

.news-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.strategy-layout {
  display: grid;
  grid-template-columns: minmax(250px, 300px) 1fr;
  gap: 18px;
}

.filters,
.results {
  padding: 18px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
  position: sticky;
  top: 90px;
}

.filters label {
  display: grid;
  gap: 7px;
  color: #334149;
  font-weight: 700;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.range-value {
  color: var(--muted);
  font-weight: 700;
}

.checkline {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.checkline input {
  width: 16px;
  height: 16px;
}

.note {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft-amber);
  color: #684300;
  font-size: 13px;
  line-height: 1.55;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  position: sticky;
  top: 0;
  background: #f8faf8;
  color: var(--muted);
  font-size: 12px;
  z-index: 1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.stock-name {
  display: grid;
  gap: 3px;
  min-width: 112px;
}

.stock-name b {
  font-size: 14px;
}

.score {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
}

.score.high {
  background: var(--green);
}

.score.mid {
  background: var(--amber);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 6px;
  background: #eef2f5;
  color: #38454d;
  font-weight: 700;
  white-space: nowrap;
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 360px;
}

.pool-rule {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.ask-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.answer-box {
  min-height: 94px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: #334149;
  line-height: 1.65;
  white-space: pre-wrap;
}

.pool-card {
  min-height: 166px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.pool-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pool-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.mini-chart {
  width: 100%;
  height: 50px;
  margin: 8px 0 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f6faf8, #edf5f0);
}

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

@media (max-width: 1180px) {
  .metric-grid,
  .pool-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

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

@media (max-width: 860px) {
  .topbar,
  .section-head,
  .market-grid,
  .ai-console,
  .ask-grid,
  .strategy-layout {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    align-items: stretch;
  }

  .topbar {
    display: grid;
  }

  .market-grid,
  .strategy-layout {
    display: grid;
  }

  .filters {
    position: static;
  }

  .pool-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .market-panel,
  .pool-section,
  .filters,
  .results {
    padding: 14px;
  }

  .sector-row {
    grid-template-columns: minmax(70px, 92px) 1fr 52px;
  }

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