:root {
  color-scheme: light;
  --page: #f4f6f2;
  --surface: #ffffff;
  --surface-muted: #eef2ea;
  --ink: #17211b;
  --muted: #687469;
  --line: #dce4d7;
  --accent: #256f5d;
  --accent-strong: #174f43;
  --up: #b3342a;
  --down: #207052;
  --flat: #66736b;
  --shadow: 0 12px 30px rgba(35, 50, 38, 0.08);
  font-family: "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
select {
  font: inherit;
}

.futures-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.market-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 18px;
}

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

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

h1 {
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--flat);
}

.status-pill.is-live::before {
  background: var(--down);
}

.status-pill.is-error::before {
  background: var(--up);
}

.select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
}

.select-label select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 30px 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus {
  border-color: var(--accent);
}

.quote-strip {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 12px;
}

.quote-tile,
.chart-panel,
.session-box,
.source-box,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quote-tile {
  display: grid;
  align-content: center;
  min-height: 110px;
  padding: 16px;
}

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

.quote-tile strong {
  display: block;
  min-width: 0;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.main-price strong {
  font-size: 40px;
}

.quote-tile span:last-child {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.change-value.is-up,
.is-up {
  color: var(--up) !important;
}

.change-value.is-down,
.is-down {
  color: var(--down) !important;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 12px;
  margin-top: 12px;
}

.chart-panel {
  min-height: 510px;
  padding: 12px;
}

.chart-box {
  width: 100%;
  height: 486px;
}

.side-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
}

.session-box {
  padding: 12px;
}

.session-box dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.session-box div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}

.session-box div:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.source-box {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.source-box span,
.source-box small {
  color: var(--muted);
  font-size: 12px;
}

.source-box strong {
  color: var(--accent-strong);
}

.table-panel {
  margin-top: 12px;
  overflow: hidden;
}

.table-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

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

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

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

td {
  font-variant-numeric: tabular-nums;
}

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

@media (max-width: 980px) {
  .quote-strip,
  .workspace {
    grid-template-columns: 1fr;
  }

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

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

  .market-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-actions {
    justify-content: flex-start;
  }

  h1 {
    font-size: 24px;
  }

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

  .chart-panel {
    min-height: 420px;
  }

  .chart-box {
    height: 394px;
  }
}
