/* AIPREME-HK mobile terminal baseline. Dark-only, single frame. */
:root {
  color-scheme: dark;
  --mt-bg: #000;
  --mt-surface: #101011;
  --mt-surface-2: #171719;
  --mt-surface-3: #242426;
  --mt-popover: #2c2c2e;
  --mt-text: #f6f6f7;
  --mt-muted: rgba(246, 246, 247, 0.64);
  --mt-dim: rgba(246, 246, 247, 0.38);
  --mt-line: rgba(255, 255, 255, 0.1);
  --mt-line-strong: rgba(255, 255, 255, 0.15);
  --mt-blue: #208cff;
  --mt-quote-blue: #5d8ef0;
  --mt-red: #e4565a;
  --mt-buy: #1479d5;
  --mt-sell: #e43b31;
  --mt-folder: #f0b52f;
  --mt-safe-top: max(env(safe-area-inset-top), 12px);
  --mt-top-offset: calc(var(--mt-safe-top) + 16px);
  --mt-toolbar-h: 68px;
  --mt-round-btn: 48px;
  --mt-side-pad: 16px;
  --mt-nav-h: 62px;
  --mt-nav-bottom: calc(18px + env(safe-area-inset-bottom));
  --mt-nav-clear: calc(var(--mt-nav-h) + var(--mt-nav-bottom) + 18px);
  --mt-tab-bg: rgba(24, 24, 25, 0.98);
  --mt-tab-active: #3c3c3e;
  --price-up: var(--mt-quote-blue);
  --price-down: var(--mt-red);
  --bg: var(--mt-bg);
  --app-bg: var(--mt-bg);
  --surface: var(--mt-surface);
  --surface-2: var(--mt-surface-2);
  --surface-3: var(--mt-surface-3);
  --line: var(--mt-line);
  --row-line: var(--mt-line);
  --text: var(--mt-text);
  --muted: var(--mt-muted);
  --soft: var(--mt-muted);
  --accent: var(--mt-blue);
  --buy: var(--mt-buy);
  --sell: var(--mt-sell);
}

html[data-price-colors="cn"] {
  --price-up: var(--mt-red);
  --price-down: var(--mt-quote-blue);
}

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--mt-bg);
  color: var(--mt-text);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

body,
button,
input,
select,
textarea {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  -webkit-user-select: text;
  user-select: text;
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: default;
  opacity: 0.48;
}

* {
  box-sizing: border-box;
}

[hidden],
.app [hidden] {
  display: none;
}

.launch-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
  background: #000;
  color: var(--mt-text);
  opacity: 1;
  visibility: visible;
  transition: opacity 360ms ease, visibility 360ms ease;
}

.launch-splash.is-hiding {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.launch-splash[hidden] {
  display: none;
}

.launch-splash-inner {
  display: grid;
  justify-items: center;
  gap: clamp(14px, 3.4vw, 18px);
  transform: translateY(-3vh);
}

.launch-splash img {
  width: clamp(92px, 22vw, 112px);
  height: clamp(92px, 22vw, 112px);
  object-fit: contain;
}

.launch-splash strong {
  font-size: clamp(23px, 5.4vw, 27px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
}

.app {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--mt-bg);
  color: var(--mt-text);
  overscroll-behavior: none;
}

.top,
.status-banner,
.sim-ribbon {
  display: none;
}

main {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: var(--mt-top-offset) 0 var(--mt-nav-clear);
  overflow: hidden;
  background: var(--mt-bg);
  overscroll-behavior: none;
}

.screen:not(.active) {
  display: none;
}

.screen.active {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--mt-bg);
  color: var(--mt-text);
  box-shadow: none;
  transform: none;
  transition: none;
  animation: none;
}

.panel,
.profile-hero,
.login-state {
  background: var(--mt-bg);
  color: var(--mt-text);
}

.screen-head,
.panel-title,
.auth-terminal-head,
.subview-head,
.chart-terminal-toolbar,
.trade-terminal-head,
.history-topbar,
.history-filter-head {
  flex: 0 0 var(--mt-toolbar-h);
  width: 100%;
  height: var(--mt-toolbar-h);
  min-height: var(--mt-toolbar-h);
  max-height: var(--mt-toolbar-h);
  margin: 0;
  padding: 0 var(--mt-side-pad);
  border: 0;
  border-radius: 0;
  background: var(--mt-bg);
  color: var(--mt-text);
  box-shadow: none;
}

.screen-head,
.panel-title,
.auth-terminal-head,
.subview-head,
.trade-terminal-head,
.history-filter-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 0;
}

#quotes .screen-head {
  grid-template-columns: 112px minmax(0, 1fr) 112px;
}

.chart-terminal-toolbar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 124px;
  align-items: center;
  border-bottom: 1px solid var(--mt-line);
}

.history-topbar {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
}

.screen-title,
.subview-title,
.trade-terminal-title,
.history-filter-head h2 {
  justify-self: center;
  min-width: 0;
  text-align: center;
}

