:root {
  color-scheme: light;
  --surface: #fff;
  --surface-muted: #edf0e9;
  --ink: #202820;
  --ink-soft: #4f5a50;
  --muted: #737d73;
  --line: #dfe3db;
  --line-strong: #cbd2c8;
  --green: #007a39;
  --green-wash: #e7f0e8;
  --red: #830d00;
  --red-wash: #f5e9e6;
  --amber: #e7a200;
  --amber-wash: #f5efdc;
  --hover: #ebece6;
  --control-shadow: #2028201a;
  --tone-good-bg: #e5f0e6;
  --tone-good-ink: #286343;
  --tone-moderate-bg: #f4efd9;
  --tone-moderate-ink: #795f16;
  --tone-unhealthy-bg: #f7ead9;
  --tone-unhealthy-ink: #925018;
  --tone-very-unhealthy-bg: #f4e4e1;
  --tone-very-unhealthy-ink: #913d32;
  --tone-hazardous-bg: #efdfe0;
  --tone-hazardous-ink: #7d2930;
  --tone-neutral-bg: #eceee9;
  --tone-neutral-ink: #626c63;
  --meter-track: #e9eae5;
  --meter-good: #8eb998;
  --meter-moderate: #d4bc69;
  --meter-unhealthy: #dda36a;
  --meter-very-unhealthy: #cb8275;
  --meter-hazardous: #ae6266;
  --wallet-bg: #e8eee7;
  --wallet-ink: #596b5d;
  --wallet-line: #d0d9d0;
  --wallet-button-border: #d4ded3;
  --wallet-button-bg: #dfe8df;
  --meter-high-overlay: #d4bc6940;
  --live-green: #398252;
  --radius: 2px;
  --page-width: 1680px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #111214;
  --surface-muted: #1b1c1f;
  --ink: #ececee;
  --ink-soft: #c7c8cb;
  --muted: #a0a1a5;
  --line: #2b2c30;
  --line-strong: #414247;
  --green: #42ad70;
  --green-wash: #1c3024;
  --red: #ef8a7e;
  --red-wash: #382422;
  --amber: #e9c361;
  --amber-wash: #332d1f;
  --hover: #202124;
  --control-shadow: #0006;
  --tone-good-bg: #203127;
  --tone-good-ink: #9dd5a9;
  --tone-moderate-bg: #332d1f;
  --tone-moderate-ink: #e9cf7f;
  --tone-unhealthy-bg: #382b20;
  --tone-unhealthy-ink: #efb77d;
  --tone-very-unhealthy-bg: #382422;
  --tone-very-unhealthy-ink: #f0a092;
  --tone-hazardous-bg: #392328;
  --tone-hazardous-ink: #ef9aa0;
  --tone-neutral-bg: #292a2d;
  --tone-neutral-ink: #c7c8cb;
  --meter-track: #2a2b2e;
  --meter-good: #4b825b;
  --meter-moderate: #9a8244;
  --meter-unhealthy: #a36e43;
  --meter-very-unhealthy: #9b5c53;
  --meter-hazardous: #874b52;
  --wallet-bg: #1a1b1e;
  --wallet-ink: #b3b4b8;
  --wallet-line: #343539;
  --wallet-button-border: #3d3e42;
  --wallet-button-bg: #252629;
  --meter-high-overlay: #e9c36124;
  --live-green: #42ad70;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 64px;
  display: flex;
  align-items: stretch;
  gap: 52px;
  padding: 0 max(28px, calc((100vw - var(--page-width)) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.main-nav {
  display: flex;
  align-items: stretch;
  gap: 28px;
}

.nav-link {
  position: relative;
  padding: 1px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--green);
  content: "";
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}

.feed-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.feed-dot,
.mini-status {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
}

.feed-indicator.is-live .feed-dot,
.mini-status.is-live {
  background: var(--live-green);
}

.hour-countdown {
  display: grid;
  gap: 1px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

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

.hour-countdown strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.trade-toggle {
  min-width: 72px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.trade-toggle:hover {
  border-color: var(--green);
}

.trade-toggle.is-enabled {
  border-color: var(--green);
  background: var(--green-wash);
  color: var(--green);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--green);
}

.theme-toggle-icon {
  width: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.theme-toggle-track {
  display: flex;
  width: 28px;
  height: 16px;
  align-items: center;
  padding: 2px;
  border-radius: 10px;
  background: var(--line-strong);
  transition: background 0.18s ease;
}

.theme-toggle-track i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px #0003;
  transition: transform 0.18s ease;
}

.theme-toggle[aria-checked="true"] .theme-toggle-track {
  background: var(--green);
}

.theme-toggle[aria-checked="true"] .theme-toggle-track i {
  transform: translateX(12px);
}

.app-shell {
  width: min(100%, var(--page-width));
  margin: 0 auto;
  padding: 30px 28px 56px;
}

.market-heading,
.view-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.market-heading h1,
.view-heading h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.15;
}

.heading-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.meta-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

.market-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.trade-enabled .market-layout {
  grid-template-columns: 244px minmax(0, 1fr) 292px;
}

.watchlist-panel,
.center-column,
.right-column {
  min-width: 0;
}

.watchlist-panel {
  padding-right: 16px;
  border-right: 1px solid var(--line-strong);
}

.panel-heading {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
}

.panel-heading h2,
.order-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sort-switch {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.sort-option {
  min-height: 25px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.sort-option.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 20px;
}

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

.search-box {
  display: none;
  height: 38px;
  align-items: center;
  gap: 8px;
  margin: 7px 0 5px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
}

.search-box.is-open {
  display: flex;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.instrument-list {
  max-height: 760px;
  margin-top: 8px;
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.instrument-group + .instrument-group {
  margin-top: 14px;
}

.instrument-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.instrument-group-title span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.instrument-item {
  display: grid;
  width: 100%;
  min-height: 62px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.instrument-item:hover {
  background: var(--hover);
}

.instrument-item.is-selected {
  background: var(--surface);
  box-shadow: inset 3px 0 var(--green);
}

.instrument-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.instrument-quote {
  padding-left: 8px;
  text-align: right;
}

.instrument-quote strong,
.instrument-quote span {
  display: block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.instrument-quote strong {
  font-weight: 650;
}

.instrument-quote span {
  margin-top: 2px;
  color: var(--muted);
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.quote-header {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.quote-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.instrument-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  background: var(--green-wash);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.quote-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.quote-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.quote-current {
  display: flex;
  flex: none;
  align-items: baseline;
  gap: 7px;
}

.quote-current strong {
  font-size: 31px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}

.quote-current > span {
  color: var(--muted);
  font-size: 12px;
}

.chart-toolbar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.chart-reading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.chart-reading #reading-value {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.reading-separator {
  width: 1px;
  height: 12px;
  margin: 0 2px;
  background: var(--line-strong);
}

#reading-region {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-tabs {
  display: flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  background: var(--surface-muted);
}

.range-button {
  min-width: 38px;
  height: 30px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.range-button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px var(--control-shadow);
}

.chart-wrap {
  position: relative;
  height: 310px;
  margin-top: 3px;
  background: var(--surface);
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

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

.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-axis span:nth-child(2) {
  text-align: center;
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.stat strong {
  overflow: hidden;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-section {
  margin-top: 24px;
}

.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.subsection-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

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

.health-section .subsection-heading {
  margin-top: 0;
}

.help-button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  text-underline-offset: 3px;
}

.help-button:hover {
  color: var(--green);
  text-decoration: underline;
}

.info-modal {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  max-height: min(82vh, 680px);
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px #0004;
}

.info-modal::backdrop {
  background: #0009;
  backdrop-filter: blur(2px);
}

.info-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.info-modal-heading .eyebrow {
  margin-bottom: 5px;
}

.info-modal-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.modal-close {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.info-modal-content {
  padding: 18px 24px 22px;
  color: var(--ink-soft);
  font-size: 13px;
}

.info-modal-content p {
  margin: 0 0 14px;
}

.pollutant-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 16px 0;
}

.pollutant-list span {
  padding: 8px 10px;
  border-left: 2px solid var(--green);
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.info-modal-content ul {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding-left: 20px;
}

.info-modal-content strong {
  color: var(--ink);
}

.info-modal-content .info-modal-note {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.health-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}

.health-row {
  min-width: 0;
  padding: 13px 0 14px;
  border-bottom: 1px solid var(--line);
}

.health-row-heading,
.health-row-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.health-row-heading > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.health-row-heading strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-row-heading > div:first-child span,
.health-row-status > span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.health-value {
  flex: none;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.health-row-status {
  align-items: center;
  justify-content: flex-start;
  margin-top: 8px;
}

.health-tag {
  flex: none;
  padding: 3px 6px;
  border-radius: var(--radius);
  font-size: 10px;
  font-weight: 650;
}

.tone-good {
  background: var(--tone-good-bg);
  color: var(--tone-good-ink);
}

.tone-moderate {
  background: var(--tone-moderate-bg);
  color: var(--tone-moderate-ink);
}

.tone-unhealthy {
  background: var(--tone-unhealthy-bg);
  color: var(--tone-unhealthy-ink);
}

.tone-very-unhealthy {
  background: var(--tone-very-unhealthy-bg);
  color: var(--tone-very-unhealthy-ink);
}

.tone-hazardous {
  background: var(--tone-hazardous-bg);
  color: var(--tone-hazardous-ink);
}

.tone-neutral {
  background: var(--tone-neutral-bg);
  color: var(--tone-neutral-ink);
}

.health-meter {
  position: relative;
  height: 10px;
  margin-top: 10px;
}

.meter-track {
  position: absolute;
  inset: 2px 0;
  display: flex;
  height: 6px;
  overflow: hidden;
  background: var(--meter-track);
}

.meter-segment {
  height: 100%;
  flex: none;
}

.meter-segment.tone-good,
.meter-safe {
  background: var(--meter-good);
}

.meter-segment.tone-moderate {
  background: var(--meter-moderate);
}

.meter-segment.tone-unhealthy {
  background: var(--meter-unhealthy);
}

.meter-segment.tone-very-unhealthy {
  background: var(--meter-very-unhealthy);
}

.meter-segment.tone-hazardous {
  background: var(--meter-hazardous);
}

.meter-high {
  position: absolute;
  inset: 0;
  background: var(--meter-high-overlay);
}

.health-meter > i {
  position: absolute;
  z-index: 1;
  top: 0;
  width: 10px;
  height: 10px;
  transform: translateX(-50%);
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.health-meter.is-empty .meter-track,
.health-meter.is-unrated .meter-track {
  background: var(--meter-track);
}

.section-rule {
  height: 1px;
  margin-top: 26px;
  background: var(--line-strong);
}

.market-table-wrap,
.portfolio-table-wrap {
  overflow-x: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}

.market-table th {
  height: 34px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.market-table td {
  height: 44px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.market-table tbody tr {
  cursor: pointer;
}

.market-table tbody tr:hover {
  background: var(--hover);
}

.market-table td:not(:first-child) {
  font-variant-numeric: tabular-nums;
}

.table-instrument {
  font-size: 12px;
  font-weight: 650;
}

.table-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.table-arrow {
  color: var(--muted);
  font-size: 15px;
}

.right-column {
  display: grid;
  gap: 18px;
}

.wallet-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 8px;
  padding: 16px;
  border-top: 2px solid var(--green);
  background: var(--wallet-bg);
}

.wallet-label {
  display: block;
  margin-bottom: 5px;
  color: var(--wallet-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.wallet-strip > div:first-child strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.wallet-strip small {
  color: var(--wallet-ink);
  font-size: 11px;
}

.wallet-add {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--wallet-button-border);
  background: var(--wallet-button-bg);
  color: var(--green);
  cursor: pointer;
  font-size: 14px;
}

.wallet-equity {
  display: flex;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--wallet-line);
  color: var(--wallet-ink);
  font-size: 11px;
}

.wallet-equity strong {
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.order-panel {
  padding: 17px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.order-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-type {
  padding: 3px 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.side-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 17px 0 18px;
}

.side-button {
  height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.side-button.is-active.is-long {
  border-color: var(--green);
  background: var(--green-wash);
  color: var(--green);
}

.side-button.is-active.is-short {
  border-color: var(--red);
  background: var(--red-wash);
  color: var(--red);
}

.field-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 650;
}

.field-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.quantity-field {
  display: flex;
  height: 44px;
  align-items: center;
  border: 1px solid var(--line-strong);
}

.quantity-field input {
  width: 72px;
  min-width: 0;
  height: 100%;
  padding-left: 11px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.quantity-field > span {
  margin-left: 2px;
  color: var(--muted);
  font-size: 11px;
}

.stepper {
  display: flex;
  height: 100%;
  margin-left: auto;
}

.stepper button {
  width: 36px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 17px;
}

.stepper button:hover,
.quick-amounts button:hover {
  background: var(--surface-muted);
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 8px 0 18px;
}

.quick-amounts button {
  height: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.order-summary {
  padding: 12px 0 11px;
  border-top: 1px solid var(--line);
}

.order-summary > div:not(.summary-note) {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 11px;
}

.order-summary strong {
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.summary-note {
  margin-top: 11px;
  color: var(--muted);
  font-size: 10px;
}

.submit-order {
  display: flex;
  width: 100%;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border: 0;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.submit-order.is-short {
  background: var(--red);
}

.submit-order:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.submit-order span:last-child {
  font-size: 17px;
}

.order-error {
  min-height: 0;
  margin: 0;
  color: var(--red);
  font-size: 11px;
}

.order-error:not(:empty) {
  margin-top: 10px;
}

.positions-panel {
  padding-top: 2px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.text-button span {
  margin-left: 4px;
  color: var(--ink);
}

.positions-list {
  margin-top: 7px;
}

.empty-positions {
  padding: 16px 0;
  color: var(--muted);
  font-size: 12px;
}

.position-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 9px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.position-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.position-pnl {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.position-row button {
  grid-column: 1 / -1;
  justify-self: end;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.position-row button:hover {
  color: var(--green);
}

.secondary-view {
  min-height: 70vh;
}

.view-heading {
  margin: 6px 0 28px;
}

.portfolio-total {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.portfolio-total strong {
  color: var(--ink);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 32px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.portfolio-summary div {
  display: grid;
  gap: 7px;
}

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

.portfolio-summary strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.close-button {
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
}

.close-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.direction-tag {
  font-size: 11px;
  font-weight: 650;
  text-transform: capitalize;
}

.activity-table td:first-child {
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  padding: 12px 16px;
  background: var(--ink);
  color: white;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  font-size: 12px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.source-footer {
  display: flex;
  max-width: var(--page-width);
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  padding: 17px 28px 24px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
}

.source-footer p {
  margin: 0;
}

.source-footer a {
  color: var(--green);
  text-underline-offset: 2px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .topbar {
    gap: 32px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .app-shell {
    padding-right: 24px;
    padding-left: 24px;
  }

  .market-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
  }

  .trade-enabled .market-layout {
    grid-template-columns: 220px minmax(350px, 1fr) 270px;
  }

  .watchlist-panel {
    padding-right: 12px;
  }
}

@media (max-width: 940px) {
  .market-layout {
    grid-template-columns: 205px minmax(0, 1fr);
    gap: 18px;
  }

  .right-column {
    display: grid;
    grid-column: 2;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  .wallet-strip {
    grid-column: 1 / -1;
  }

  .watchlist-panel {
    grid-row: span 2;
  }

  .health-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .topbar {
    height: 58px;
    gap: 14px;
    padding: 0 14px;
  }

  .brand {
    font-size: 16px;
  }

  .main-nav {
    gap: 12px;
  }

  .nav-link {
    font-size: 11px;
  }

  .topbar-right {
    gap: 7px;
  }

  .feed-indicator {
    display: none;
  }

  .trade-toggle {
    min-width: 0;
    padding: 6px 8px;
    font-size: 11px;
  }

  .theme-toggle {
    gap: 4px;
    padding: 5px 6px;
  }

  .hour-countdown {
    padding-left: 9px;
  }

  .hour-countdown span {
    font-size: 9px;
  }

  .hour-countdown strong {
    font-size: 10px;
  }

  .app-shell {
    padding: 22px 14px 38px;
  }

  .market-heading {
    align-items: end;
    margin-bottom: 19px;
  }

  .market-heading h1,
  .view-heading h1 {
    font-size: 25px;
  }

  .heading-meta {
    gap: 7px;
    font-size: 10px;
  }

  .market-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .center-column,
  .right-column {
    display: contents;
  }

  .center-column > *,
  .right-column > * {
    width: 100%;
  }

  .watchlist-panel {
    order: 0;
  }

  .quote-header {
    order: 1;
  }

  .chart-toolbar {
    order: 2;
  }

  .chart-wrap {
    order: 3;
  }

  .chart-axis {
    order: 4;
  }

  .order-panel {
    order: 5;
    margin: 0;
  }

  .wallet-strip {
    order: 6;
  }

  .positions-panel {
    order: 7;
  }

  .market-stats {
    order: 8;
  }

  .health-section {
    order: 9;
  }

  .section-rule {
    order: 10;
  }

  .center-column > .subsection-heading {
    order: 11;
  }

  .market-table-wrap {
    order: 12;
  }

  .watchlist-panel {
    width: 100%;
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .instrument-list {
    display: flex;
    max-height: none;
    margin: 8px -14px 0;
    overflow-x: auto;
    padding: 0 14px 8px;
  }

  .instrument-item {
    width: 158px;
    min-width: 158px;
    min-height: 62px;
    margin-right: 6px;
    border: 1px solid var(--line);
  }

  .instrument-item.is-selected {
    border-color: var(--line-strong);
    box-shadow: inset 0 -3px var(--green);
  }

  .quote-header {
    min-height: 54px;
    padding-bottom: 12px;
  }

  .instrument-symbol {
    width: 36px;
    height: 36px;
  }

  .quote-title h2 {
    max-width: 190px;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quote-title p {
    font-size: 10px;
  }

  .quote-current {
    gap: 4px;
  }

  .quote-current strong {
    font-size: 23px;
  }

  .quote-current > span {
    font-size: 10px;
  }

  .chart-toolbar {
    flex-wrap: wrap;
    margin-top: 10px;
  }

  .range-tabs {
    max-width: 100%;
  }

  .range-button {
    min-width: 34px;
    padding: 0 5px;
  }

  .chart-wrap {
    height: 250px;
  }

  .market-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 10px;
  }

  .health-list {
    grid-template-columns: 1fr;
  }

  .wallet-strip,
  .order-panel,
  .positions-panel {
    width: 100%;
  }

  .order-panel {
    padding: 15px;
  }

  .source-footer {
    display: grid;
    gap: 9px;
    padding: 15px 14px 20px;
  }

  .market-table {
    min-width: 560px;
  }

  .portfolio-table-wrap .market-table {
    min-width: 690px;
  }

  .activity-table {
    min-width: 650px;
  }

  .view-heading {
    align-items: center;
  }

  .portfolio-summary {
    gap: 10px;
  }

  .portfolio-summary strong {
    font-size: 13px;
  }
}
