:root {
  --bg: #eef1f3;
  --surface: #ffffff;
  --surface-muted: #f6f8f9;
  --ink: #12202c;
  --ink-soft: #52616e;
  --muted: #7a8791;
  --line: #d8dee3;
  --line-strong: #bcc7cf;
  --up: #c4473b;
  --up-soft: #f8e9e6;
  --down: #158267;
  --down-soft: #e8f4f0;
  --amber: #ad761d;
  --amber-soft: #f8f0df;
  --navy: #173d57;
  --blue-soft: #e8f0f5;
  --radius: 8px;
  --shadow: 0 8px 30px rgba(21, 38, 52, 0.055);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8f9fa 0, #f8f9fa 72px, var(--bg) 72px, var(--bg) 100%);
  font-family: "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  width: min(1500px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(280px, 420px) auto minmax(300px, 1fr);
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--surface);
  background: var(--navy);
  border-radius: 6px;
}

.brand-mark svg {
  width: 23px;
  height: 23px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.symbol-search {
  height: 40px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 0 5px 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 3px 14px rgba(21, 38, 52, 0.04);
}

.symbol-search svg {
  width: 18px;
  color: var(--muted);
}

.symbol-search input {
  min-width: 0;
  height: 36px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.symbol-search button {
  height: 30px;
  padding: 0 15px;
  color: var(--surface);
  background: var(--ink);
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 650;
}

.symbol-search:focus-within {
  border-color: #8da6b7;
  box-shadow: 0 0 0 3px rgba(23, 61, 87, 0.08);
}

.period-switch {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: #e5e9ec;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.period-switch button {
  height: 28px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.period-switch button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(18, 32, 44, 0.1);
}

.market-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
}

.live-dot.online {
  background: var(--down);
  box-shadow: 0 0 0 4px rgba(21, 130, 103, 0.11);
}

.live-dot.loading {
  background: var(--amber);
  animation: breathe 1.2s ease-in-out infinite;
}

.live-dot.error {
  background: var(--up);
}

@keyframes breathe {
  50% {
    opacity: 0.35;
  }
}

.meta-divider {
  width: 1px;
  height: 13px;
  margin: 0 2px;
  background: var(--line);
}

.icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-left: 3px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.icon-button.spinning svg {
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

main {
  width: min(1500px, calc(100% - 40px));
  margin: 18px auto 0;
}

.quote-band {
  min-height: 116px;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(200px, 0.55fr) minmax(620px, 2fr);
  align-items: center;
  gap: 34px;
  padding: 22px 28px;
  color: var(--surface);
  background: var(--navy);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.stock-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.stock-name-row h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.stock-title p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.code-chip,
.market-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}

.code-chip {
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.market-chip {
  color: #ffe6a9;
  background: rgba(255, 255, 255, 0.09);
}

.quote-price strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.025em;
}

.quote-price span {
  display: block;
  margin-top: 8px;
  color: #ffb2a8;
  font-size: 14px;
  font-weight: 650;
}

.quote-price span.down {
  color: #8ee1c7;
}

.quote-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.quote-stats div {
  min-width: 0;
  padding: 0 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.quote-stats dt,
.trade-levels dt {
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 11px;
}

.quote-stats dd,
.trade-levels dd {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

body[data-market="HK"] .quote-stats dd,
body[data-market="US"] .quote-stats dd {
  font-size: 12px;
}

body[data-market="HK"] .quote-stats div,
body[data-market="US"] .quote-stats div {
  padding: 0 10px;
}

.decision-band {
  min-height: 136px;
  display: grid;
  grid-template-columns: minmax(350px, 1.35fr) minmax(330px, 1fr) minmax(280px, 0.8fr);
  align-items: center;
  gap: 36px;
  padding: 22px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}

.section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.decision-lead h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
  line-height: 1.2;
}

.decision-lead h2.bearish {
  color: var(--down);
}

.decision-lead h2.bullish {
  color: var(--up);
}

.decision-lead h2.lean_bearish {
  color: #3e796b;
}

.decision-lead h2.lean_bullish {
  color: #9e503f;
}

.decision-lead p {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.score-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 12px;
}

.score-heading span {
  color: var(--ink-soft);
  font-size: 12px;
}

.score-heading strong {
  font-size: 27px;
  line-height: 1;
}

.score-heading small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.score-scale {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.scale-label {
  font-size: 10px;
}

.scale-label.bearish {
  color: var(--down);
}

.scale-label.bullish {
  color: var(--up);
}

.scale-track {
  position: relative;
  height: 6px;
  background: linear-gradient(90deg, var(--down) 0%, #b8c4cc 50%, var(--up) 100%);
  border-radius: 99px;
}

.scale-midline {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 1px;
  height: 14px;
  background: var(--ink-soft);
}

.scale-track b {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.4s ease;
}

.trade-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 16px 0;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.trade-levels div {
  padding: 0 14px;
  border-left: 1px solid var(--line);
}

.trade-levels div:first-child {
  border-left: 0;
}

.trade-levels dt {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(350px, 0.85fr);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.market-band {
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(250px, 0.85fr) minmax(500px, 2fr) minmax(190px, 0.65fr);
  align-items: center;
  gap: 28px;
  margin-top: 18px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.market-band[hidden] {
  display: none;
}

.market-lead h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
}

.market-lead p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

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

.market-index {
  min-width: 0;
  padding: 10px 11px;
  background: var(--surface-muted);
  border: 1px solid #e3e8eb;
  border-radius: 6px;
}

.market-index.primary {
  background: var(--blue-soft);
  border-color: #c8d8e3;
}

.market-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.market-index-head span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-index-head b {
  font-size: 11px;
}

.market-index-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}

.market-index-values strong {
  font-size: 16px;
}

.market-index-values small {
  font-size: 10px;
  font-weight: 650;
}

.positive-text {
  color: var(--up) !important;
}

.negative-text {
  color: var(--down) !important;
}

.market-index-state {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.market-contribution {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.market-contribution span,
.market-contribution small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.market-contribution strong {
  display: block;
  margin: 5px 0;
  font-size: 27px;
}

.market-contribution b {
  color: var(--ink);
}

.timeline-panel {
  margin-top: 18px;
  overflow: hidden;
}

.timeline-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 10px;
}

.timeline-summary b {
  margin-left: 4px;
  color: var(--ink);
  font-size: 12px;
}

.timeline-summary .chart-legend {
  gap: 7px 10px;
}

.legend-line.price {
  background: var(--up);
}

.legend-line.average {
  background: var(--amber);
}

.legend-line.preclose {
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--muted) 0 3px,
    transparent 3px 5px
  );
}

.timeline-wrap {
  position: relative;
  height: 290px;
  padding: 6px 10px 0;
}

#intradayChart {
  width: 100%;
  height: 100%;
  display: block;
}

.factor-row[hidden] {
  display: none;
}

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

.panel-heading {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading.compact {
  min-height: 62px;
  padding: 15px 18px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 10px;
}

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

.legend-line {
  width: 13px;
  height: 2px;
  display: inline-block;
}

.legend-line.ma5 {
  background: #c24d3b;
}

.legend-line.ma20 {
  background: #2674a5;
}

.legend-line.ma60 {
  background: #885ca1;
}

.legend-line.high {
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--amber) 0 3px, transparent 3px 5px);
}

.legend-line.vwap {
  background: #2b8f83;
}

.chart-legend b {
  font-weight: inherit;
}

#vwapLegend[hidden] {
  display: none;
}

.chart-wrap {
  position: relative;
  height: 585px;
  padding: 8px 10px 2px;
  overflow: hidden;
}

#priceChart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.83);
  font-size: 13px;
}