.screen-title h2,
.panel-title h2,
.subview-title h2,
.trade-terminal-title h2,
.history-filter-head h2 {
  margin: 0;
  color: var(--mt-text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.screen-caption,
.subview-title span,
.trade-terminal-title span,
.panel-title > span {
  display: block;
  margin-top: 6px;
  color: var(--mt-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}

#quotes .screen-caption,
#marketBrowser .screen-caption {
  display: none;
}

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

.icon-btn,
.back-btn,
.round-icon,
.history-round-btn,
.trade-back-btn,
.trade-add-btn,
.chart-tool-btn,
.chart-toolbar-btn,
.profile-back,
.trade-sheet-back {
  width: var(--mt-round-btn);
  height: var(--mt-round-btn);
  min-width: var(--mt-round-btn);
  min-height: var(--mt-round-btn);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--mt-tab-bg);
  color: var(--mt-text);
  box-shadow: none;
}

.icon-btn.primary {
  color: var(--mt-blue);
}

.icon-btn svg,
.back-btn svg,
.history-round-btn svg,
.trade-back-btn svg,
.trade-add-btn svg,
.chart-tool-btn svg,
.chart-toolbar-btn svg,
.profile-back svg,
.trade-sheet-back svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trade-add-btn {
  color: var(--mt-blue);
  font-size: 31px;
  font-weight: 300;
  line-height: 1;
}

.nav {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: var(--mt-nav-bottom);
  width: min(388px, calc(100vw - 42px));
  height: var(--mt-nav-h);
  min-height: var(--mt-nav-h);
  padding: 4px;
  border: 1px solid var(--mt-line-strong);
  border-radius: 34px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  background: var(--mt-tab-bg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
  transform: translateX(-50%);
}

.nav::before,
.nav::after {
  display: none;
  content: none;
}

.nav button {
  width: 100%;
  height: 54px;
  min-height: 54px;
  min-width: 0;
  padding: 4px 0 5px;
  border: 0;
  border-radius: 29px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  color: rgba(246, 246, 247, 0.86);
  box-shadow: none;
  opacity: 1;
}

.app[data-screen="quotes"] .nav button[data-target="quotes"],
.app[data-screen="browse"] .nav button[data-target="quotes"],
.app[data-screen="chart"] .nav button[data-target="chart"],
.app[data-screen="trade"] .nav button[data-target="trade"],
.app[data-screen="history"] .nav button[data-target="history"],
.app[data-screen="profile"] .nav button[data-target="profile"] {
  background: var(--mt-tab-active);
  color: var(--mt-blue);
}

.nav .nav-icon,
.nav .nav-icon svg {
  width: 24px;
  height: 24px;
}

.nav svg {
  stroke: currentColor;
  stroke-width: 2.25;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav span:last-child {
  color: currentColor;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.quote-list,
.market-list,
.trade-account-view,
.ticket,
.history-list,
.history-filter-page,
.profile-subview form,
.setting-stack {
  -webkit-overflow-scrolling: touch;
}

.quote-list,
.market-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 var(--mt-nav-clear);
  background: var(--mt-bg);
}

.quote-card,
.quote-card-detail {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.quote-select,
.quote-detail-select {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--mt-text);
  box-shadow: none;
}

.quote-card-detail .quote-detail-select {
  min-height: 70px;
  height: 70px;
  padding: 0 15px;
  display: grid;
  grid-template-columns: minmax(128px, 1.08fr) minmax(92px, 0.84fr) minmax(92px, 0.84fr);
  align-items: center;
  column-gap: 6px;
}

.quote-detail-symbol {
  min-width: 0;
  display: grid;
  grid-template-rows: 18px 25px 20px;
  align-content: center;
  justify-items: start;
  text-align: left;
}

.quote-detail-symbol strong,
.quote-symbol strong {
  display: block;
  overflow: hidden;
  color: var(--mt-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-detail-symbol .quote-delta,
.quote-detail-symbol .quote-time {
  color: var(--mt-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  white-space: nowrap;
}

.quote-detail-price {
  min-width: 0;
  display: grid;
  grid-template-rows: 40px 20px;
  align-content: center;
  justify-items: end;
  text-align: right;
}

.quote-detail-price > strong,
.quote-detail-price > span {
  white-space: nowrap;
}

.quote-detail-price > span {
  color: var(--mt-muted);
  font-size: 13px;
  line-height: 18px;
}

.terminal-price {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  border-radius: 4px;
}

.app[data-market-pulse="on"] .terminal-price::after {
  content: "";
  position: absolute;
  inset: -26% -54%;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 42%, rgba(255, 255, 255, 0.16) 50%, transparent 58%);
  transform: translateX(-72%);
  animation: terminal-price-scan 1.65s cubic-bezier(0.42, 0, 0.2, 1) infinite;
  mix-blend-mode: screen;
}

.app[data-market-pulse="on"] .terminal-price-lead,
.app[data-market-pulse="on"] .terminal-price-major,
.app[data-market-pulse="on"] .terminal-price sup {
  animation: terminal-price-breathe 1.65s ease-in-out infinite;
}

.terminal-price-lead {
  font-size: 19px;
  font-weight: 650;
  line-height: 1;
}

.terminal-price-major {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.terminal-price sup {
  position: relative;
  top: -0.42em;
  margin-left: 1px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.quote-placeholder-price {
  color: var(--mt-dim);
  font-size: 24px;
  font-weight: 600;
}

.quote-table-head {
  height: 34px;
  padding: 0 15px;
  display: grid;
  grid-template-columns: minmax(98px, 1fr) minmax(80px, 0.78fr) minmax(80px, 0.78fr) 60px;
  align-items: center;
  color: var(--mt-muted);
  font-size: 17px;
  font-weight: 400;
}

.quote-table-head span:nth-child(n + 2) {
  text-align: right;
}

.quote-card:not(.quote-card-detail) .quote-select {
  min-height: 43px;
  height: 43px;
  padding: 0 15px;
  display: grid;
  grid-template-columns: minmax(98px, 1fr) minmax(80px, 0.78fr) minmax(80px, 0.78fr) 60px;
  align-items: center;
  gap: 8px;
}

.quote-symbol span,
.quote-numbers em,
.quote-numbers span,
.quote-remove {
  display: none;
}

.quote-numbers,
.quote-change-cell {
  min-width: 0;
  color: var(--mt-text);
  text-align: right;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}

.quote-delta.up,
.quote-change-cell.up,
.position-profit.up,
.history-order-profit.up,
.history-deal-head em.up,
.price.up,
.fund-amount.up,
.buy,
.side-buy {
  color: var(--price-up);
}

.quote-delta.down,
.quote-change-cell.down,
.position-profit.down,
.history-order-profit.down,
.history-deal-head em.down,
.price.down,
.fund-amount.down,
.sell,
.side-sell {
  color: var(--price-down);
}

.quote-edit-list {
  padding: 0 18px var(--mt-nav-clear);
}

.quote-edit-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  border-bottom: 1px solid var(--mt-line);
}

.quote-edit-symbol,
.quote-edit-remove,
.quote-drag-handle {
  border: 0;
  background: transparent;
  color: var(--mt-text);
}

.quote-edit-symbol {
  text-align: left;
  font-size: 20px;
  font-weight: 500;
}

.market-tools {
  flex: 0 0 auto;
  min-height: 58px;
  padding: 0 var(--mt-side-pad) 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  background: var(--mt-bg);
}

.market-search-box {
  position: relative;
  width: 100%;
  height: 46px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 44px;
  align-items: center;
  border-radius: 23px;
  background: var(--mt-surface-2);
}

#marketSearch {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: 46px;
  padding: 0 46px 0 54px;
  border: 0;
  border-radius: 23px;
  background: transparent;
  color: var(--mt-text);
  font-size: 17px;
}

#marketSearch::placeholder {
  color: var(--mt-dim);
}

.market-search-icon {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2.5px solid var(--mt-text);
  border-radius: 50%;
  pointer-events: none;
}

.market-search-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 3px;
  right: -8px;
  bottom: -5px;
  border-radius: 2px;
  background: var(--mt-text);
  transform: rotate(45deg);
}

.market-search-clear {
  z-index: 1;
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--mt-text);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.market-search-chip,
.category-tabs {
  display: none;
}

.market-folder-row,
.market-row {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  color: var(--mt-text);
  text-align: left;
}

.market-folder-row {
  height: 70px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 12px;
  background: transparent;
}

.market-folder-icon {
  position: relative;
  width: 23px;
  height: 17px;
  border: 2px solid var(--mt-folder);
  border-radius: 3px;
}

.market-folder-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -7px;
  width: 10px;
  height: 5px;
  border: 2px solid var(--mt-folder);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.market-folder-name {
  font-size: 20px;
  font-weight: 400;
}

.market-folder-count,
.market-folder-chevron {
  color: var(--mt-dim);
  font-size: 18px;
  font-weight: 400;
}

.market-row {
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--mt-line);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 36px;
  align-items: center;
  background: var(--mt-surface-2);
}

.market-pick,
.market-info,
.market-select {
  border: 0;
  background: transparent;
}

.market-pick {
  color: var(--mt-blue);
  font-size: 26px;
}

.market-symbol strong {
  color: var(--mt-text);
  font-size: 20px;
  font-weight: 400;
}

.market-symbol span {
  display: none;
}

#chartSection {
  background: var(--mt-bg);
}

.chart-tf-toggle {
  justify-self: start;
  min-width: 52px;
  height: var(--mt-round-btn);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mt-blue);
  font-size: 20px;
  font-weight: 700;
}

