/* Financial workspace hierarchy, tuned for desktop and compact mobile screens. */
.workspace:has(.dashboard-page:not([hidden])) {
  width: min(100%, 1680px);
  padding: 20px clamp(16px, 2vw, 32px) 28px;
}

.workspace:has(.dashboard-page:not([hidden])) > .page-heading {
  min-height: 58px;
  margin-bottom: 14px;
}

.workspace:has(.dashboard-page:not([hidden])) .page-heading h1 {
  margin-top: 5px;
  color: #f0f5f1;
  font-size: clamp(23px, 2vw, 28px);
  font-weight: 650;
  letter-spacing: -.04em;
}

.workspace:has(.dashboard-page:not([hidden])) .page-description {
  margin-top: 6px;
  color: #9aa9a1;
  font-size: 11px;
}

.workspace:has(.dashboard-page:not([hidden])) > .runtime-banner {
  min-height: 46px;
  gap: 11px;
  margin-bottom: 14px;
  padding: 0 15px;
  border-color: #294a3b;
  border-radius: 10px;
  background: linear-gradient(105deg, #12241d, #111b1e 72%);
}

.workspace:has(.dashboard-page:not([hidden])) .runtime-banner > strong {
  font-size: 11px;
  font-weight: 700;
}

.workspace:has(.dashboard-page:not([hidden])) .runtime-banner > span:nth-of-type(2) {
  color: #a7b6ae;
  font-size: 10px;
}

.workspace:has(.dashboard-page:not([hidden])) .runtime-state {
  font-size: 9px;
}

.dashboard-page {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.dashboard-page > #overview-balance-panel,
.dashboard-page > .metrics-grid {
  grid-column: 1 / -1;
}

.dashboard-page > #overview-balance-panel {
  margin: 0;
  border-color: #2a3b40;
  border-radius: 12px;
  background: linear-gradient(145deg, #121c20, #0f171b 70%);
  box-shadow: 0 14px 36px rgb(0 0 0 / 15%);
}

.dashboard-page .panel-heading {
  min-height: 56px;
  padding: 10px 16px;
  border-bottom-color: #25353a;
}

.dashboard-page .section-eyebrow {
  color: #94a49b;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .12em;
}

.dashboard-page .panel-heading h2 {
  margin-top: 4px;
  color: #eef4ef;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.dashboard-page .count-tag {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-color: #354b43;
  border-radius: 6px;
  background: #18251f;
  color: #c5e2ad;
  font-size: 9px;
}

.dashboard-page .overview-balance-meta {
  gap: 10px;
}

.dashboard-page .overview-range-control {
  gap: 8px;
  color: #a4b1aa;
  font-size: 10px;
}

.dashboard-page .overview-range-control select {
  min-width: 144px;
  height: 34px;
  padding-left: 10px;
  border-color: #35474b;
  border-radius: 7px;
  background: #0c1518;
  color: #e1eae4;
  font-size: 10px;
}

.dashboard-page .overview-custom-range {
  gap: 9px;
  padding: 10px 16px;
  border-bottom-color: #25353a;
}

.dashboard-page .overview-custom-range label {
  display: grid;
  gap: 4px;
  color: #aab6af;
  font-size: 9px;
}

.dashboard-page .overview-custom-range input {
  height: 33px;
  border-color: #35474b;
  border-radius: 7px;
  background: #0c1518;
  color: #e1eae4;
  font-size: 10px;
}

.dashboard-page .overview-balance-summary {
  min-height: 62px;
  gap: clamp(20px, 4vw, 56px);
  padding: 12px 18px 3px;
}

.dashboard-page .overview-balance-summary > div {
  gap: 5px;
}

.dashboard-page .overview-balance-summary > div > span {
  color: #94a39b;
  font-size: 9px;
}

.dashboard-page .overview-balance-summary strong {
  color: #edf4ef;
  font-size: 15px;
  font-weight: 650;
}

.dashboard-page .overview-period-label {
  color: #a3afa8;
  font-size: 9px;
}

.dashboard-page .overview-balance-legend {
  gap: 18px;
  padding: 8px 18px 0;
  color: #a8b4ad;
  font-size: 9px;
}

.dashboard-page .overview-balance-chart-wrap {
  padding: 3px 16px 13px;
}

.dashboard-page .overview-balance-chart-wrap svg {
  height: 205px;
}

.dashboard-page .overview-balance-axis {
  padding-left: 112px;
  color: #92a098;
  font-size: 9px;
}

.dashboard-page .overview-balance-note {
  margin: 8px 4px 0 112px;
  color: #95a39b;
  font-size: 9px;
}

.dashboard-page .balance-y-label,
.dashboard-page .balance-y-title {
  fill: #97a79e;
  font-size: 10px;
}

.dashboard-page > .metrics-grid {
  gap: 12px;
  margin: 0;
}

.dashboard-page .metric-card {
  position: relative;
  min-height: 88px;
  padding: 13px 15px;
  border-color: #2a3a3e;
  border-radius: 10px;
  background: linear-gradient(145deg, #141e22, #10181b);
  transition: border-color 150ms ease, background 150ms ease;
}

.dashboard-page .metric-card:hover {
  border-color: #3b5148;
  background: linear-gradient(145deg, #172329, #111b1e);
}

.dashboard-page .metric-label {
  color: #a4b1a9;
  font-size: 10px;
  font-weight: 580;
}

.dashboard-page .metric-value {
  color: #f0f5f1;
  font-size: clamp(17px, 1.55vw, 22px);
  font-weight: 620;
}

.dashboard-page .metric-note {
  color: #8b9a91;
  font-size: 9px;
}

.dashboard-page > .mexc-dashboard-panel,
.dashboard-page > .mt5-dashboard-panel {
  min-width: 0;
  margin: 0;
  border-color: #2a3b40;
  border-radius: 12px;
  background: linear-gradient(145deg, #121c20, #0f171b 70%);
  box-shadow: 0 12px 30px rgb(0 0 0 / 12%);
}

.dashboard-page > .mexc-dashboard-panel {
  grid-column: span 7;
}

.dashboard-page > .mt5-dashboard-panel {
  grid-column: span 5;
}

.dashboard-page .mexc-market-columns {
  gap: 11px;
  padding: 12px;
}

.dashboard-page .mexc-market-board {
  padding: 11px;
  border-color: #2a3b40;
  border-radius: 9px;
  background: linear-gradient(145deg, #0e171b, #10191c);
}

.dashboard-page .mexc-market-heading {
  margin-bottom: 9px;
}

.dashboard-page .mexc-market-heading h3 {
  color: #e3ece6;
  font-size: 11px;
  font-weight: 680;
}

.dashboard-page .mexc-market-total {
  color: #c9eaa5;
  font-size: 11px;
}

.dashboard-page .mexc-dashboard-market-cards,
.dashboard-page .mt5-dashboard-list {
  gap: 9px;
}

.dashboard-page .mexc-dashboard-market-card,
.dashboard-page .mt5-dashboard-card {
  gap: 9px;
  padding: 11px;
  border-color: #2a3a3e;
  border-radius: 8px;
  background: #111a1e;
}

.dashboard-page .mexc-market-account-heading > strong,
.dashboard-page .mt5-dashboard-card-heading .account-open-link {
  color: #edf4ef;
  font-size: 11px;
  font-weight: 660;
}

.dashboard-page .mexc-market-account-values,
.dashboard-page .mexc-market-account-analytics,
.dashboard-page .mt5-dashboard-card-values,
.dashboard-page .mt5-dashboard-card-stats {
  gap: 7px;
}

.dashboard-page .mexc-market-account-analytics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-page .mt5-dashboard-card-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-page .mexc-market-account-value,
.dashboard-page .mexc-market-kpi,
.dashboard-page .mt5-dashboard-card-values > div,
.dashboard-page .mt5-dashboard-card-stats > div {
  gap: 4px;
  padding: 8px;
  border-color: #29393d;
  border-radius: 7px;
  background: #0d1518;
}

.dashboard-page .mexc-market-account-value span,
.dashboard-page .mexc-market-kpi span,
.dashboard-page .mt5-dashboard-card-values span,
.dashboard-page .mt5-dashboard-card-stats span {
  color: #9baaa1;
  font-size: 8px;
}

.dashboard-page .mexc-market-account-value strong,
.dashboard-page .mexc-market-kpi strong,
.dashboard-page .mt5-dashboard-card-values strong,
.dashboard-page .mt5-dashboard-card-stats strong {
  color: #e7efe9;
  font-size: 10px;
  font-weight: 630;
}

.dashboard-page .mexc-market-kpi strong.positive,
.dashboard-page .mt5-dashboard-card-stats strong.positive {
  color: #75dda0;
}

.dashboard-page .mexc-market-kpi strong.negative,
.dashboard-page .mt5-dashboard-card-stats strong.negative {
  color: #f28e91;
}

.dashboard-page .mexc-market-footnote,
.dashboard-page .mexc-dashboard-note,
.dashboard-page .mt5-dashboard-card-footnote {
  color: #96a49c;
  font-size: 8px;
  line-height: 1.55;
}

.dashboard-page .mexc-dashboard-note {
  margin: 0;
  padding: 0 13px 12px;
}

.dashboard-page .mt5-dashboard-list {
  grid-template-columns: 1fr;
  padding: 12px;
}

.dashboard-page .mt5-dashboard-card-meta {
  color: #9baaa1;
  font-size: 9px;
  line-height: 1.5;
}

.dashboard-page .status-pill {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 9px;
}

.dashboard-page .panel-link {
  color: #c0df9b;
  font-size: 10px;
}

.dashboard-page .mexc-empty-state {
  border-color: #35474b;
  border-radius: 8px;
  color: #a0aea6;
  font-size: 10px;
}

@media (max-width: 1180px) {
  .dashboard-page > .mexc-dashboard-panel,
  .dashboard-page > .mt5-dashboard-panel {
    grid-column: 1 / -1;
  }

  .dashboard-page .mt5-dashboard-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page .mt5-dashboard-list {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace:has(.dashboard-page:not([hidden])) {
    padding: 14px 12px 22px;
  }

  .workspace:has(.dashboard-page:not([hidden])) > .page-heading {
    min-height: 50px;
    margin-bottom: 11px;
  }

  .workspace:has(.dashboard-page:not([hidden])) .page-heading h1 {
    font-size: 22px;
  }

  .workspace:has(.dashboard-page:not([hidden])) > .runtime-banner {
    min-height: 44px;
    gap: 8px;
    margin-bottom: 11px;
    padding: 0 10px;
  }

  .dashboard-page {
    gap: 11px;
  }

  .dashboard-page .panel-heading {
    min-height: 50px;
    gap: 8px;
    padding: 9px 11px;
  }

  .dashboard-page .mt5-dashboard-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page .panel-heading h2 {
    font-size: 12px;
  }

  .dashboard-page .overview-balance-meta {
    gap: 6px;
  }

  .dashboard-page #overview-balance-account,
  .dashboard-page .overview-range-control > span {
    display: none;
  }

  .dashboard-page .overview-range-control select {
    min-width: 122px;
    height: 34px;
  }

  .dashboard-page .overview-balance-summary {
    min-height: 56px;
    gap: 9px 14px;
    padding: 10px 11px 2px;
  }

  .dashboard-page .overview-balance-summary > div > span {
    font-size: 8px;
  }

  .dashboard-page .overview-balance-summary strong {
    max-width: 36vw;
    font-size: 11px;
  }

  .dashboard-page .overview-period-label {
    display: none;
  }

  .dashboard-page .overview-balance-legend {
    padding: 7px 11px 0;
  }

  .dashboard-page .overview-balance-chart-wrap {
    padding: 1px 7px 11px;
  }

  .dashboard-page .overview-balance-chart-wrap svg {
    height: 165px;
  }

  .dashboard-page .overview-balance-axis {
    padding-left: 76px;
    font-size: 8px;
  }

  .dashboard-page .overview-balance-note {
    margin-left: 76px;
    font-size: 8px;
  }

  .dashboard-page .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-page .metric-card {
    min-height: 76px;
    gap: 2px 5px;
    padding: 9px;
  }

  .dashboard-page .metric-label {
    font-size: 9px;
  }

  .dashboard-page .metric-value {
    font-size: 15px;
  }

  .dashboard-page .metric-note {
    font-size: 8px;
  }

  .dashboard-page .mexc-market-columns {
    grid-template-columns: 1fr;
    padding: 9px;
  }

  .dashboard-page .mt5-dashboard-list {
    grid-template-columns: 1fr;
    padding: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-page .metric-card {
    transition: none;
  }
}

/* Keep the selected trading account visible across every workspace page. */
.topbar { gap: clamp(8px, 1vw, 15px); }
.topbar-account-switcher {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(145px, 230px) auto;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.topbar-account-switcher > label {
  color: #83a091;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .08em;
  white-space: nowrap;
}
.topbar-account-switcher > select {
  width: 100%;
  min-width: 0;
  height: 33px;
  padding: 0 9px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #0a140f;
  color: #e1eee6;
  font-size: 9px;
}
.topbar-account-switcher > select:focus-visible {
  border-color: #8eb95b;
  outline: 2px solid rgb(173 221 106 / 12%);
  outline-offset: 1px;
}
.topbar-account-state {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.topbar-account-state-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d6aa57;
}
.topbar-account-state small {
  overflow: hidden;
  max-width: 150px;
  color: #a8b9ae;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-account-switcher[data-status="connected"] .topbar-account-state-dot { background: #65d99a; box-shadow: 0 0 0 3px rgb(99 217 154 / 10%); }
.topbar-account-switcher[data-status="failed"] .topbar-account-state-dot,
.topbar-account-switcher[data-status="error"] .topbar-account-state-dot,
.topbar-account-switcher[data-status="disconnected"] .topbar-account-state-dot,
.topbar-account-switcher[data-status="stopped"] .topbar-account-state-dot { background: #ed827b; }
.topbar-account-switcher[data-status="empty"] .topbar-account-state-dot { background: #77847c; }
.topbar-actions { margin-left: 0; }

@media (max-width: 820px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "breadcrumb actions" "account account";
    gap: 6px 8px;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .topbar > .breadcrumb { grid-area: breadcrumb; min-width: 0; }
  .topbar > .topbar-actions { grid-area: actions; margin-left: 0; }
  .topbar-account-switcher {
    width: 100%;
    grid-area: account;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    margin: 0;
  }
  .topbar-account-state small { max-width: 140px; }
}

@media (max-width: 600px) {
  .topbar {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "breadcrumb actions" "account account";
    gap: 5px 8px;
    padding: 7px 10px;
  }
  .topbar-account-switcher { grid-template-columns: auto minmax(0, 1fr) minmax(75px, auto); }
  .topbar-account-switcher > label { display: block; font-size: 7px; letter-spacing: .04em; }
  .topbar-account-switcher > select { height: 32px; padding: 0 7px; font-size: 9px; }
  .topbar-account-state { gap: 5px; }
  .topbar-account-state small { max-width: 100px; font-size: 8px; }
}
