:root {
  color-scheme: light;
  --header-height: 48px;
  --watchlist-width: 340px;
  --background: #f8f9fb;
  --panel: #ffffff;
  --text: #131722;
  --muted: #787b86;
  --faint: #a3a6af;
  --line: #e0e3eb;
  --line-soft: #eceef2;
  --hover: #f0f3fa;
  --selected: #eaf1ff;
  --blue: #2962ff;
  --accent: #2962ff;
  --green: #089981;
  --red: #f23645;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  background: var(--background);
  color: var(--text);
  font: 13px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

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

.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  width: 100%;
  height: var(--header-height);
  padding-right: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 10px;
  padding: 0 16px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 22px;
  height: 16px;
  border: 2px solid var(--blue);
  border-radius: 4px;
}

.brand-mark::before {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 3px;
  width: 11px;
  height: 7px;
  border-left: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: skewX(-28deg);
}

.brand strong {
  font-size: 14px;
  letter-spacing: -.01em;
}

.app-nav {
  display: flex;
  align-self: stretch;
  margin-left: 8px;
}

.app-nav a {
  display: inline-flex;
  position: relative;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.app-nav a:hover {
  background: var(--hover);
  color: var(--text);
}

.app-nav a.is-active {
  color: var(--text);
}

.app-nav a.is-active::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--blue);
}

.current-symbol {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  min-width: 0;
  height: 32px;
  gap: 8px;
  margin-left: 4px;
  padding: 0 9px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.current-symbol:hover {
  background: var(--hover);
}

.current-symbol strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-symbol-external {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.symbol-status {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

#marketControls {
  margin-left: auto;
}

.panel-toggle-button {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin-left: 8px;
  margin-right: 0;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.panel-toggle-button:hover {
  background: var(--hover);
  color: var(--text);
}

.panel-toggle-button[aria-pressed="true"] {
  color: var(--blue);
}

.panel-toggle-icon {
  position: relative;
  width: 17px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.panel-toggle-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 4px;
  bottom: 0;
  width: 1.5px;
  background: currentColor;
}

.workspace {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) var(--watchlist-width);
  width: 100%;
  height: calc(100% - var(--header-height));
  min-height: 0;
}

.workspace.is-watchlist-hidden {
  grid-template-columns: minmax(0, 1fr) 0;
}

.chart-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.watchlist-resizer {
  position: absolute;
  z-index: 8;
  top: 0;
  right: calc(var(--watchlist-width) - 2px);
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
  touch-action: none;
}

.watchlist-resizer:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

body.is-resizing,
body.is-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}

.chart-widget,
.chart-widget > .tradingview-widget-container {
  width: 100%;
  height: calc(100% - 24px);
}

.chart-widget .tradingview-widget-container__widget {
  width: 100%;
  height: 100%;
}

.chart-loading {
  display: grid;
  position: absolute;
  z-index: 2;
  inset: 0 0 24px;
  place-content: center;
  gap: 14px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.loading-mark {
  justify-self: center;
  width: 34px;
  height: 34px;
  border: 3px solid #dce4fb;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chart-error {
  display: grid;
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 42px;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid #ffd0d4;
  border-radius: 7px;
  background: #fff7f7;
  box-shadow: 0 8px 24px rgba(19, 23, 34, .12);
  color: var(--red);
  font-size: 12px;
}

.chart-error span {
  color: var(--muted);
}

.tradingview-attribution {
  display: flex;
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  align-items: center;
  justify-content: center;
  height: 24px;
  gap: 4px;
  border-top: 1px solid var(--line-soft);
  background: #fff;
  color: var(--muted);
  font-size: 10px;
}

.tradingview-attribution a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.tradingview-attribution a:hover {
  text-decoration: underline;
}

.watchlist-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid #ebebeb;
  background: var(--panel);
}

.workspace.is-watchlist-hidden .watchlist-resizer,
.workspace.is-watchlist-hidden .watchlist-panel {
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.watchlist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
}

.watchlist-picker {
  display: inline-flex;
  position: relative;
  align-items: center;
  min-width: 0;
  max-width: calc(100% - 38px);
  height: 34px;
  margin-left: -8px;
  padding: 0 1px 0 8px;
  color: #0f0f0f;
}

.watchlist-picker strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 28px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchlist-picker-arrow {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin: -3px 8px 0 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}

.watchlist-picker select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  cursor: default;
}

