:root {
  color-scheme: dark;
  --bg: #0b0e11;
  --panel: #181a20;
  --panel-2: #1e2329;
  --panel-3: #111418;
  --line: #2b3139;
  --line-soft: rgba(43, 49, 57, 0.62);
  --text: #eaecef;
  --muted: #848e9c;
  --soft: #5e6673;
  --yellow: #f0b90b;
  --green: #0ecb81;
  --red: #f6465d;
  --blue: #2b66ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans TC", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
}

body.embed-mode {
  background: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.ex-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 14px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 17, 0.93);
  backdrop-filter: blur(18px);
}

.ex-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 850;
}

.ex-brand span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--yellow);
  color: #0b0e11;
  font-size: 11px;
  font-weight: 950;
}

.ex-nav nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ex-nav nav a {
  border: 1px solid var(--line);
  padding: 7px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ex-nav nav a.active,
.ex-nav nav a:hover {
  border-color: rgba(240, 185, 11, 0.48);
  color: var(--yellow);
}

body.embed-mode .ex-nav {
  display: none;
}

.ex-app {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 1.6vw, 28px) 42px;
}

body.embed-mode .ex-app {
  width: 100%;
  padding: 0;
}

.page {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.panel,
.lead-card,
.stat-card,
.account-card,
.table-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.lead-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(520px, 0.9fr);
  gap: 22px;
  padding: 22px;
}

.lead-profile {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 54px;
  height: 54px;
  background: var(--yellow);
  color: #0b0e11;
  font-size: 20px;
  font-weight: 950;
}

.lead-profile h1 {
  margin: 0 0 7px;
  font-size: clamp(26px, 3.4vw, 46px);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.lead-profile p,
.muted,
.panel-head small,
.source-note,
.trade-row span,
.daily-row span,
.account-card p {
  color: var(--muted);
  font-size: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.account-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.account-switch button,
.share-observatory-button {
  border: 1px solid var(--line);
  background: #0b0e11;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.account-switch button {
  display: grid;
  gap: 3px;
  min-width: 126px;
  padding: 9px 11px;
}

.account-switch button.active {
  border-color: rgba(240, 185, 11, 0.8);
  background: rgba(240, 185, 11, 0.1);
}

.account-switch button:hover,
.share-observatory-button:hover {
  border-color: rgba(240, 185, 11, 0.55);
}

.account-switch span {
  font-weight: 850;
}

.account-switch small {
  color: var(--muted);
  font-size: 11px;
}

.account-switch.compact {
  justify-content: flex-end;
  margin-top: 8px;
}

.account-switch.compact button {
  min-width: 92px;
  padding: 7px 9px;
}

.account-card-switch {
  margin-top: 0;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.share-observatory-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--yellow);
  font-weight: 850;
}

.share-row span {
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tag.hot {
  border-color: rgba(240, 185, 11, 0.44);
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
}

.lead-stats,
.account-grid,
.metric-grid,
.mini-grid {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.lead-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lead-stats div,
.metric-grid div,
.mini-grid div {
  min-width: 0;
  padding: 13px;
  background: var(--panel-3);
}

.lead-stats span,
.metric-grid span,
.mini-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.lead-stats strong,
.metric-grid strong,
.mini-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 21px;
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: keep-all;
}

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

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

.yellow {
  color: var(--yellow) !important;
}

.blue {
  color: #74a6ff !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.42fr);
  grid-template-areas:
    "curve stats"
    "positions sources";
  gap: 14px;
  align-items: stretch;
}

.curve-panel {
  grid-area: curve;
}

.stat-panel {
  grid-area: stats;
}

.positions-panel {
  grid-area: positions;
}

.source-panel {
  grid-area: sources;
}

.dashboard-grid > .panel,
.dashboard-grid > .stat-card,
.dashboard-grid > .table-card {
  height: 100%;
}

.account-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 0;
  background: transparent;
}

.selected-account-grid {
  grid-template-columns: minmax(0, 1fr);
}

.account-card {
  display: grid;
  gap: 15px;
  padding: 17px;
}

.account-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-head h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.platform-pill {
  flex: 0 0 auto;
  background: rgba(240, 185, 11, 0.13);
  color: var(--yellow);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.curve-actions {
  display: grid;
  justify-items: end;
  min-width: 220px;
}

.dashboard-grid .panel-head {
  min-height: 64px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.18;
}

.daily-panel-head {
  align-items: stretch;
}

.daily-title-button,
.daily-account-button,
.daily-account-option {
  border: 0;
  font: inherit;
  text-align: left;
}

.daily-title-button {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.daily-title-button span {
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.18;
}

.daily-title-button:hover span,
.daily-account-button:hover strong {
  color: var(--yellow);
}

.daily-account-control {
  display: flex;
  justify-content: flex-end;
  min-width: 220px;
}

.daily-account-button {
  display: grid;
  grid-template-columns: auto auto;
  align-content: center;
  gap: 2px 9px;
  min-width: 190px;
  border: 1px solid var(--line);
  padding: 7px 9px;
  background: var(--panel-3);
  color: var(--muted);
  cursor: pointer;
}

.daily-account-button span,
.daily-account-button i {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.daily-account-button strong {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 13px;
  line-height: 1.16;
  white-space: nowrap;
}

.daily-account-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 17, 0.42);
}

.daily-account-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line-soft);
  padding: 10px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
}