.chart-toolbar-actions {
  justify-self: center;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.chart-toolbar-actions-right {
  justify-self: end;
  gap: 12px;
}

#chartMode,
.chart-symbol-row,
.chart-statbar,
.chart-tools,
.chart-meta {
  display: none;
}

.chart-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--mt-bg);
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.chart-wrap::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: 0;
  width: 36%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(93, 142, 240, 0.03) 42%, rgba(93, 142, 240, 0.14) 50%, rgba(93, 142, 240, 0.03) 58%, transparent 100%);
  transform: translateX(-130%);
}

.app[data-market-pulse="on"] .chart-wrap::after {
  opacity: 1;
  animation: chart-live-sweep 2.8s linear infinite;
}

#chart {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--mt-bg);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

@keyframes terminal-price-scan {
  0% {
    transform: translateX(-72%);
  }
  58%,
  100% {
    transform: translateX(72%);
  }
}

@keyframes terminal-price-breathe {
  0%,
  100% {
    opacity: 1;
    text-shadow: none;
  }
  50% {
    opacity: 0.92;
    text-shadow: 0 0 14px rgba(93, 142, 240, 0.2);
  }
}

@keyframes chart-live-sweep {
  0% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(380%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app[data-market-pulse="on"] .terminal-price::after,
  .app[data-market-pulse="on"] .chart-wrap::after,
  .app[data-market-pulse="on"] .terminal-price-lead,
  .app[data-market-pulse="on"] .terminal-price-major,
  .app[data-market-pulse="on"] .terminal-price sup {
    animation: none;
  }
}

.timeframes {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: var(--mt-toolbar-h);
  height: 0;
  overflow: visible;
  display: none;
  padding: 0 16px;
  background: var(--mt-bg);
}

#chartSection[data-timeframes="open"] .timeframes {
  height: 52px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
}

#chartSection[data-timeframes="open"] .chart-wrap {
  padding-top: 52px;
}

.timeframes button {
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--mt-text);
  font-size: 17px;
  font-weight: 700;
}

.timeframes button.active {
  color: var(--mt-blue);
}

.chart-quick-trade {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  top: var(--mt-toolbar-h);
  height: 58px;
  display: none;
  grid-template-columns: 1fr 120px 1fr;
  border-top: 1px solid var(--mt-line);
  border-bottom: 1px solid var(--mt-line);
  background: var(--mt-surface);
}

#chartSection[data-trade-panel="open"] .chart-quick-trade {
  display: grid;
}

.chart-quote-action,
.chart-lot-control {
  border: 0;
  border-radius: 0;
  background: var(--mt-surface);
  color: var(--mt-text);
}

.chart-quote-action strong {
  display: block;
  font-size: 25px;
  font-weight: 700;
}

.chart-lot-control {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
}

.chart-lot-control button {
  border: 0;
  background: transparent;
  color: var(--mt-blue);
}

.trade-symbol-row,
.risk-strip,
.contract-spec-card,
.contract-note,
.estimate-grid,
.order-preview,
.trade-price-band,
.quick-volume,
.order-lot .label {
  display: none;
}

#trade {
  overflow: hidden;
}

.trade-terminal-title {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--mt-text);
  padding: 0;
}