.watchlist-picker:focus-within {
  border-radius: 3px;
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.list-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 68px;
  gap: 6px;
  align-items: center;
  min-height: 27px;
  padding: 0 12px 0 52px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 10px;
}

.list-columns span:not(:first-child) {
  text-align: right;
}

.symbol-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.symbol-row {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 76px 68px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 48px;
  padding: 5px 11px 5px 12px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.symbol-row:hover {
  background: var(--hover);
}

.symbol-row.is-dragging {
  opacity: 0.42;
}

.symbol-row.drop-before::after,
.symbol-row.drop-after::after {
  content: "";
  position: absolute;
  right: 8px;
  left: 8px;
  z-index: 2;
  height: 2px;
  border-radius: 1px;
  background: var(--blue);
  pointer-events: none;
}

.symbol-row.drop-before::after {
  top: -1px;
}

.symbol-row.drop-after::after {
  bottom: -1px;
}

.symbol-row.is-selected {
  background: var(--selected);
}

.symbol-row.is-selected::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--blue);
}

.symbol-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f5f6f8;
  color: var(--muted);
  cursor: grab;
  font-size: 9px;
  font-weight: 800;
  touch-action: none;
  user-select: none;
}

.symbol-avatar:active {
  cursor: grabbing;
}

.symbol-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.symbol-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.symbol-code,
.symbol-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-code {
  font-size: 12px;
}

.symbol-name {
  color: var(--muted);
  font-size: 10px;
}

.symbol-price,
.symbol-change {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-price {
  font-size: 11px;
}

.symbol-change {
  font-size: 11px;
  font-weight: 600;
}

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

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

.empty-list {
  display: grid;
  align-content: center;
  justify-items: center;
  flex: 1 1 auto;
  min-height: 0;
  gap: 5px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-list strong {
  color: var(--text);
}

.empty-list a {
  margin-top: 6px;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.watchlist-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  gap: 10px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.watchlist-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watchlist-footer a {
  flex: 0 0 auto;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .brand strong {
    display: none;
  }

  .brand {
    padding-right: 8px;
  }

  .app-header {
    padding-right: 6px;
  }

  .app-nav {
    margin-left: 0;
  }

  .app-nav a {
    padding: 0 10px;
  }

  .panel-toggle-button {
    margin-left: 2px;
  }

  .current-symbol {
    max-width: 104px;
    gap: 5px;
    margin-left: 0;
    padding: 0 6px;
  }

  .current-symbol-external {
    display: none;
  }

  #marketControls .market-control-request-meta {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(460px, 64vh) minmax(390px, 1fr);
    height: auto;
    min-height: calc(100% - var(--header-height));
  }

  .chart-pane {
    min-height: 460px;
    border-bottom: 1px solid var(--line);
  }

  .watchlist-panel {
    min-height: 390px;
    border-left: 0;
  }

  .watchlist-resizer {
    display: none;
  }

  .workspace.is-watchlist-hidden {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(460px, calc(100vh - var(--header-height))) 0;
  }

  .workspace.is-watchlist-hidden .chart-pane {
    min-height: calc(100vh - var(--header-height));
  }
}

@media (max-width: 420px) {
  .current-symbol {
    max-width: 82px;
  }

  .symbol-row {
    grid-template-columns: 28px minmax(0, 1fr) 68px 62px;
    gap: 5px;
    padding-right: 7px;
    padding-left: 8px;
  }

  .list-columns {
    grid-template-columns: minmax(0, 1fr) 68px 62px;
    padding-right: 7px;
    padding-left: 43px;
  }
}