.daily-account-option.active {
  border-color: rgba(240, 185, 11, 0.66);
  background: rgba(240, 185, 11, 0.09);
}

.daily-account-option:hover {
  border-color: rgba(240, 185, 11, 0.44);
}

.daily-account-option span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.daily-account-option b,
.daily-account-option em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-account-option b {
  font-size: 13px;
}

.daily-account-option em,
.daily-account-option small {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.daily-account-option strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.daily-account-option small {
  grid-column: 1 / -1;
}

.chart-wrap {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.curve-panel .chart-wrap {
  min-height: 0;
}

.chart-box {
  position: relative;
  height: 360px;
  min-height: 360px;
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(circle at 74% 16%, rgba(14, 203, 129, 0.1), transparent 23%),
    linear-gradient(135deg, rgba(240, 185, 11, 0.06), transparent 38%),
    #0b0e11;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-plot-bg {
  fill: rgba(24, 26, 32, 0.36);
  stroke: rgba(43, 49, 57, 0.45);
}

.grid-line {
  stroke: rgba(94, 102, 115, 0.26);
  stroke-dasharray: 4 5;
}

.zero-line {
  stroke: rgba(240, 185, 11, 0.34);
  stroke-width: 1.1;
}

.bar-zero-line {
  stroke: rgba(132, 142, 156, 0.32);
  stroke-dasharray: 5 5;
}

.axis-label {
  fill: var(--soft);
  font-size: 12px;
  text-anchor: middle;
}

.axis-value,
.chart-band-label {
  fill: var(--soft);
  font-size: 11px;
}

.axis-value {
  text-anchor: end;
}

.chart-band-label {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pnl-line {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#lineGlow);
}

.pnl-area {
  fill: url(#pnlAreaGradient);
}

.pnl-bar {
  opacity: 0.82;
}

.positive-bar {
  fill: var(--green);
}

.negative-bar {
  fill: var(--red);
}

.pnl-dot {
  fill: var(--green);
  stroke: #0b0e11;
  stroke-width: 1.4;
}

.peak-dot {
  fill: var(--yellow);
  stroke: #0b0e11;
  stroke-width: 1.6;
}

.trough-dot {
  fill: var(--red);
  stroke: #0b0e11;
  stroke-width: 1.6;
}

.latest-marker line {
  stroke: rgba(240, 185, 11, 0.36);
  stroke-dasharray: 4 4;
}

.latest-marker circle {
  fill: var(--yellow);
  stroke: #0b0e11;
  stroke-width: 2;
}

.latest-marker rect {
  fill: rgba(11, 14, 17, 0.92);
  stroke: rgba(240, 185, 11, 0.54);
}

.latest-marker text {
  fill: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.curve-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.curve-data-item {
  min-width: 0;
  padding: 10px 12px;
  background:
    linear-gradient(135deg, rgba(240, 185, 11, 0.045), transparent 56%),
    var(--panel-3);
}

.curve-data-item span,
.curve-data-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.curve-data-item strong {
  display: block;
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.side-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.stat-card {
  display: grid;
  grid-auto-rows: minmax(0, 1fr);
  gap: 1px;
  background: var(--line-soft);
}

.stat-line {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) minmax(0, auto);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  padding: 12px 15px;
  background: var(--panel);
}

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

.stat-line strong {
  font-size: 15px;
  text-align: right;
  white-space: nowrap;
}

.trade-list,
.daily-list,
.source-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.trade-row,
.daily-row {
  display: grid;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: var(--panel-3);
}

.trade-row {
  grid-template-columns:
    minmax(180px, 1.15fr)
    minmax(76px, 0.62fr)
    minmax(78px, 0.62fr)
    minmax(104px, 0.78fr)
    minmax(136px, 0.94fr)
    minmax(104px, 0.78fr)
    minmax(78px, 0.62fr)
    minmax(148px, 1fr)
    minmax(94px, 0.72fr);
}

.trade-row > div,
.daily-row > div {
  min-width: 0;
  padding: 11px 12px;
}

.trade-row strong,
.daily-row strong {
  display: block;
  color: var(--text);
  line-height: 1.14;
  overflow-wrap: normal;
  word-break: keep-all;
}

.number-value,
.money-value,
.symbol-value,
.time-value {
  white-space: nowrap;
}

.money-value,
.number-value {
  font-variant-numeric: tabular-nums;
}

.muted-value {
  color: var(--muted) !important;
}

.trade-row span,
.daily-row span {
  display: block;
  margin-bottom: 4px;
}

.side {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 900;
}

.side.long {
  background: rgba(14, 203, 129, 0.14);
  color: var(--green);
}

.side.short {
  background: rgba(246, 70, 93, 0.14);
  color: var(--red);
}

.side.summary {
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
}

.daily-row {
  grid-template-columns: minmax(150px, 1.05fr) repeat(6, minmax(96px, 1fr));
}

.source-list p {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--yellow);
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 1220px) {
  .lead-card,
  .dashboard-grid,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-areas:
      "curve"
      "stats"
      "positions"
      "sources";
  }

  .stat-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .lead-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-box {
    height: 330px;
    min-height: 330px;
  }

  .curve-data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    grid-template-columns: 1fr;
  }

  .daily-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-list {
    display: grid;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    max-width: 100%;
  }

  .trade-row {
    width: max-content;
    min-width: 1100px;
    grid-template-columns: 170px 76px 78px 104px 136px 104px 78px 148px 94px;
  }

  .daily-list {
    display: grid;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    max-width: 100%;
  }

  .daily-row {
    width: max-content;
    min-width: 980px;
    grid-template-columns: 154px 96px 124px 96px 172px 122px 198px;
  }

  .daily-row > div {
    overflow: hidden;
    padding: 10px 12px;
  }

  .daily-row strong {
    font-size: 17px;
  }
}

@media (max-width: 620px) {
  .ex-nav {
    align-items: center;
    flex-direction: row;
    padding: 12px 14px;
  }

  .ex-nav nav {
    width: auto;
    overflow: visible;
    padding-bottom: 0;
  }

  .ex-nav nav a {
    flex: 0 0 auto;
  }

  .ex-app {
    max-width: 100vw;
    padding: 12px 10px 30px;
  }

  .page,
  .lead-card,
  .account-card,
  .panel,
  .stat-card,
  .table-card {
    max-width: 100%;
  }

  .lead-card {
    gap: 14px;
    padding: 14px;
    grid-template-columns: minmax(0, 1fr);
  }

  .lead-profile {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
  }

  .lead-profile > div {
    min-width: 0;
  }

  .avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .lead-profile h1 {
    font-size: 24px;
    line-height: 1.1;
    overflow-wrap: anywhere;
    word-break: break-all;
    white-space: normal;
  }

  .lead-profile p {
    overflow-wrap: anywhere;
  }

  .tag-row {
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
  }

  .tag {
    max-width: 100%;
    min-height: 24px;
    padding: 3px 7px;
    font-size: 11px;
    white-space: normal;
  }

  .lead-stats,
  .metric-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .stat-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: start;
  }

  .stat-line strong {
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .trade-list,
  .daily-list {
    display: grid;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    max-width: 100%;
  }

  .trade-row {
    width: max-content;
    min-width: 1100px;
    grid-template-columns: 170px 76px 78px 104px 136px 104px 78px 148px 94px;
  }

  .trade-row > div {
    overflow: hidden;
    padding: 10px 12px;
  }

  .trade-row strong {
    font-size: 16px;
  }

  .daily-row {
    width: max-content;
    min-width: 980px;
    grid-template-columns: 154px 96px 124px 96px 172px 122px 198px;
  }

  .daily-row > div {
    overflow: hidden;
    padding: 10px 12px;
  }

  .daily-row strong {
    font-size: 17px;
  }

  .panel-head,
  .account-head {
    display: grid;
  }

  .lead-stats strong,
  .metric-grid strong,
  .mini-grid strong {
    font-size: 20px;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .daily-account-control,
  .daily-account-button {
    width: 100%;
    min-width: 0;
  }

  .daily-account-button strong {
    white-space: normal;
  }

  .daily-account-picker {
    grid-template-columns: 1fr;
  }

  .curve-actions {
    justify-items: stretch;
    min-width: 0;
  }

  .account-switch.compact {
    justify-content: flex-start;
  }

  .chart-wrap,
  .trade-list,
  .daily-list,
  .source-list {
    padding: 10px;
  }

  .chart-box {
    height: 310px;
    min-height: 310px;
  }

  .axis-label,
  .axis-value,
  .chart-band-label {
    font-size: 10px;
  }

  .latest-marker text {
    font-size: 12px;
  }

  .curve-data-item {
    padding: 9px 10px;
  }

  .curve-data-item strong {
    font-size: 15px;
  }
}