.trade-back-btn {
  grid-column: 1;
}

.trade-terminal-title {
  grid-column: 2;
}

.trade-add-btn {
  grid-column: 3;
  justify-self: end;
}

.app[data-trade-view="account"] .trade-terminal-head {
  grid-template-columns: minmax(0, 1fr) 56px;
}

.app[data-trade-view="account"] .trade-terminal-title {
  grid-column: 1;
  justify-self: start;
}

.app[data-trade-view="account"] .trade-add-btn {
  grid-column: 2;
}

.app[data-trade-view="account"] .trade-back-btn,
.app[data-trade-view="account"] .trade-terminal-title span,
.app[data-trade-view="account"] #trade .ticket {
  display: none;
}

.app[data-trade-view="order"] .trade-add-btn,
.app[data-trade-view="order"] .trade-account-view {
  display: none;
}

.app[data-trade-view="order"] .trade-terminal-head {
  grid-template-columns: 56px minmax(0, 1fr) 56px;
}

.app[data-trade-view="order"] .trade-add-btn {
  visibility: hidden;
  display: inline-grid;
}

.trade-account-view {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 14px var(--mt-nav-clear);
  overflow-y: auto;
  background: var(--mt-bg);
}

.trade-account-lines {
  margin: 8px 0 0;
  display: grid;
  gap: 7px;
}

.trade-account-lines div {
  min-height: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  color: var(--mt-text);
  font-size: 17px;
  font-weight: 400;
}

.trade-account-lines strong {
  color: var(--mt-text);
  font-size: 19px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.trade-empty-mark {
  width: 128px;
  height: 128px;
  margin: 190px auto 0;
  display: grid;
  place-items: center;
  color: var(--mt-text);
}

.trade-empty-mark svg {
  width: 124px;
  height: 104px;
  stroke: currentColor;
  stroke-width: 12;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trade-account-view[data-positions="open"] .trade-empty-mark {
  display: none;
}

.trade-account-positions {
  display: grid;
  gap: 0;
}

.mt5-position-row {
  position: relative;
  min-height: 82px;
  padding: 9px 0 11px;
  border-bottom: 1px solid var(--mt-line);
  background: transparent;
}

.position-line-main,
.position-line-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 10px;
}

.position-symbol {
  color: var(--mt-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.position-side {
  margin-left: 8px;
  font-size: 15px;
  font-style: normal;
}

.position-line-main small,
.position-line-meta span {
  display: block;
  color: var(--mt-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
}

.position-profit {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.15;
}

.position-close-action {
  height: 32px;
  min-width: 58px;
  margin-top: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 16px;
  background: rgba(32, 140, 255, 0.16);
  color: var(--mt-blue);
  font-size: 13px;
  font-weight: 500;
}

#trade .ticket {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 0 var(--mt-nav-clear);
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: var(--mt-surface);
  box-shadow: none;
}

.trade-order-type-row {
  width: 100%;
  height: 56px;
  min-height: 56px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--mt-line);
  border-radius: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  background: var(--mt-bg);
  color: var(--mt-text);
  font-size: 19px;
  font-weight: 500;
  text-align: left;
}

.trade-order-type-row svg {
  width: 22px;
  height: 22px;
  justify-self: end;
  stroke: currentColor;
  stroke-width: 3;
  fill: none;
}

.trade-order-type-list {
  width: 100%;
  margin: 0;
  padding: 16px 18px 8px;
  border: 0;
  border-bottom: 1px solid var(--mt-line);
  border-radius: 0;
  background: var(--mt-bg);
  box-shadow: none;
}

.trade-order-type-list button {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  background: transparent;
  color: var(--mt-blue);
  text-align: left;
  font-size: 20px;
  font-weight: 400;
}

.trade-order-type-list button svg {
  width: 22px;
  height: 22px;
  justify-self: end;
  stroke: currentColor;
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trade-order-type-list .sell-option {
  color: var(--mt-red);
}

.trade-form {
  padding: 20px 18px 0;
  background: var(--mt-surface);
}

.order-grid.order-lot {
  height: 40px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 0;
}

.ticket-volume-step {
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mt-blue);
  font-size: 19px;
  font-weight: 700;
}

.order-lot label {
  display: block;
}

#volume {
  width: 100%;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mt-text);
  text-align: center;
  font-size: 19px;
  font-weight: 500;
}

.protection-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--mt-line);
  border-bottom: 1px solid var(--mt-line);
}

.protection-grid label {
  min-height: 56px;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 34px;
  align-items: center;
  border-bottom: 1px solid var(--mt-line);
}

.protection-grid label:last-child {
  border-bottom: 0;
}

.protection-grid label::after {
  content: "+";
  justify-self: end;
  color: var(--mt-blue);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.protection-grid .label,
.trade-fill-policy-row,
.trade-fill-policy-row strong {
  color: var(--mt-text);
  font-size: 17px;
  font-weight: 400;
}

.protection-grid input {
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: rgba(18, 18, 19, 0.55);
  color: var(--mt-muted);
  text-align: center;
  font-size: 17px;
}

.protection-grid input::placeholder {
  color: var(--mt-dim);
  opacity: 1;
}

.trade-fill-policy-row {
  min-height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--mt-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: var(--mt-surface);
}

.trade-fill-policy-row strong {
  color: var(--mt-muted);
}

.trade-actions {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--mt-surface);
}

.trade-btn {
  position: relative;
  height: 86px;
  padding: 50px 0 0;
  border: 0;
  border-radius: 0;
  color: #fff;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.trade-btn::before {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  display: block;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sell-btn {
  background: var(--mt-sell);
}

.buy-btn {
  background: var(--mt-buy);
}

.sell-btn::before {
  content: var(--trade-bid-label, "--");
}

.buy-btn::before {
  content: var(--trade-ask-label, "--");
}

.trade-caution {
  margin: 18px 26px 0;
  color: var(--mt-muted);
  text-align: center;
  font-size: 15px;
  line-height: 1.42;
}

