:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #eef2f6;
  color: #1d2633;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  max-width: 1480px;
  margin: 0 auto;
}

.control-panel,
.content,
.chart-panel,
.table-panel {
  background: #ffffff;
  border: 1px solid #dbe3ec;
  box-shadow: 0 18px 45px rgba(35, 45, 60, 0.08);
}

.control-panel {
  border-radius: 8px;
  padding: 22px;
  align-self: start;
  position: sticky;
  top: 24px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 26px;
}

.brand > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #16324f;
  color: #ffffff;
  font-weight: 800;
}

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

h1 {
  font-size: 23px;
}

.brand p,
.summary span,
.hint,
.table-head span {
  color: #657284;
  font-size: 13px;
}

form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: #344154;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 11px 12px;
  color: #172033;
  background: #fbfdff;
  outline: none;
}

input:focus,
select:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button {
  border: 0;
  border-radius: 6px;
  background: #1f6feb;
  color: #ffffff;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  background: #8aaee8;
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: -6px;
}

.preset {
  border: 1px solid #d4deea;
  background: #f8fafc;
  color: #344154;
  padding: 9px 8px;
  font-size: 12px;
}

.preset.active {
  border-color: #1f6feb;
  background: #e8f1ff;
  color: #174ea6;
}

.hint {
  margin-top: 18px;
  line-height: 1.6;
  padding: 12px;
  border-radius: 6px;
  background: #f6f8fb;
}

.param-notes {
  margin-top: 12px;
  border: 1px solid #e1e8f0;
  border-radius: 8px;
  padding: 13px;
  color: #344154;
  font-size: 13px;
  background: #fbfdff;
}

.param-notes strong {
  display: block;
  margin-bottom: 8px;
}

.param-notes ul {
  margin: 0;
  padding-left: 18px;
}

.param-notes li {
  margin: 6px 0;
  line-height: 1.45;
}

.error {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b42318;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.content {
  border-radius: 8px;
  padding: 20px;
  display: grid;
  gap: 18px;
}

.summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  color: #1f6feb;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

h2 {
  font-size: 30px;
  margin-bottom: 6px;
}

.legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #536174;
  padding-top: 8px;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 10px;
  margin-right: 7px;
  vertical-align: middle;
}

.legend-price::before {
  background: #1f6feb;
}

.legend-upper::before {
  background: #138a4b;
}

.legend-middle::before {
  background: #c2410c;
}

.legend-lower::before {
  background: #7c3aed;
}

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

.stat {
  border: 1px solid #e1e8f0;
  border-radius: 8px;
  padding: 15px;
  background: #fbfdff;
}

.stat span {
  display: block;
  color: #657284;
  font-size: 12px;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 24px;
}

.up {
  color: #138a4b;
}

.down {
  color: #c7332f;
}

.chart-panel,
.table-panel {
  border-radius: 8px;
  padding: 16px;
}

.chart {
  display: block;
  width: 100%;
  height: 320px;
}

.grid-line {
  stroke: #e8eef5;
  stroke-width: 2;
}

.price-line,
.middle-line,
.upper-line,
.lower-line {
  fill: none;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.price-line {
  stroke: #1f6feb;
}

.middle-line {
  stroke: #c2410c;
}

.upper-line {
  stroke: #138a4b;
}

.lower-line {
  stroke: #7c3aed;
}

.empty-chart {
  height: 320px;
  display: grid;
  place-items: center;
  color: #657284;
  background: #f8fafc;
  border-radius: 6px;
}

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

h3 {
  font-size: 18px;
}

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

table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #e7edf4;
  text-align: right;
  white-space: nowrap;
}

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

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #536174;
  z-index: 1;
}

.middle-cell {
  color: #b45309;
  font-weight: 800;
}

.upper-cell {
  color: #138a4b;
  font-weight: 800;
}

.lower-cell {
  color: #6d28d9;
  font-weight: 800;
}

@media (max-width: 980px) {
  .shell {
    padding: 14px;
  }

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

  .control-panel {
    position: static;
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .date-grid,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .summary {
    display: grid;
  }

  h2 {
    font-size: 24px;
  }

  .legend {
    flex-wrap: wrap;
  }
}
