:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #17211f;
  --muted: #64716e;
  --line: #d9dfdc;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --teal: #0c7366;
  --teal-soft: #e4f1ee;
  --amber: #a45a09;
  --amber-soft: #fff0d8;
  --red: #a83c3c;
  --red-soft: #fbe8e7;
  --blue: #285f91;
  --blue-soft: #e8eff7;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  min-width: 320px;
}

button {
  font: inherit;
  letter-spacing: 0;
}

.topbar {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px max(24px, calc((100vw - 1380px) / 2));
  color: #f7faf9;
  background: var(--ink);
  border-bottom: 4px solid var(--teal);
}

.eyebrow {
  margin: 0 0 6px;
  color: #95d5ca;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.2;
  letter-spacing: 0;
}

.updated {
  margin: 7px 0 0;
  color: #bcc8c5;
  font-size: 13px;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid #52615d;
  border-radius: 6px;
  color: #f7faf9;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: #95d5ca;
  background: #263430;
  outline: none;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px 24px;
  background: rgba(243, 245, 244, 0.96);
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 42px;
  border: 1px solid var(--line);
  border-right-width: 0;
  color: var(--muted);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}

.tab:first-child {
  border-radius: 6px 0 0 6px;
}

.tab:last-child {
  border-right-width: 1px;
  border-radius: 0 6px 6px 0;
}

.tab.is-active {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

main {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 22px 24px 48px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.decision-band {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(300px, 1.2fr);
  gap: 24px;
  align-items: center;
  padding: 20px 22px;
  background: var(--amber-soft);
  border: 1px solid #e7bd82;
  border-left: 5px solid var(--amber);
  border-radius: 6px;
}

.decision-band.is-buy {
  background: var(--teal-soft);
  border-color: #8dc4b9;
  border-left-color: var(--teal);
}

.decision-band.is-sell {
  background: var(--red-soft);
  border-color: #dfaaa7;
  border-left-color: var(--red);
}

.decision-band > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 50%;
  background: var(--amber);
}

.is-buy .status-dot {
  background: var(--teal);
}

.is-sell .status-dot {
  background: var(--red);
}

.decision-label {
  color: var(--muted);
  font-size: 13px;
}

.decision-band strong {
  font-size: 20px;
  letter-spacing: 0;
}

.decision-band p {
  margin: 0;
  color: #554736;
  font-size: 14px;
  line-height: 1.55;
}

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

.metric {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metric span,
.metric small,
.inventory-strip span,
.strategy-status span,
.validation-strip span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  margin: 5px 0 3px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  letter-spacing: 0;
}

.inventory-strip,
.strategy-status,
.validation-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.inventory-strip > div,
.strategy-status > div,
.validation-strip > div {
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.inventory-strip > div:last-child,
.strategy-status > div:last-child,
.validation-strip > div:last-child {
  border-right: 0;
}

.inventory-strip strong,
.strategy-status strong,
.validation-strip strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 16px;
  letter-spacing: 0;
}

.chart-panel {
  margin: 16px 0 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.chart-panel h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

.chart-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.chart-panel img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 240px;
  object-fit: contain;
  background: #ffffff;
}

.strategy-status,
.validation-strip {
  margin-top: 0;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px max(24px, calc((100vw - 1380px) / 2));
  color: #6d7b77;
  background: #e8ecea;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar {
    min-height: 94px;
    padding: 18px 16px;
  }

  .tabs {
    padding: 10px 16px;
  }

  main {
    padding: 16px 16px 36px;
  }

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

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

  .inventory-strip,
  .strategy-status,
  .validation-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-strip > div:nth-child(2),
  .strategy-status > div:nth-child(2),
  .validation-strip > div:nth-child(2) {
    border-right: 0;
  }

  .inventory-strip > div:nth-child(-n + 2),
  .strategy-status > div:nth-child(-n + 2),
  .validation-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .chart-panel img {
    min-height: 180px;
  }

  footer {
    display: grid;
    gap: 5px;
    padding: 16px;
  }
}

@media (max-width: 440px) {
  .eyebrow {
    display: none;
  }

  h1 {
    font-size: 21px;
  }

  .updated {
    font-size: 11px;
  }

  .metric {
    min-height: 102px;
    padding: 13px;
  }

  .metric strong {
    font-size: 27px;
  }

  .inventory-strip > div,
  .strategy-status > div,
  .validation-strip > div {
    padding: 13px;
  }

  .chart-panel figcaption {
    padding: 14px;
  }

  .chart-panel h2 {
    font-size: 15px;
  }
}
