:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #66746f;
  --line: #dfe7e3;
  --gain: #0f9f6e;
  --loss: #d94d45;
  --halt: #9a6b11;
  --repair: #d18b00;
  --active-stock: #0f9f6e;
  --shadow: 0 16px 44px rgba(28, 43, 37, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(15, 159, 110, 0.08), rgba(246, 248, 247, 0) 340px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 14px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 2px 16px;
}

.market-label,
.mini-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 210px;
  font-size: 25px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.date-control {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.date-control select,
.compact-select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  padding: 0 34px 0 12px;
  box-shadow: 0 8px 22px rgba(28, 43, 37, 0.05);
}

.market-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.index-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.index-card {
  min-height: 132px;
  padding: 14px;
  overflow: hidden;
}

.market-card {
  grid-column: 1 / -1;
  min-height: 178px;
  background:
    linear-gradient(135deg, rgba(15, 159, 110, 0.14), rgba(255, 255, 255, 0.98) 58%),
    var(--surface);
}

.card-heading,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.status-chip,
.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip.gain,
.status-dot.gain {
  background: rgba(15, 159, 110, 0.11);
  color: var(--gain);
}

.status-chip.loss,
.status-dot.loss {
  background: rgba(217, 77, 69, 0.12);
  color: var(--loss);
}

.status-dot.halt {
  background: rgba(154, 107, 17, 0.13);
  color: var(--halt);
}

.status-dot.repair {
  background: rgba(209, 139, 0, 0.14);
  color: var(--repair);
}

.big-price {
  margin-top: 10px;
  font-size: 48px;
  font-weight: 850;
  line-height: 1;
}

.fund-price {
  margin-top: 16px;
  font-size: 31px;
  font-weight: 850;
  line-height: 1;
}

.change-row {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 850;
}

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

.gain-text {
  color: var(--gain);
}

.loss-text {
  color: var(--loss);
}

.flat-text {
  color: var(--muted);
}

.sparkline {
  display: block;
  width: 100%;
}

.wide {
  margin-top: 8px;
  height: 54px;
}

.content-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  padding: 14px;
}

.stock-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.stock-row {
  display: grid;
  grid-template-columns: 42px minmax(96px, 1fr) 78px auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.stock-row.selected {
  border-color: color-mix(in srgb, var(--active-stock) 55%, var(--line));
  box-shadow: inset 4px 0 0 var(--active-stock);
}

.stock-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--stock-color) 15%, white);
  color: var(--stock-color);
  font-size: 16px;
  font-weight: 900;
}

.stock-main {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.stock-main strong {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.18;
}

.stock-main span,
.stock-quote em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.row-line {
  width: 78px;
  height: 34px;
}

.stock-quote {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.stock-quote strong {
  font-size: 17px;
  line-height: 1;
}

.stock-row .status-dot {
  grid-column: 2 / -1;
  justify-self: start;
}

.detail-stack {
  display: grid;
  gap: 12px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.detail-summary div {
  display: grid;
  min-height: 70px;
  align-content: center;
  gap: 6px;
  border-radius: 8px;
  background: #f3f7f5;
  padding: 10px;
}

.detail-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-summary strong {
  overflow-wrap: anywhere;
  font-size: 19px;
  line-height: 1;
}

.ticker {
  border-radius: 6px;
  background: color-mix(in srgb, var(--active-stock) 13%, white);
  color: var(--active-stock);
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 900;
}

.detail-line {
  height: 72px;
  margin: 12px 0 8px;
}

.ledger-head,
.ledger-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr 1fr;
  align-items: center;
  gap: 8px;
}

.ledger-head {
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.ledger-list {
  display: grid;
}

.ledger-row {
  min-height: 48px;
  border-bottom: 1px solid #edf2ef;
  font-size: 13px;
  font-weight: 750;
}

.ledger-row strong {
  justify-self: end;
}

.ledger-empty {
  display: grid;
  min-height: 72px;
  place-items: center;
  border-bottom: 1px solid #edf2ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 850;
}

.rule strong {
  font-size: 18px;
}

.rule.gain strong {
  color: var(--gain);
}

.rule.loss strong {
  color: var(--loss);
}

.rule.halt strong {
  color: var(--halt);
}

.rule.repair strong {
  color: var(--repair);
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px 22px 36px;
  }

  h1 {
    max-width: none;
    font-size: 34px;
  }

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

  .market-card {
    grid-column: 1 / -1;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
    align-items: start;
  }

  .stock-row {
    grid-template-columns: 42px minmax(138px, 1fr) 92px auto;
  }

  .stock-row .status-dot {
    grid-column: auto;
    justify-self: end;
  }

  .row-line {
    width: 92px;
  }
}

@media (min-width: 980px) {
  .app-shell {
    padding-top: 30px;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.85fr);
  }
}