.trade-symbol-sheet,
.trade-result-sheet {
  position: absolute;
  z-index: 120;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--mt-bg);
}

.trade-sheet-head {
  flex: 0 0 var(--mt-toolbar-h);
  height: var(--mt-toolbar-h);
  padding: 0 var(--mt-side-pad);
  display: flex;
  align-items: center;
}

.trade-symbol-sheet-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 var(--mt-nav-clear);
  background: var(--mt-surface-2);
}

.trade-symbol-sheet-list button {
  width: 100%;
  min-height: 58px;
  padding: 0 22px;
  border: 0;
  border-bottom: 1px solid var(--mt-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  background: var(--mt-surface-2);
  color: var(--mt-text);
  text-align: left;
  font-size: 20px;
  font-weight: 400;
}

.trade-symbol-sheet-list svg {
  width: 26px;
  height: 26px;
  stroke: var(--mt-blue);
  stroke-width: 2.6;
  fill: none;
}

.trade-result-sheet {
  justify-content: center;
  align-items: center;
  padding: var(--mt-top-offset) 20px var(--mt-nav-clear);
  background: rgba(0, 0, 0, 0.78);
}

.trade-result-card {
  width: min(352px, calc(100vw - 40px));
  max-height: calc(100dvh - var(--mt-top-offset) - var(--mt-nav-clear) - 36px);
  padding: 18px;
  border: 0;
  border-radius: 18px;
  display: grid;
  gap: 10px;
  overflow-y: auto;
  background: var(--mt-popover);
  box-shadow: none;
}

.trade-result-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 2px;
  border: 1px solid var(--mt-line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(32, 140, 255, 0.18);
  color: var(--mt-blue);
  font-size: 30px;
  font-weight: 500;
}

.trade-result-sheet[data-state="error"] .trade-result-icon {
  background: rgba(228, 86, 90, 0.18);
  color: var(--mt-red);
}

.trade-result-card h3,
.trade-result-card p {
  margin: 0;
  text-align: center;
}

.trade-result-card h3 {
  color: var(--mt-text);
  font-size: 22px;
  font-weight: 700;
}

.trade-result-card p {
  color: var(--mt-muted);
  font-size: 14px;
}

.trade-result-details {
  display: grid;
  border-top: 1px solid var(--mt-line);
  border-bottom: 1px solid var(--mt-line);
}

.trade-result-details div {
  min-height: 31px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--mt-line);
}

.trade-result-details div:last-child {
  border-bottom: 0;
}

.trade-result-details span {
  color: var(--mt-muted);
  font-size: 13px;
}

.trade-result-details strong {
  min-width: 0;
  color: var(--mt-text);
  text-align: right;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.trade-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.trade-result-actions button {
  height: 40px;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--mt-text);
  font-size: 14px;
  font-weight: 600;
}

.trade-result-actions button:first-child {
  background: var(--mt-blue);
  color: #fff;
}

.history-shell,
.history-home,
.history-filter-page {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--mt-bg);
}

.history-segments {
  justify-self: center;
  width: 214px;
  min-width: 214px;
  height: 48px;
  padding: 3px;
  border: 1px solid var(--mt-line-strong);
  border-radius: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  background: var(--mt-tab-bg);
}

.history-segments button {
  width: 100%;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
  color: var(--mt-text);
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
}

.history-segments button.active {
  background: var(--mt-tab-active);
}

.history-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--mt-side-pad) var(--mt-nav-clear);
  background: var(--mt-bg);
}

.history-empty {
  min-height: 500px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--mt-dim);
  background: var(--mt-bg);
}

.history-empty svg {
  width: 112px;
  height: 96px;
  stroke: var(--mt-text);
  stroke-width: 9;
  fill: none;
  opacity: 1;
}

.history-empty span {
  color: var(--mt-dim);
  font-size: 16px;
}

.history-order-row,
.history-deal-row {
  min-height: 76px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--mt-line);
  display: grid;
  align-content: start;
  gap: 3px;
  background: transparent;
}

.history-order-head,
.history-order-price,
.history-order-meta,
.history-order-stops,
.history-deal-head,
.history-deal-meta,
.history-deal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 18px;
  line-height: 1.12;
}

.history-order-stops {
  grid-template-columns: 1fr 1fr;
}

.history-order-head strong,
.history-deal-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--mt-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-order-head span,
.history-order-price span,
.history-order-meta span,
.history-order-stops span,
.history-deal-meta span,
.history-deal-grid span,
.history-deal-grid strong,
.history-deal-head small {
  min-width: 0;
  overflow: hidden;
  color: var(--mt-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-order-price em {
  margin-right: 5px;
  font-style: normal;
}

.history-deal-head > span {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.history-deal-head em,
.history-order-profit {
  font-size: 18px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.15;
}

.history-filter-page {
  overflow-y: auto;
  padding: 0 var(--mt-side-pad) var(--mt-nav-clear);
  background: var(--mt-bg);
}

.history-filter-page .history-filter-head {
  margin: 0 calc(var(--mt-side-pad) * -1);
}

.history-symbol-filter,
.history-report-card {
  width: 100%;
  min-height: 60px;
  margin: 12px 0 0;
  padding: 0 22px;
  border: 0;
  border-radius: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: var(--mt-surface);
  color: var(--mt-text);
  text-align: left;
  font-size: 18px;
  font-weight: 400;
}

.history-symbol-filter strong,
.history-report-card em {
  color: var(--mt-muted);
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
}

.history-range-card {
  width: 100%;
  margin: 36px 0 0;
  padding: 15px 22px;
  border: 0;
  border-radius: 26px;
  background: var(--mt-popover);
}

.history-range-card button,
.history-sort-list button {
  width: 100%;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--mt-line);
  background: transparent;
  color: var(--mt-text);
  text-align: left;
  font-size: 20px;
  font-weight: 400;
  white-space: nowrap;
}

.history-range-card button:last-child,
.history-sort-list button:last-child {
  border-bottom: 0;
}

.history-range-card button.active,
.history-sort-list button.active {
  color: var(--mt-blue);
}

.history-sort-popover {
  position: absolute;
  z-index: 95;
  left: var(--mt-side-pad);
  top: calc(var(--mt-top-offset) + var(--mt-toolbar-h) - 6px);
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--mt-top-offset) - var(--mt-toolbar-h) - var(--mt-nav-clear));
  padding: 0 16px 13px;
  overflow-y: auto;
  border: 0;
  border-radius: 20px;
  background: var(--mt-popover);
  box-shadow: none;
}

