:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #13202f;
  --muted: #637083;
  --line: #d9e1ec;
  --panel: #ffffff;
  --accent: #146c94;
  --accent-2: #d9862b;
  --positive: #16835a;
  --negative: #c84d4d;
  --shadow: 0 18px 42px rgba(31, 45, 72, 0.1);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(20, 108, 148, 0.12), transparent 36rem),
    radial-gradient(circle at 88% 8%, rgba(217, 134, 43, 0.12), transparent 28rem),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px 2px 20px;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.summary {
  max-width: 780px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.status-pill {
  min-width: 120px;
  border: 1px solid rgba(20, 108, 148, 0.18);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
}

.status-pill.error {
  border-color: rgba(200, 77, 77, 0.24);
  color: var(--negative);
}

.panel,
.metric-card {
  border: 1px solid rgba(19, 32, 47, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.symbol-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 150px auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.metric-card span,
.metric-card small,
.panel-title p,
.helper-row,
th {
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 108, 148, 0.14);
}

.symbol-form button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #f5f8fb;
  color: var(--accent);
}

.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

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

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 20px;
}

.metric-card strong {
  align-self: end;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-panel,
.notes-panel,
.table-panel {
  overflow: hidden;
  padding: 18px;
}

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

.panel-title p {
  margin-top: 6px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.line {
  width: 24px;
  height: 3px;
  border-radius: 99px;
}

.ratio-line {
  background: var(--accent);
}

.value-line {
  background: var(--accent-2);
}

.chart-wrap {
  position: relative;
  min-height: 460px;
}

.relation-panel {
  margin-bottom: 16px;
}

.relation-wrap {
  min-height: 400px;
}

canvas {
  display: block;
  width: 100%;
  height: 460px;
}

#relationChart {
  height: 400px;
}

.tooltip {
  position: absolute;
  z-index: 2;
  min-width: 210px;
  border: 1px solid rgba(19, 32, 47, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 32px rgba(31, 45, 72, 0.16);
  color: var(--ink);
  font-size: 13px;
  pointer-events: none;
}

.tooltip strong {
  display: block;
  margin-bottom: 6px;
}

.tooltip div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
}

.notes-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.notes-panel p,
.note-list span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

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

.note-list div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfdff;
}

.note-list strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

tbody tr:hover {
  background: #f7fafc;
}

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

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

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

@media (max-width: 980px) {
  .hero,
  .helper-row,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .symbol-form,
  .metrics,
  .workspace {
    grid-template-columns: 1fr;
  }

  .chart-wrap,
  canvas {
    min-height: 360px;
    height: 360px;
  }
}

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

  .hero {
    padding-top: 14px;
  }

  h1 {
    font-size: 36px;
  }

  .summary,
  .notes-panel,
  .ranking-panel {
    display: none;
  }

  .search-panel,
  .chart-panel,
  .table-panel {
    padding: 14px;
  }

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

  .metric-card {
    min-height: 104px;
    padding: 14px;
  }

  .metric-card strong {
    font-size: 22px;
  }

  .workspace {
    display: block;
  }

  .chart-wrap,
  canvas {
    min-height: 300px;
    height: 300px;
  }

  .relation-wrap,
  #relationChart {
    min-height: 280px;
    height: 280px;
  }

  .legend {
    justify-content: flex-start;
  }

  table {
    min-width: 0;
  }

  th,
  td {
    padding: 11px 10px;
    font-size: 13px;
  }

  th:nth-child(5),
  td:nth-child(5),
  th:nth-child(6),
  td:nth-child(6) {
    display: none;
  }
}
