:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #647081;
  --line: #dce2e8;
  --green: #148a62;
  --red: #c83f47;
  --blue: #2f66d0;
  --amber: #b7791f;
  --ink: #263244;
  --shadow: 0 12px 30px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

.date-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 10px 11px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 102, 208, 0.15);
}

.date-actions input {
  width: 156px;
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.button.primary {
  background: var(--blue);
  color: #fff;
}

.button.secondary {
  background: #223047;
  color: #fff;
}

.button.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.score-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.score-hero,
.score-bars,
.result-board,
.history {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.score-hero {
  display: flex;
  min-height: 196px;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

.score-hero span {
  font-size: clamp(56px, 8vw, 84px);
  line-height: 0.9;
  font-weight: 800;
}

.score-hero small {
  margin-top: 8px;
  color: var(--muted);
}

.score-hero strong {
  width: fit-content;
  margin-top: 16px;
  border-radius: 6px;
  padding: 7px 10px;
  background: #eef2f7;
  color: var(--ink);
}

.score-hero em {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.score-hero.hot strong {
  background: rgba(200, 63, 71, 0.12);
  color: var(--red);
}

.score-hero.strong strong {
  background: rgba(20, 138, 98, 0.12);
  color: var(--green);
}

.score-hero.flat strong {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.score-hero.weak strong {
  background: rgba(47, 102, 208, 0.12);
  color: var(--blue);
}

.score-bars {
  display: grid;
  gap: 14px;
  padding: 24px;
  align-content: center;
}

.bar-row {
  display: grid;
  grid-template-columns: 82px 1fr 52px;
  gap: 12px;
  align-items: center;
}

.bar-row span,
.bar-row b {
  font-size: 14px;
}

.bar-row b {
  text-align: right;
}

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

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.2s ease;
}

[data-score="profit"] .bar-fill,
[data-score="risk"] .bar-fill {
  background: var(--red);
}

[data-score="liquidity"] .bar-fill {
  background: var(--blue);
}

[data-score="theme"] .bar-fill {
  background: var(--amber);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 14px;
  align-items: start;
}

.result-board {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.trend-strip article {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
  padding: 14px;
}

.trend-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trend-strip b {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: clamp(19px, 2.2vw, 26px);
  line-height: 1.15;
}

.chart-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

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

.chart-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#intradayChart {
  display: block;
  width: 100%;
  min-height: 220px;
}

.chart-axis {
  stroke: #bac6d3;
  stroke-width: 1.2;
}

.chart-grid {
  stroke: #e6ecf2;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--red);
  stroke: #fff;
  stroke-width: 2;
}

.chart-label,
.chart-empty {
  fill: var(--muted);
  font-size: 13px;
}

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

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

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-grid b {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.15;
  word-break: break-word;
}

.notes-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.notes-panel pre {
  margin: 12px 0 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.history {
  position: sticky;
  top: 16px;
  overflow: hidden;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
  max-height: 620px;
}

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

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

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

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f2f6fb;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 5;
  max-width: min(380px, calc(100vw - 40px));
  margin: 0;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 1100px) {
  .workspace,
  .score-panel {
    grid-template-columns: 1fr;
  }

  .history {
    position: static;
  }
}

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

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

  .date-actions {
    justify-content: stretch;
  }

  .date-actions input,
  .date-actions .button {
    flex: 1 1 120px;
  }

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

  .bar-row {
    grid-template-columns: 74px 1fr 48px;
    gap: 8px;
  }

  th,
  td {
    padding: 10px;
  }
}