.chart-loading[hidden] {
  display: none;
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid var(--line);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  width: 188px;
  padding: 10px 11px;
  color: #eaf0f3;
  background: rgba(18, 32, 44, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(18, 32, 44, 0.2);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.55;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
  font-size: 12px;
}

.chart-tooltip .tip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 8px;
}

.levels-strip {
  min-height: 47px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 10px 20px;
  color: var(--muted);
  background: var(--surface-muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.levels-strip b {
  margin-left: 4px;
  color: var(--ink);
  font-size: 12px;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.pill.neutral {
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

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

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

.factor-list {
  padding: 8px 18px 4px;
}

.factor-row {
  display: grid;
  grid-template-columns: 70px minmax(100px, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border-bottom: 1px solid #edf0f2;
}

.factor-row:last-child {
  border-bottom: 0;
}

.factor-row > div:first-child span,
.factor-row > div:first-child small {
  display: block;
}

.factor-row > div:first-child span {
  font-size: 13px;
  font-weight: 650;
}

.factor-row > div:first-child small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.factor-row > strong {
  text-align: right;
  font-size: 13px;
}

.factor-track {
  position: relative;
  height: 7px;
  background: #eef1f3;
  border-radius: 99px;
}

.factor-track i {
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 7px;
  background: var(--ink-soft);
  border-radius: 99px;
  transition: width 0.35s ease, left 0.35s ease, background 0.35s ease;
}

.factor-track i.positive {
  background: var(--up);
}

.factor-track i.negative {
  background: var(--down);
}

.factor-zero {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 1px;
  height: 13px;
  background: var(--line-strong);
}

.position-note {
  margin: 6px 18px 18px;
  padding: 13px 14px;
  background: var(--blue-soft);
  border-left: 3px solid var(--navy);
  border-radius: 0 5px 5px 0;
}

.position-note span {
  display: block;
  margin-bottom: 5px;
  color: var(--navy);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.position-note p {
  margin: 0;
  color: #304d61;
  font-size: 11px;
  line-height: 1.65;
}

.reasons-panel {
  flex: 1;
}

.reason-list {
  list-style: none;
  margin: 0;
  padding: 4px 18px 14px;
}

.reason-list li {
  min-height: 48px;
  display: grid;
  grid-template-columns: 7px 66px 1fr;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #edf0f2;
}

.reason-list li:last-child {
  border-bottom: 0;
}

.reason-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.reason-dot.positive {
  background: var(--up);
}

.reason-dot.negative {
  background: var(--down);
}

.reason-category {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.reason-text {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.risk-band {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--amber-soft);
  border: 1px solid #e5d1a5;
  border-radius: var(--radius);
}

.risk-band[hidden] {
  display: none;
}

.risk-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #8b5b0c;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 5px;
}

.risk-icon svg {
  width: 18px;
  height: 18px;
}

.risk-band strong {
  display: block;
  margin-bottom: 4px;
  color: #70501a;
  font-size: 12px;
}

#riskWarnings {
  color: #795a27;
  font-size: 11px;
  line-height: 1.65;
}

.indicators-section {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 13px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 23px;
}

.section-heading p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
}

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

.indicator-group {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.indicator-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.indicator-group header strong {
  font-size: 12px;
}

.indicator-group header span {
  color: var(--muted);
  font-size: 9px;
}

.indicator-items {
  padding: 3px 14px 8px;
}

.indicator-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed #e7ebee;
}

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

.indicator-item span {
  color: var(--ink-soft);
  font-size: 11px;
}

.indicator-item b {
  font-size: 12px;
  text-align: right;
}

.indicator-item b.positive {
  color: var(--up);
}

.indicator-item b.negative {
  color: var(--down);
}

.backtest-panel {
  margin-top: 30px;
  overflow: hidden;
}

.backtest-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.backtest-metric {
  min-height: 118px;
  padding: 22px 22px;
  border-right: 1px solid var(--line);
}

.backtest-metric:last-child {
  border-right: 0;
}

.backtest-metric.primary {
  background: var(--surface-muted);
}

.backtest-metric span,
.backtest-metric strong,
.backtest-metric small {
  display: block;
}

.backtest-metric span {
  color: var(--muted);
  font-size: 10px;
}

.backtest-metric strong {
  margin: 8px 0 7px;
  font-size: 25px;
}

.backtest-metric small {
  color: var(--ink-soft);
  font-size: 10px;
}

.backtest-metric small b {
  color: var(--ink);
}

.trade-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

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

th,
td {
  height: 42px;
  padding: 0 18px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #edf0f2;
}

th {
  color: var(--muted);
  background: #fafbfb;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

td {
  color: var(--ink-soft);
}

td:first-child {
  color: var(--ink);
  font-weight: 650;
}

.return-positive {
  color: var(--up) !important;
}

.return-negative {
  color: var(--down) !important;
}

.backtest-assumption {
  margin: 0;
  padding: 12px 18px;
  color: var(--muted);
  background: #fafbfb;
  font-size: 10px;
}

.data-notes {
  min-height: 30px;
  padding: 14px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.data-notes:empty {
  display: none;
}

footer {
  width: min(1500px, calc(100% - 40px));
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 10px;
}

.error-message {
  color: var(--down);
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 220px 1fr auto auto;
  }

  .quote-band {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .quote-stats {
    grid-column: 1 / -1;
  }

  .decision-band {
    grid-template-columns: 1.1fr 1fr;
  }

  .trade-levels {
    grid-column: 1 / -1;
  }

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

  .market-band {
    grid-template-columns: 1fr 1.5fr;
  }

  .market-contribution {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .timeline-summary {
    justify-content: flex-start;
  }

  .market-contribution strong {
    margin: 0;
  }

  .side-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 760px) {
  .topbar,
  main,
  footer {
    width: min(100% - 24px, 1500px);
  }

  .topbar {
    height: auto;
    min-height: 118px;
    grid-template-columns: 1fr auto;
    gap: 12px 16px;
    padding: 14px 0 12px;
  }

  .symbol-search {
    grid-column: 1;
    grid-row: 2;
  }

  .period-switch {
    grid-column: 2;
    grid-row: 2;
  }

  .market-meta {
    justify-content: flex-end;
  }

  .market-meta #quoteTime,
  .meta-divider {
    display: none;
  }

  main {
    margin-top: 4px;
  }

  .quote-band {
    grid-template-columns: 1fr 0.8fr;
    padding: 20px 18px;
  }

  .stock-name-row h1 {
    font-size: 23px;
  }

  .quote-price strong {
    font-size: 34px;
  }

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

  .quote-stats div {
    padding: 0 10px;
  }

  .quote-stats div:nth-child(4) {
    border-left: 0;
  }

  .decision-band {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 18px;
  }

  .decision-lead h2 {
    font-size: 24px;
  }

  .trade-levels {
    grid-column: auto;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

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

  .chart-wrap {
    height: 480px;
    padding: 4px 2px;
  }

  .timeline-wrap {
    height: 250px;
    padding: 4px 2px 0;
  }

  .side-column {
    grid-template-columns: 1fr;
  }

  .market-band {
    grid-template-columns: 1fr;
  }

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

  .market-contribution {
    grid-column: auto;
    flex-wrap: wrap;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

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

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

  .backtest-metric {
    min-height: 105px;
    border-bottom: 1px solid var(--line);
  }

  .backtest-metric:nth-child(2) {
    border-right: 0;
  }

  .backtest-metric:nth-child(3),
  .backtest-metric:nth-child(4) {
    border-bottom: 0;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }
}

@media (max-width: 430px) {
  .brand small {
    display: none;
  }

  .market-meta #marketStatus {
    display: none;
  }

  .symbol-search {
    grid-column: 1 / -1;
  }

  .period-switch {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: start;
    margin-top: -2px;
  }

  .quote-band {
    grid-template-columns: 1fr;
  }

  .quote-price {
    display: flex;
    align-items: baseline;
    gap: 12px;
  }

  .quote-price span {
    margin-top: 0;
  }

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

  .quote-stats div:nth-child(odd) {
    border-left: 0;
  }

  .trade-levels {
    grid-template-columns: 1fr;
    padding: 2px 0;
  }

  .trade-levels div {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .trade-levels div:last-child {
    border-bottom: 0;
  }

  .trade-levels dt {
    margin: 0;
  }

  .levels-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

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

  .backtest-metric {
    border-right: 0;
    border-bottom: 1px solid var(--line) !important;
  }

  .backtest-metric:last-child {
    border-bottom: 0 !important;
  }
}