.history-sort-title {
  height: 54px;
  display: grid;
  align-items: center;
  color: var(--mt-text);
  font-size: 19px;
  font-weight: 600;
}

#profileHome,
#profile,
#accountSettings,
.profile-subview,
#profileDetails,
#accountOverview {
  background: var(--mt-bg);
  color: var(--mt-text);
}

#profileHome.screen.active,
#profile.screen.active,
#accountSettings.screen.active,
.profile-subview.screen.active,
#profileDetails.screen.active,
#accountOverview.screen.active {
  overflow-y: auto;
  padding: 0 0 var(--mt-nav-clear);
  scrollbar-width: none;
}

#profileHome.screen.active::-webkit-scrollbar,
#profile.screen.active::-webkit-scrollbar,
#accountSettings.screen.active::-webkit-scrollbar,
.profile-subview.screen.active::-webkit-scrollbar {
  display: none;
}

.profile-brand,
#accountSettings > .panel-title,
#profileDetails > .panel-title,
#accountOverview > .panel-title {
  flex: 0 0 var(--mt-toolbar-h);
  height: var(--mt-toolbar-h);
  min-height: var(--mt-toolbar-h);
  margin: 0;
  padding: 0 var(--mt-side-pad);
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  background: var(--mt-bg);
}

.profile-brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.profile-brand span,
#accountSettings > .panel-title h2,
#profileDetails > .panel-title h2,
#accountOverview > .panel-title h2 {
  justify-self: center;
  margin: 0;
  color: var(--mt-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

#accountSettings > .panel-title > span,
#profileDetails > .panel-title > span,
#accountOverview > .panel-title > span {
  justify-self: end;
  color: var(--mt-muted);
  font-size: 12px;
}

.profile-id,
.profile-balance-grid,
.profile-actions,
.settings-menu,
.subview-section,
.auth-card,
.setting-stack,
.account-grid,
.risk-grid,
.profile-list,
.account-form,
.security-form {
  margin-left: var(--mt-side-pad);
  margin-right: var(--mt-side-pad);
}

.profile-id,
.auth-card,
.setting-block,
.subview-section,
.profile-balance,
.settings-entry,
.metric,
.status-chip,
.profile-line {
  border: 1px solid var(--mt-line);
  border-radius: 8px;
  background: var(--mt-surface);
  color: var(--mt-text);
}

.profile-id {
  margin-top: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #c99533, #5d8ef0);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.profile-copy h2,
.user-name {
  margin: 0;
  color: var(--mt-text);
  font-size: 22px;
  font-weight: 700;
}

.profile-copy span,
.status-line,
.profile-tag,
.label,
.form-status,
.note-list,
.risk-note {
  color: var(--mt-muted);
}

.profile-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tag,
.api-dot,
.verify-status {
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 12px;
  background: var(--mt-surface-3);
  font-size: 12px;
}

.api-dot[data-mode="backend"] {
  color: var(--mt-blue);
}

.api-dot[data-mode="waiting"],
.api-dot[data-mode="unavailable"] {
  color: var(--mt-red);
}

.api-dot[data-mode="market"],
.api-dot[data-mode="recovering"] {
  color: var(--mt-quote-blue);
}

.account-grid,
.risk-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.profile-balance-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.profile-balance,
.metric,
.status-chip {
  min-width: 0;
  padding: 12px;
}

.profile-balance strong,
.metric .value,
.status-chip strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--mt-text);
  font-size: 17px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-balance {
  min-height: 56px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(118px, auto);
  align-items: center;
  gap: 14px;
}

.profile-balance strong {
  margin-top: 0;
  text-align: right;
  font-size: 18px;
}

.profile-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-actions button,
.primary-btn,
.ghost-btn,
.auth-choice,
.settings-entry,
.symbol-action-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--mt-surface-2);
  color: var(--mt-text);
  font-size: 15px;
  font-weight: 600;
}

.primary-btn,
.auth-choice.primary {
  background: var(--mt-blue);
  color: #fff;
}

.ghost-btn {
  border: 1px solid var(--mt-line);
  background: transparent;
}

.settings-menu {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.settings-entry {
  width: 100%;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.settings-entry strong,
.auth-form-head strong,
.setting-label span:first-child,
.subview-section-title span:first-child,
.profile-line strong {
  color: var(--mt-text);
  font-size: 16px;
  font-weight: 700;
}

.settings-entry small,
.settings-entry > span,
.auth-form-head span,
.setting-label span:last-child,
.subview-section-title span:last-child,
.profile-line span {
  color: var(--mt-muted);
  font-size: 13px;
  font-weight: 400;
}

.subview-section,
.setting-block,
.auth-card,
.profile-list,
.account-form,
.security-form {
  margin-top: 12px;
  padding: 14px;
}

.subview-section-title,
.setting-label,
.profile-line,
.info-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.info-grid,
.form-grid,
.register-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-line,
.form-field,
.profile-line {
  min-height: 46px;
}

.info-line.wide,
.form-field.wide,
.register-grid .wide,
.risk-grid .risk-note {
  grid-column: 1 / -1;
}

.info-line span,
.form-field {
  color: var(--mt-muted);
  font-size: 13px;
}

.info-line strong {
  min-width: 0;
  overflow: hidden;
  color: var(--mt-text);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.form-field {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--mt-line);
  border-radius: 8px;
  background: var(--mt-surface-2);
  color: var(--mt-text);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--mt-dim);
}

.auth-card {
  display: grid;
  gap: 14px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mt-text);
  font-weight: 700;
}

