:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #677083;
  --line: #dde3ee;
  --accent: #c93232;
  --accent-2: #146c94;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 24px auto;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

p {
  margin: 0;
  color: var(--muted);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

input,
button,
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  padding: 0 12px;
}

input[type="search"] {
  width: 220px;
}

.filterCheck {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.filterCheck input {
  width: auto;
  height: auto;
  padding: 0;
}

button {
  cursor: pointer;
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: #fff;
}

select {
  cursor: pointer;
}

.codeButton {
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-2);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.codeButton:hover {
  text-decoration: underline;
}

.verifyTag {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff3df;
  color: #986100;
  font-size: 11px;
  font-weight: 650;
}

.forceTag {
  background: #ffe8e8;
  color: var(--accent);
}

.status {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.stablePanel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.legacyPanel {
  display: none;
}

.strategySection {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

.strategyCard {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  overflow: hidden;
}

.strategyTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f2f7fa;
}

.strategyTop h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.strategyTop b {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: var(--accent-2);
  color: #fff;
}

.strategyActions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.strategyDetailButton {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
}

.strategyDetail {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
}

.strategyDetail p {
  margin: 0 0 6px;
  color: #40495b;
  font-size: 12px;
  line-height: 1.55;
}

.strategyDetail p:last-child {
  margin-bottom: 0;
}

.strategyRows {
  overflow-x: auto;
}

.strategyRow {
  display: grid;
  grid-template-columns: 128px 86px 62px 72px 100px 96px 60px 64px 132px 128px;
  align-items: center;
  min-width: 928px;
  border-bottom: 1px solid #e7edf5;
}

.strategyRow:last-child {
  border-bottom: 0;
}

.strategyPending {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 13px;
}

.strategyRowHead {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 34px;
  background: #eef2f8;
  color: var(--muted);
  font-weight: 700;
}

.strategyRow > span,
.strategyStock {
  min-width: 0;
  padding: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.strategyStock strong {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.closePanel .cardTop b {
  background: #e4f3f8;
  color: var(--accent-2);
}

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

.panelActions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.backupSelect {
  width: 132px;
  border-color: #cfe3ea;
  background: #fff;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 650;
}

.pollStatus {
  flex: 0 0 auto;
  min-width: 150px;
  padding: 6px 10px;
  border: 1px solid #cfe3ea;
  border-radius: 6px;
  background: #f2f7fa;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.stableCards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.stablePanel > .stableCards {
  display: block;
  overflow-x: auto;
}

.closePanel .stableCards {
  display: block;
  overflow-x: auto;
}

.stableTable,
.closeTable {
  min-width: 1280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.stableTable {
  min-width: 1160px;
}

.closeTable {
  min-width: 1410px;
}

.stableHeader,
.stableRow,
.closeHeader,
.closeRow {
  display: grid;
  align-items: center;
}

.stableHeader,
.stableRow {
  grid-template-columns: 170px 110px 82px 96px 110px 110px 110px 90px 180px 76px;
}

.closeHeader,
.closeRow {
  grid-template-columns: 170px 96px 72px 92px 90px 76px 116px 112px 170px 74px 66px 86px minmax(160px, 1fr);
}

.stableHeader,
.closeHeader {
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: #f2f7fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stableRow,
.closeRow {
  min-height: 46px;
  border-bottom: 1px solid #e7edf5;
  background: #fff;
}

.stableRow:last-child,
.closeRow:last-child {
  border-bottom: 0;
}

.stableHeader span,
.stableRow > div,
.closeHeader span,
.closeRow > div {
  min-width: 0;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stableStock strong,
.closeStock strong {
  display: block;
  overflow: hidden;
  margin-right: 0;
  margin-bottom: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.stockMeta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.stockMeta .codeButton {
  flex: 0 0 auto;
}

.copyToast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(23, 32, 51, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.copyToast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.closeRow > .supportBandCell {
  overflow: visible;
  text-overflow: clip;
}

.stableRow > .stableBuyRangeCell {
  overflow: visible;
  text-overflow: clip;
}

.stableRow > .changePctCell,
.closeRow > .changePctCell {
  overflow: visible;
  text-overflow: clip;
}

.stableRow .positive,
.closeRow .positive {
  color: var(--accent);
  font-weight: 700;
}

.stableRow .negative,
.closeRow .negative {
  color: #18845f;
  font-weight: 700;
}

.flashPrice {
  animation: priceFlash 1s ease-in-out infinite;
  border-radius: 4px;
  background: #fff0f0;
  color: var(--accent);
  font-weight: 800;
}

.buyRangeHit {
  color: var(--accent);
  font-weight: 800;
}

@keyframes priceFlash {
  0%, 100% {
    background: #fff0f0;
    box-shadow: inset 0 0 0 1px #ffd0d0;
  }
  50% {
    background: #fff;
    box-shadow: inset 0 0 0 1px transparent;
  }
}

.closeNote {
  color: #986100;
  font-size: 12px;
}

.stableCard,
.emptyCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.stableCard {
  padding: 12px;
}

.emptyCard {
  padding: 16px;
  color: var(--muted);
}

.cardTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.cardTop strong {
  display: block;
  font-size: 16px;
}

.cardTop span,
.cardFoot,
.cardMetrics span {
  color: var(--muted);
  font-size: 12px;
}

.scoreBox {
  min-width: 92px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.scoreBox b {
  min-width: 38px;
  height: 28px;
  border-radius: 14px;
  background: #ffe8e8;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.scoreBox span {
  color: var(--muted);
  font-size: 11px;
}

.scoreBox em {
  color: var(--text);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.scoreBox .positive {
  color: var(--accent);
}

.scoreBox .negative {
  color: #18845f;
}

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

.cardMetrics div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cardMetrics em {
  font-style: normal;
  font-weight: 650;
}

.cardFoot {
  margin-top: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lateNetLine {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f2f7fa;
  color: var(--muted);
  font-size: 13px;
}

.lateNetLine em {
  color: var(--text);
  font-style: normal;
  font-weight: 700;
}

.lateNetLine .positive {
  color: var(--accent);
}

.lateNetLine .negative {
  color: #18845f;
}

.billAnalysis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}

.billAnalysis div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.billAnalysis .wideMetric {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.billAnalysis .noteMetric em {
  color: #986100;
  white-space: normal;
}

.billAnalysis em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-style: normal;
  font-weight: 650;
}

.billAnalysis .positive {
  color: var(--accent);
}

.billAnalysis .negative {
  color: #18845f;
}

.tableWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.industryPanel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.industryClusterGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.industryClusterCard {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.clusterTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.clusterTop b {
  color: var(--accent);
}

.clusterStocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.clusterStocks span {
  padding: 4px 6px;
  border-radius: 4px;
  background: #f2f7fa;
  color: var(--accent-2);
  font-size: 12px;
}

.industryTableWrap {
  overflow-x: auto;
}

.industryFlowTable {
  min-width: 1080px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.industryFlowHead,
.industryFlowRow {
  display: grid;
  grid-template-columns: 150px 100px 70px 78px 120px 112px 70px 70px minmax(180px, 1fr);
  align-items: center;
}

.industryFlowHead {
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: #f2f7fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.industryFlowRow {
  min-height: 46px;
  border-bottom: 1px solid #e7edf5;
}

.industryFlowRow:last-child {
  border-bottom: 0;
}

.industryFlowHead span,
.industryFlowRow > span,
.industryFlowRow > div {
  min-width: 0;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.industryFlowRow strong {
  display: block;
  margin-bottom: 2px;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f8;
  color: #40495b;
  font-weight: 650;
}

tbody tr:hover {
  background: #fff8f2;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--accent);
  font-weight: 650;
}

.negative {
  color: #18845f;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 16px, 100%);
    margin: 10px auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 16px;
  }

  p {
    font-size: 12px;
  }

  .controls {
    justify-content: stretch;
    gap: 8px;
  }

  input,
  button,
  select,
  input[type="search"] {
    flex: 1 1 calc(50% - 8px);
    width: 100%;
    min-width: 0;
    height: 36px;
    font-size: 13px;
    padding: 0 10px;
  }

  .status,
  .stablePanel,
  .industryPanel,
  .strategySection {
    border-radius: 6px;
  }

  .status {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .stablePanel,
  .industryPanel,
  .strategySection {
    padding: 10px;
  }

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

  .industryFlowTable {
    min-width: 900px;
  }

  .industryFlowHead,
  .industryFlowRow {
    grid-template-columns: 128px 84px 62px 70px 104px 100px 62px 62px minmax(160px, 1fr);
  }

  .industryFlowHead span,
  .industryFlowRow > span,
  .industryFlowRow > div {
    padding: 7px 8px;
    font-size: 12px;
  }

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

  .strategyTop {
    padding: 10px;
  }

  .strategyTop h3 {
    font-size: 15px;
  }

  .strategyRow {
    grid-template-columns: 116px 76px 58px 68px 92px 90px 54px 58px 122px 112px;
    min-width: 846px;
  }

  .panelHead {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .panelActions {
    justify-content: stretch;
  }

  .backupSelect,
  .pollStatus {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: 34px;
    font-size: 12px;
  }

  .stablePanel > .stableCards,
  .closePanel .stableCards,
  .tableWrap {
    -webkit-overflow-scrolling: touch;
  }

  .stableTable {
    min-width: 930px;
  }

  .stableHeader,
  .stableRow {
    grid-template-columns: 132px 84px 64px 78px 88px 88px 88px 70px 150px 58px;
  }

  .closeTable {
    min-width: 1180px;
  }

  .closeHeader,
  .closeRow {
    grid-template-columns: 132px 82px 62px 78px 78px 66px 100px 98px 150px 66px 56px 74px minmax(120px, 1fr);
  }

  .stableHeader,
  .closeHeader {
    min-height: 34px;
    font-size: 11px;
  }

  .stableRow,
  .closeRow {
    min-height: 40px;
  }

  .stableHeader span,
  .stableRow > div,
  .closeHeader span,
  .closeRow > div {
    padding: 7px 8px;
    font-size: 12px;
  }

  .stableStock strong,
  .closeStock strong {
    margin-bottom: 2px;
    font-size: 13px;
  }

  .verifyTag {
    margin-left: 0;
    padding: 1px 4px;
    font-size: 10px;
  }

  .stockMeta {
    gap: 4px;
  }

  .copyToast {
    bottom: 14px;
    padding: 9px 12px;
    font-size: 13px;
  }

  table {
    min-width: 820px;
  }

  th,
  td {
    padding: 8px 9px;
    font-size: 12px;
  }
}