.auth-brand img {
  width: 32px;
  height: 32px;
}

.login-summary {
  display: grid;
  gap: 6px;
}

.auth-entry,
.auth-tabs,
.register-actions,
.form-actions-row {
  display: grid;
  gap: 10px;
}

.auth-tabs,
.register-actions,
.form-actions-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

.auth-choice {
  min-height: 62px;
  padding: 12px;
  display: grid;
  gap: 4px;
  text-align: left;
}

.login-form,
.register-form {
  display: grid;
  gap: 10px;
}

.register-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  color: var(--mt-muted);
  font-size: 12px;
}

.register-progress span.active {
  color: var(--mt-blue);
}

.register-code-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(100px, 0.8fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.register-code-row.compact,
.profile-contact-code {
  grid-template-columns: minmax(0, 1fr) auto;
}

#profile {
  --settings-bg: var(--mt-bg);
  --settings-card: var(--mt-surface);
  --settings-field: var(--mt-surface-2);
  --settings-text: var(--mt-text);
  --settings-muted: var(--mt-muted);
  --settings-line: var(--mt-line);
  background: var(--settings-bg);
  color: var(--settings-text);
}

#profile.screen.active {
  padding: 0 0 var(--mt-nav-clear);
  background: var(--settings-bg);
  color: var(--settings-text);
}

#profile .auth-terminal-head {
  background: var(--settings-bg);
  color: var(--settings-text);
}

#profile .auth-terminal-head .back-btn,
#profile .broker-back-btn {
  border: 1px solid var(--settings-line);
  background: var(--settings-field);
  color: var(--settings-text);
  box-shadow: none;
}

#profile .auth-terminal-head .subview-title h2 {
  color: var(--settings-text);
  font-size: 18px;
  font-weight: 700;
}

#profile .auth-terminal-head .subview-title span {
  display: none;
}

#profile[data-auth-mode="broker"] > .auth-terminal-head,
#profile[data-auth-mode="login"] > .auth-terminal-head,
#profile[data-auth-mode="register"] > .auth-terminal-head {
  display: none;
}

.settings-account-card,
.auth-workspace {
  margin: 0 20px 16px;
  color: var(--settings-text);
}

.settings-account-card {
  overflow: hidden;
  border: 1px solid var(--settings-line);
  border-radius: 8px;
  background: var(--settings-card);
  box-shadow: none;
}

.settings-account-strip {
  height: 2px;
  background: #1591ff;
}

.settings-account-summary {
  min-height: 82px;
  padding: 14px 18px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  text-align: center;
}

.broker-logo-wrap img {
  max-width: 100%;
  max-height: 100%;
}

#profile .login-summary {
  min-width: 0;
}

#profile .user-name {
  overflow: hidden;
  color: var(--settings-text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profile .status-line {
  margin-top: 4px;
  overflow: hidden;
  color: var(--settings-muted);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profile .api-dot {
  display: none;
}

.settings-account-list {
  display: grid;
}

.settings-account-row,
.broker-row {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-top: 1px solid var(--settings-line);
  border-radius: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--settings-text);
  text-align: left;
}

.settings-account-row {
  padding: 8px 18px;
}

.settings-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

.settings-row-icon.account-add {
  background: #42c84d;
}

.settings-row-icon.account-login {
  position: relative;
  background: #2b8cff;
}

.settings-row-icon.account-login::before {
  content: "";
  width: 15px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 3px;
}

.settings-row-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.settings-row-copy strong,
.broker-copy strong {
  overflow: hidden;
  color: var(--settings-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-copy small,
.broker-copy small {
  overflow: hidden;
  color: var(--settings-muted);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-chevron {
  justify-self: end;
  color: var(--settings-muted);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.broker-select-view {
  min-height: calc(100dvh - var(--mt-top-offset) - var(--mt-nav-clear));
  padding: 12px 20px 18px;
  display: grid;
  grid-template-rows: 58px auto minmax(0, 1fr) auto;
  color: var(--settings-text);
}

.broker-select-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
}

.broker-select-head h2 {
  margin: 0;
  color: var(--settings-text);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.broker-back-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 34px;
  line-height: 1;
}

.broker-row {
  min-height: 72px;
  padding: 10px 0;
  border-top: 0;
  grid-template-columns: 38px minmax(0, 1fr);
}

.broker-logo-wrap {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.broker-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.broker-search {
  grid-row: 4;
  align-self: end;
  min-height: 48px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--settings-line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: var(--settings-card);
  box-shadow: none;
}

.broker-search span {
  width: 14px;
  height: 14px;
  border: 2px solid var(--settings-text);
  border-radius: 50%;
  position: relative;
}

.broker-search span::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--settings-text);
  transform: rotate(45deg);
}

.broker-search input {
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
}

#profile .auth-workspace {
  border: 1px solid var(--settings-line);
  border-radius: 8px;
  margin-top: 12px;
  padding: 0 16px 16px;
  background: var(--settings-card);
  box-shadow: none;
}

.auth-workspace-head {
  min-height: 60px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
}

.auth-workspace-head h2 {
  margin: 0;
  color: var(--settings-text);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.auth-flow-back {
  width: 44px;
  height: 44px;
  border: 1px solid var(--settings-line);
  border-radius: 50%;
  background: var(--settings-field);
  color: var(--settings-text);
  font-size: 34px;
  line-height: 1;
}

#profile .login-form,
#profile .register-form {
  gap: 12px;
}

#profile .auth-form-head {
  display: grid;
  gap: 6px;
}

#profile .auth-form-head strong {
  color: var(--settings-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

#profile .auth-form-head span {
  display: block;
  color: var(--settings-muted);
  font-size: 13px;
  line-height: 1.35;
}

#profile input,
#profile select {
  min-height: 46px;
  border-color: var(--settings-line);
  border-radius: 8px;
  background: var(--settings-field);
  color: var(--settings-text);
}

#profile input::placeholder {
  color: var(--mt-dim);
}

#profile .broker-search input {
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#profile select {
  appearance: none;
  padding-right: 34px;
  background-color: var(--settings-field);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--settings-muted) 50%),
    linear-gradient(135deg, var(--settings-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

#profile .register-progress {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#profile .register-progress span {
  min-height: 24px;
  border-bottom: 2px solid var(--settings-line);
  color: var(--settings-muted);
  font-size: 12px;
  font-weight: 600;
}

#profile .register-progress span.active,
#profile .register-progress span.done {
  border-bottom-color: #178cff;
  color: #178cff;
}

.register-phone-row {
  display: grid;
  grid-template-columns: minmax(108px, 0.48fr) minmax(0, 1fr);
  gap: 8px;
}

.document-upload {
  min-height: 74px;
  padding: 12px;
  border: 1px dashed var(--settings-line-strong, var(--mt-line-strong));
  border-radius: 8px;
  display: grid;
  align-items: center;
  gap: 10px;
  background: var(--settings-field);
  color: var(--settings-text);
  text-align: center;
}

.document-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.document-upload span {
  display: grid;
  gap: 5px;
}

.document-upload strong {
  font-size: 15px;
  font-weight: 700;
}

.document-upload small {
  color: var(--settings-muted);
  font-size: 12px;
}

.document-upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.document-upload-action {
  min-height: 34px;
  border: 1px solid var(--settings-line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--mt-surface-2);
  color: var(--settings-text);
  font-size: 13px;
  font-weight: 700;
}

.document-upload-action:has(input:disabled) {
  opacity: 0.55;
  pointer-events: none;
}

.document-upload-action span {
  pointer-events: none;
}

#profile .primary-btn {
  border-radius: 12px;
  background: #178cff;
  color: #fff;
}

#profile .ghost-btn {
  border-color: var(--settings-line);
  border-radius: 8px;
  background: var(--settings-field);
  color: var(--settings-text);
}

#profile .register-actions.is-single {
  grid-template-columns: 1fr;
}

.market-pref-grid,
.theme-control,
.price-color-control,
.avatar-choice-grid {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-control {
  display: none;
}

.market-pref,
.theme-control button,
.price-color-control button,
.avatar-choice-grid button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--mt-line);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--mt-surface-2);
  color: var(--mt-text);
}

.theme-control button.active,
.price-color-control button.active,
.avatar-choice-grid button.active {
  border-color: var(--mt-blue);
  color: var(--mt-blue);
}

.price-color-example {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.price-example-chart,
.price-example-row {
  padding: 12px;
  border-radius: 8px;
  background: var(--mt-surface-2);
}

.price-example-chart-top,
.price-example-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.price-example-kline {
  height: 54px;
  margin-top: 10px;
  display: flex;
  align-items: end;
  gap: 7px;
}

.price-example-candle {
  width: 9px;
  min-height: 18px;
  border-radius: 2px;
  background: currentColor;
}

.price-example-candle.up,
.price-example-row.up strong {
  color: var(--price-up);
}

.price-example-candle.down,
.price-example-row.down strong {
  color: var(--price-down);
}

.avatar-editor {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.note-list {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.profile-list {
  display: grid;
  gap: 8px;
}

.profile-line {
  padding: 0 12px;
}

.toast {
  position: fixed;
  z-index: 220;
  left: 50%;
  bottom: calc(var(--mt-nav-clear) + 10px);
  width: min(360px, calc(100vw - 40px));
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--mt-popover);
  color: var(--mt-text);
  text-align: center;
  font-size: 14px;
  transform: translateX(-50%);
}

.toast.show {
  display: flex;
}

.sheet.open,
.sheet:not([hidden]) {
  position: fixed;
  z-index: 180;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.sheet-card {
  width: min(390px, 100%);
  padding: 16px;
  border-radius: 18px;
  background: var(--mt-popover);
}

.sheet-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.sheet-title h2 {
  margin: 0;
  font-size: 18px;
}

.sheet-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 390px) {
  :root {
    --mt-side-pad: 14px;
    --mt-round-btn: 46px;
    --mt-toolbar-h: 66px;
    --mt-nav-clear: calc(var(--mt-nav-h) + var(--mt-nav-bottom) + 14px);
  }

  .history-topbar {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
  }

  .history-segments {
    width: 198px;
    min-width: 198px;
  }

  .history-segments button {
    font-size: 16px;
  }

  .quote-card-detail .quote-detail-select {
    grid-template-columns: minmax(112px, 1fr) minmax(82px, 0.82fr) minmax(82px, 0.82fr);
    column-gap: 4px;
    padding: 0 12px;
  }

  .terminal-price-lead {
    font-size: 17px;
  }

  .terminal-price-major {
    font-size: 29px;
  }

  .terminal-price sup {
    font-size: 14px;
  }

  .profile-balance-grid,
  .account-grid,
  .risk-grid,
  .info-grid,
  .form-grid,
  .register-grid {
    grid-template-columns: 1fr;
  }

  .register-code-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 430px) and (min-height: 880px) {
  :root {
    --mt-top-offset: calc(var(--mt-safe-top) + 10px);
    --mt-toolbar-h: 64px;
    --mt-round-btn: 46px;
    --mt-nav-bottom: calc(12px + env(safe-area-inset-bottom));
    --mt-nav-clear: calc(var(--mt-nav-h) + var(--mt-nav-bottom) + 12px);
  }

  .quote-card-detail .quote-detail-select {
    min-height: 64px;
    height: 64px;
  }

  .quote-detail-symbol {
    grid-template-rows: 17px 23px 18px;
  }

  .terminal-price-major {
    font-size: 30px;
  }

  .terminal-price-lead {
    font-size: 18px;
  }

  .terminal-price sup {
    font-size: 14px;
  }
}
