:root {
  --bg: #070b0e;
  --surface: #10161b;
  --surface-2: #0c1217;
  --surface-3: #151d23;
  --line: rgba(133, 154, 169, 0.18);
  --line-strong: rgba(32, 245, 203, 0.32);
  --text: #eaf2ef;
  --soft: #a6b3bc;
  --muted: #687680;
  --accent: #20f5cb;
  --green: #27d89a;
  --amber: #f2b84b;
  --red: #ee4d5f;
  --blue: #50a7ff;
  --nav: #080d11;
  --shadow: rgba(0, 0, 0, 0.38);
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 980px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 18% -6%, rgba(32, 245, 203, 0.13), transparent 31rem),
    radial-gradient(circle at 92% 4%, rgba(80, 167, 255, 0.1), transparent 28rem),
    var(--bg);
  background-size: 38px 38px, 38px 38px, auto, auto, auto;
  color: var(--text);
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 94px 1fr;
  grid-template-rows: 70px 1fr;
  width: 100vw;
  height: 100vh;
}

.side-nav {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 7px;
  border-right: 1px solid var(--line);
  background: rgba(7, 11, 14, 0.94);
}

.nav-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 7px;
  border-radius: 5px;
  color: var(--soft);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item span {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(32, 245, 203, 0.08);
  color: var(--accent);
}

.nav-plan {
  margin-top: auto;
  padding: 10px 7px;
  color: var(--accent);
  font-size: 12px;
}

.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 17, 0.92);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  animation: drop-in 420ms ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 36%, rgba(32, 245, 203, 0.16) 38%, transparent 42%),
    conic-gradient(from 0deg, var(--accent), transparent 18%, var(--accent));
  box-shadow: 0 0 20px rgba(32, 245, 203, 0.25);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 5px 0 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.major-ticker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: 1 1 auto;
  min-width: 360px;
  max-width: 720px;
}

.major-card {
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(13, 18, 23, 0.72);
}

.major-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.major-card strong {
  display: block;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.15;
}

.major-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.major-card em.positive {
  color: var(--accent);
}

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

.status-grid {
  display: grid;
  grid-template-columns: 142px 190px 118px 138px 118px 104px;
  align-items: center;
  gap: 8px;
  max-width: 980px;
  flex: 0 0 auto;
}

.status-cell {
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(13, 18, 23, 0.72);
}

.status-cell span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.status-cell strong {
  color: var(--soft);
  font-size: 12px;
}

.heat-cell i {
  display: block;
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(39, 216, 154, 0.35), rgba(242, 184, 75, 0.35), rgba(238, 77, 95, 0.35));
}

.heat-cell b {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #f3d44e, var(--red));
  transition: width 420ms ease;
}

#refreshButton {
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(32, 245, 203, 0.08);
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
  transition: background 160ms ease, transform 160ms ease;
}

#refreshButton:hover {
  background: rgba(32, 245, 203, 0.15);
  transform: translateY(-1px);
}

#refreshButton:disabled {
  cursor: wait;
  opacity: 0.55;
}

.page-view {
  grid-column: 2;
  grid-row: 2;
  display: none;
  min-height: 0;
}

.page-view.active {
  display: grid;
}

.dashboard {
  grid-column: 2;
  grid-template-columns: 1.08fr 0.68fr 0.68fr;
  grid-template-rows: minmax(300px, 0.56fr) minmax(280px, 0.44fr);
  gap: 9px;
  padding: 9px;
  overflow: hidden;
}

.positions-page {
  grid-column: 2;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  gap: 9px;
  padding: 9px;
  overflow: hidden;
  transition: padding-right 220ms ease;
}

body.chart-drawer-open .positions-page {
  padding-left: 0;
  padding-right: 0;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(17, 24, 30, 0.96), rgba(10, 16, 20, 0.96));
  box-shadow: 0 18px 56px var(--shadow);
}

.opportunities-panel {
  grid-column: 1 / 3;
  display: flex;
  flex-direction: column;
  animation: rise-in 460ms ease 60ms both;
}

.insight-panel {
  grid-column: 3;
  grid-row: 1;
  overflow: hidden;
  padding: 14px;
  animation: rise-in 520ms ease 100ms both;
}

.radar-panel {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  padding: 12px;
  animation: rise-in 560ms ease 140ms both;
}

.detail-panel {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px;
  animation: rise-in 600ms ease 160ms both;
}

.logs-panel {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  animation: rise-in 640ms ease 180ms both;
}

.panel-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title.compact {
  min-height: 42px;
  padding: 0 0 12px;
  border-bottom: 0;
}

.panel-title h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.panel-title p,
.panel-title span,
.table-note,
.table-footer a,
.copy-block p,
.insight-footer span,
.detail-grid span,
.chart-heading span,
.log-table {
  color: var(--muted);
  font-size: 12px;
}

.panel-title p {
  margin: 5px 0 0;
}

.table-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(133, 154, 169, 0.12);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

td {
  color: var(--soft);
  font-size: 12px;
}

tbody tr {
  cursor: pointer;
  transition: background 150ms ease, box-shadow 150ms ease;
}

tbody tr:hover,
tbody tr.active {
  background: rgba(32, 245, 203, 0.08);
}

tbody tr.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.empty-row td {
  height: 130px;
  color: var(--muted);
  cursor: default;
  text-align: center;
}

.rank {
  color: var(--muted);
}

.symbol-main {
  display: inline-block;
  color: var(--text);
  font-weight: 800;
}

.symbol-sub {
  display: none;
  margin-top: 0;
  color: var(--muted);
  font-size: 10px;
}

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

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

.watch-text {
  color: var(--amber);
}

.score-badge,
.decision-pill,
.table-decision {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 24px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.score-badge {
  border: 1px solid rgba(32, 245, 203, 0.36);
  color: var(--accent);
}

.decision-pill.long,
.table-decision.long {
  background: rgba(39, 216, 154, 0.18);
  color: var(--green);
}

.decision-pill.short,
.table-decision.short {
  background: rgba(238, 77, 95, 0.2);
  color: var(--red);
}

.decision-pill.watch,
.table-decision.watch {
  background: rgba(242, 184, 75, 0.18);
  color: var(--amber);
}

.table-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding: 8px 14px;
  border-top: 1px solid rgba(133, 154, 169, 0.12);
}

.table-note {
  margin: 0;
}

.table-footer a {
  flex: 0 0 auto;
  color: var(--accent);
  text-decoration: none;
}

.chart-trigger {
  width: 28px;
  height: 24px;
  border: 1px solid rgba(80, 167, 255, 0.28);
  border-radius: 4px;
  background: rgba(80, 167, 255, 0.08);
  color: #9cd0ff;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.chart-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(32, 245, 203, 0.45);
  background: rgba(32, 245, 203, 0.1);
  color: var(--accent);
}

.insight-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 12px;
}

.insight-strategy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.insight-summary div,
.insight-strategy div,
.insight-footer,
.detail-grid div,
.pool-stats div {
  border: 1px solid rgba(133, 154, 169, 0.13);
  background: rgba(8, 13, 17, 0.42);
}

.insight-summary div {
  padding: 8px;
}

.insight-strategy div {
  padding: 8px;
}

.insight-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.insight-strategy span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.insight-summary strong {
  font-size: 20px;
  letter-spacing: -0.04em;
}

.insight-strategy strong {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.2;
}

.tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
  align-content: flex-start;
  overflow: visible;
}

.tag-stack span {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(32, 245, 203, 0.25);
  border-radius: 4px;
  background: rgba(32, 245, 203, 0.06);
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.tag-stack span.keyword {
  border-color: rgba(80, 167, 255, 0.28);
  background: rgba(80, 167, 255, 0.08);
  color: #9cd0ff;
}

.tag-stack span.keyword b {
  color: #9cd0ff;
}

.tag-stack b {
  color: var(--accent);
  font-weight: 800;
}

.tag-stack em {
  color: var(--soft);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-stack .badge {
  display: inline-flex !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  margin: 0 6px 6px 0 !important;
  color: #ffffff !important;
  background: #334155;
  height: 24px !important;
  align-items: center !important;
  border: none !important;
  width: auto !important;
  max-width: 100% !important;
  min-height: 24px !important;
  white-space: nowrap !important;
}

.tag-stack .badge b {
  color: inherit !important;
  font-weight: 700;
}

.tag-stack .logic-badge {
  background: linear-gradient(135deg, #0f766e, #115e59) !important;
}

.tag-stack .coin-tag {
  background: linear-gradient(135deg, #334155, #1e293b) !important;
}

.tag-stack .tag-radar {
  background: linear-gradient(135deg, #ef4444, #991b1b) !important;
  animation: radar-pulse 2s infinite;
}

.tag-stack .tag-kol {
  background: linear-gradient(135deg, #8b5cf6, #5b21b6) !important;
}

.tag-stack .tag-bsb {
  background: linear-gradient(135deg, #f59e0b, #b45309) !important;
}

.tag-stack .tag-smart {
  background: linear-gradient(135deg, #3b82f6, #1e40af) !important;
}

.tag-stack .tag-bullish {
  background: linear-gradient(135deg, #10b981, #047857) !important;
}

.tag-stack .tag-neutral {
  background: linear-gradient(135deg, #64748b, #475569) !important;
}

.tag-stack .tag-mom {
  background: linear-gradient(135deg, #06b6d4, #0e7490) !important;
}

.tag-stack .tag-fomo {
  background: linear-gradient(135deg, #f97316, #c2410c) !important;
}

.tag-stack .tag-fallback {
  background: linear-gradient(135deg, #94a3b8, #64748b) !important;
}

.keyword-cloud {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(80, 167, 255, 0.22);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(80, 167, 255, 0.08), rgba(32, 245, 203, 0.06));
}

.keyword-cloud strong {
  color: var(--blue);
  font-size: 12px;
}

.keyword-cloud div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-cloud i {
  padding: 4px 7px;
  border: 1px solid rgba(80, 167, 255, 0.26);
  border-radius: 999px;
  background: rgba(80, 167, 255, 0.08);
  color: #9cd0ff;
  font-size: 11px;
  font-style: normal;
  line-height: 1;
}

.copy-block {
  padding: 10px 0;
  border-top: 1px solid rgba(133, 154, 169, 0.14);
}

.copy-block h3 {
  margin: 0 0 7px;
  font-size: 14px;
}

.copy-block p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.copy-block.warning p {
  color: #dec78b;
  -webkit-line-clamp: 2;
}

.insight-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
}

.insight-footer strong {
  color: var(--soft);
  font-size: 12px;
  white-space: nowrap;
}

.insight-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  min-width: 148px;
  padding: 6px 8px;
  border: 1px solid rgba(133, 154, 169, 0.16);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.45);
}

.insight-head-meta span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.insight-head-meta strong {
  color: var(--soft);
  font-size: 12px;
  line-height: 1.1;
}

.log-head {
  display: grid;
  grid-template-columns: 78px 54px 1fr 68px;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid rgba(133, 154, 169, 0.12);
  border-bottom: 1px solid rgba(133, 154, 169, 0.12);
}

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

select {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--soft);
  font-size: 12px;
}

.line-chart,
.mini-chart {
  width: 100%;
  height: 132px;
  margin-top: 6px;
  overflow: visible;
}

.mini-chart {
  height: 86px;
}

.detail-panel .mini-chart {
  height: 36px;
  margin-top: 2px;
}

.chart-grid {
  stroke: rgba(133, 154, 169, 0.11);
  stroke-width: 1;
}

.chart-area {
  fill: rgba(32, 245, 203, 0.14);
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.blue .chart-area {
  fill: rgba(80, 167, 255, 0.13);
}

.blue .chart-line {
  stroke: var(--blue);
}

.pool-stats,
.detail-grid {
  display: grid;
  gap: 8px;
}

.pool-stats {
  grid-template-columns: repeat(2, 1fr);
}

.detail-grid {
  flex: 1 1 auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: 0;
  gap: 4px;
}

.pool-stats div {
  padding: 12px;
}

.pool-stats span,
.detail-grid span {
  display: block;
  margin-bottom: 3px;
}

.pool-stats strong {
  color: var(--accent);
  font-size: 28px;
  letter-spacing: -0.06em;
}

.pool-stats p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.pool-stats div:nth-child(2) strong {
  color: var(--red);
}

.mini-chart-wrap {
  margin-top: 2px;
}

.detail-panel .mini-chart-wrap {
  flex: 0 0 auto;
  margin-top: 2px;
}

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

.chart-heading strong {
  min-width: 42px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(32, 245, 203, 0.14);
  color: var(--accent);
  font-size: 12px;
  text-align: center;
}

.detail-grid div {
  min-height: 24px;
  padding: 3px 5px;
}

.detail-grid strong {
  color: var(--soft);
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
}

.detail-panel .chart-heading {
  margin-top: 0;
}

.detail-panel .panel-title.compact {
  min-height: 34px;
  padding: 0 0 8px;
}

.detail-panel .detail-grid span {
  margin-bottom: 4px;
}

.chart-label {
  fill: var(--muted);
  font-size: 10px;
}

.chart-badge {
  fill: rgba(32, 245, 203, 0.18);
  stroke: rgba(32, 245, 203, 0.5);
  stroke-width: 1;
}

.chart-badge-text {
  fill: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.chart-point {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2;
}

.radar-grid {
  fill: none;
  stroke: rgba(133, 154, 169, 0.17);
  stroke-width: 1;
}

.radar-axis {
  stroke: rgba(133, 154, 169, 0.14);
  stroke-width: 1;
}

.radar-area {
  fill: rgba(32, 245, 203, 0.22);
  stroke: var(--accent);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 10px rgba(32, 245, 203, 0.24));
}

.radar-point {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2;
}

.radar-label {
  fill: var(--soft);
  font-size: 11px;
  font-weight: 700;
}

.radar-center {
  fill: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.radar-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.radar-metrics div {
  padding: 8px 10px;
  border: 1px solid rgba(133, 154, 169, 0.13);
  background: rgba(8, 13, 17, 0.42);
  border-radius: 4px;
}

.radar-metrics span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.radar-metrics strong {
  color: var(--accent);
  font-size: 14px;
  line-height: 1.15;
}

.blue .chart-badge {
  fill: rgba(80, 167, 255, 0.18);
  stroke: rgba(80, 167, 255, 0.55);
}

.blue .chart-badge-text,
.blue .chart-point {
  fill: var(--blue);
}

#detailScore {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-table {
  display: grid;
  gap: 0;
  height: calc(100% - 76px);
  overflow: auto;
}

.log-row {
  display: grid;
  grid-template-columns: 78px 54px 1fr 68px;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid rgba(133, 154, 169, 0.1);
}

.log-row strong {
  color: var(--soft);
  font-size: 11px;
}

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

.log-row b {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes radar-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@media (max-width: 1180px) {
  body {
    min-width: 0;
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
  }

  .side-nav {
    display: none;
  }

  .top-bar,
  .major-ticker,
  .status-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard,
  .positions-page {
    grid-template-columns: 1fr;
  }

  .top-bar {
    gap: 12px;
    padding: 12px;
  }

  .major-ticker {
    min-width: 0;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard,
  .positions-page,
  .opportunities-panel,
  .insight-panel,
  .radar-panel,
  .detail-panel,
  .logs-panel {
    grid-column: auto;
    grid-row: auto;
  }
}


/* --- 情报标签视觉增强 (By Gemini) --- */
.tag-stack .badge {
  display: inline-flex !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  font-size: 11px !important;
  margin: 0 6px 6px 0 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border: none !important;
  background: #334155;
  min-height: auto !important;
  height: 24px !important;
  align-items: center !important;
}

.tag-stack .logic-badge { background: #475569 !important; }
.tag-stack .coin-tag { background: rgba(80, 167, 255, 0.2) !important; color: #9cd0ff !important; border: 1px solid rgba(80, 167, 255, 0.3) !important; }

/* 核心情报变色 */
.tag-stack .tag-radar { 
  background: linear-gradient(135deg, #ef4444, #991b1b) !important; 
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4) !important;
  animation: radar-pulse 2s infinite !important; 
}
.tag-stack .tag-kol { background: linear-gradient(135deg, #8b5cf6, #5b21b6) !important; }
.tag-stack .tag-smart { background: linear-gradient(135deg, #3b82f6, #1e40af) !important; }
.tag-stack .tag-bsb { background: linear-gradient(135deg, #f59e0b, #9a3412) !important; }
.tag-stack .tag-bullish { background: linear-gradient(135deg, #10b981, #065f46) !important; }
.tag-stack .tag-neutral { background: #64748b !important; color: #f1f5f9 !important; }
.tag-stack .tag-fomo { background: linear-gradient(135deg, #f43f5e, #9f1239) !important; }
.tag-stack .tag-mom { background: linear-gradient(135deg, #06b6d4, #155e75) !important; }
.tag-stack .tag-fallback { background: #475569 !important; opacity: 0.7 !important; }

@keyframes radar-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* 2026-04-27 layout update: dashboard split + standalone positions page */
.holdings-page-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  animation: rise-in 560ms ease 120ms both;
  transition: margin-right 220ms ease;
}

body.chart-drawer-open .holdings-page-panel {
  margin-right: 884px;
}

.pool-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 110px));
  gap: 8px;
  margin-left: auto;
  margin-right: 8px;
}

.pool-inline-card {
  padding: 6px 8px;
  border: 1px solid rgba(133, 154, 169, 0.18);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.46);
}

.pool-inline-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.pool-inline-card strong {
  color: var(--accent);
  font-size: 18px;
  line-height: 1.2;
}

.pool-inline-card.danger strong {
  color: var(--red);
}

.holding-mode {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--soft);
  font-size: 11px;
}

.positions-header-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(133, 154, 169, 0.16);
  border-radius: 4px;
  background: rgba(10, 16, 20, 0.65);
}

.positions-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.positions-header-title strong {
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
}

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

.positions-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ── 账号管理：齿轮按钮 + 弹窗 ─────────────────────────── */
.account-manager-toggle {
  background: rgba(133, 154, 169, 0.08);
  border: 1px solid rgba(133, 154, 169, 0.25);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 10px;
  transition: background 0.15s;
}
.account-manager-toggle:hover {
  background: rgba(133, 154, 169, 0.18);
  color: var(--text);
}

.account-manager-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 24px;
}
.account-manager-overlay[hidden] {
  display: none;
}

.account-manager-dialog,
.account-form-dialog {
  background: var(--panel, #1d2530);
  border: 1px solid rgba(133, 154, 169, 0.25);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color: var(--text);
  max-width: 720px;
  max-height: 80vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.account-form-dialog {
  max-width: 540px;
}

.account-manager-header {
  align-items: center;
  border-bottom: 1px solid rgba(133, 154, 169, 0.18);
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  padding: 14px 18px;
}
.account-manager-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.account-manager-close:hover {
  color: var(--text);
}

.account-manager-body {
  flex: 1;
  overflow: auto;
  padding: 14px 18px;
}
.account-manager-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}
.account-add-button {
  background: rgba(58, 183, 149, 0.15);
  border: 1px solid rgba(58, 183, 149, 0.5);
  border-radius: 4px;
  color: rgba(120, 220, 180, 1);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 14px;
}
.account-add-button:hover {
  background: rgba(58, 183, 149, 0.28);
}
.account-manager-hint {
  color: var(--muted);
  font-size: 11px;
}

.account-manager-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-row {
  align-items: center;
  background: rgba(133, 154, 169, 0.05);
  border: 1px solid rgba(133, 154, 169, 0.15);
  border-radius: 6px;
  display: grid;
  grid-template-columns: minmax(80px, 110px) 1fr auto auto;
  gap: 12px;
  padding: 10px 14px;
}
.account-row.disabled {
  opacity: 0.55;
}
.account-row-name {
  font-size: 13px;
  font-weight: 600;
}
.account-row-meta {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-row-meta code {
  background: rgba(133, 154, 169, 0.12);
  border-radius: 3px;
  font-size: 10px;
  padding: 1px 5px;
}
.account-row-toggle {
  background: rgba(58, 183, 149, 0.15);
  border: 1px solid rgba(58, 183, 149, 0.45);
  border-radius: 4px;
  color: rgba(120, 220, 180, 1);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 10px;
}
.account-row-toggle.disabled-state {
  background: rgba(255, 100, 100, 0.1);
  border-color: rgba(255, 100, 100, 0.4);
  color: rgba(255, 130, 130, 1);
}
.account-row-actions {
  display: inline-flex;
  gap: 6px;
}
.account-row-actions button {
  background: transparent;
  border: 1px solid rgba(133, 154, 169, 0.3);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 8px;
}
.account-row-actions button:hover {
  border-color: rgba(133, 154, 169, 0.55);
  color: var(--text);
}
.account-row-actions .danger:hover {
  border-color: rgba(255, 100, 100, 0.55);
  color: rgba(255, 130, 130, 1);
}

/* 表单 */
.account-form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}
.account-form-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.account-form-body label > span {
  color: var(--muted);
}
.account-form-hint {
  color: rgba(133, 154, 169, 0.7);
  font-size: 10px;
  font-style: normal;
  margin-left: 4px;
}
.account-form-body input,
.account-form-body textarea {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(133, 154, 169, 0.25);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 8px 10px;
}
.account-form-body input:focus,
.account-form-body textarea:focus {
  border-color: rgba(58, 183, 149, 0.55);
  outline: none;
}
.account-form-body textarea {
  font-family: monospace;
  font-size: 11px;
  resize: vertical;
}
.account-form-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.account-form-checkbox input {
  width: 14px;
  height: 14px;
}
.account-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
.account-form-actions button {
  background: rgba(133, 154, 169, 0.1);
  border: 1px solid rgba(133, 154, 169, 0.3);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 16px;
}
.account-form-actions .primary {
  background: rgba(58, 183, 149, 0.2);
  border-color: rgba(58, 183, 149, 0.5);
  color: rgba(120, 220, 180, 1);
}
.account-form-actions .primary:hover {
  background: rgba(58, 183, 149, 0.32);
}
.account-form-error {
  background: rgba(255, 100, 100, 0.12);
  border: 1px solid rgba(255, 100, 100, 0.4);
  border-radius: 4px;
  color: rgba(255, 150, 150, 1);
  font-size: 12px;
  padding: 8px 12px;
}

.execution-state {
  padding: 4px 8px;
  border: 1px solid rgba(133, 154, 169, 0.2);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
}

.execution-state strong {
  color: var(--soft);
  font-size: 11px;
}

.positions-meta-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(560px, 3.2fr) minmax(210px, 1.2fr) minmax(250px, 1.4fr);
  gap: 8px;
  align-items: stretch;
  grid-auto-flow: column;
}

.positions-meta-item {
  padding: 6px 8px;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.42);
}

.positions-meta-item.wide {
  min-width: 0;
}

#symbolPnlCard span,
#symbolPnlCard strong,
#symbolPnlCard em {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.positions-meta-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.positions-meta-item strong {
  color: var(--soft);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#openPositionCard em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.summary-card {
  display: grid;
  align-content: start;
  gap: 6px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-item {
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid rgba(133, 154, 169, 0.12);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.32);
}

.summary-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.summary-item strong,
.summary-item em {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-item strong.positive,
.closed-stat-card strong.positive {
  color: var(--green);
}

.summary-item strong.negative,
.closed-stat-card strong.negative {
  color: var(--red);
}

.summary-item em.positive,
.closed-stat-card em.positive {
  color: var(--green);
}

.summary-item em.negative,
.closed-stat-card em.negative {
  color: var(--red);
}

.summary-winrate .stat-ring-wrap {
  justify-content: flex-start;
}

.summary-winrate .winrate-ring {
  width: 40px;
  height: 40px;
}

.summary-winrate .winrate-ring::after {
  width: 27px;
  height: 27px;
}

.closed-stat-card {
  padding: 6px 8px;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.42);
}

.closed-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.closed-stat-card strong {
  color: var(--soft);
  font-size: 13px;
}

.closed-stat-card em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.closed-stat-card.pnl-card.positive {
  border-color: rgba(32, 245, 203, 0.35);
  background: linear-gradient(180deg, rgba(11, 44, 40, 0.76), rgba(8, 28, 24, 0.72));
}

.closed-stat-card.pnl-card.negative {
  border-color: rgba(238, 77, 95, 0.35);
  background: linear-gradient(180deg, rgba(45, 20, 24, 0.76), rgba(30, 14, 18, 0.72));
}

.closed-stat-card.with-ring .stat-ring-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.winrate-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(#20f5cb 0deg 0deg, rgba(133, 154, 169, 0.22) 0deg 360deg);
  position: relative;
}

.winrate-ring::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(8, 13, 17, 0.94);
  border: 1px solid rgba(133, 154, 169, 0.18);
}

.winrate-ring b {
  position: relative;
  z-index: 1;
  color: var(--soft);
  font-size: 10px;
}

.holding-tabs {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
  width: max-content;
}

.holding-tab {
  height: 28px;
  padding: 0 11px;
  border: 1px solid rgba(133, 154, 169, 0.2);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.45);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.holding-tab.active {
  border-color: rgba(32, 245, 203, 0.45);
  background: rgba(32, 245, 203, 0.12);
  color: var(--accent);
}

.holding-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 4px;
}

.holding-section-title {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(133, 154, 169, 0.14);
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.closed-pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.closed-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.closed-search input {
  width: 220px;
  height: 24px;
  border: 1px solid rgba(133, 154, 169, 0.26);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.5);
  color: var(--soft);
  font-size: 11px;
  padding: 0 8px;
  outline: none;
}

.closed-search input::placeholder {
  color: rgba(150, 170, 184, 0.75);
}

.closed-pager button {
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(133, 154, 169, 0.2);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.45);
  color: var(--soft);
  font-size: 11px;
  cursor: pointer;
}

.closed-pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

.closed-pager span {
  color: var(--muted);
  font-size: 11px;
  min-width: 88px;
  text-align: center;
}

.holding-head,
.holding-row,
.closed-head,
.closed-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  text-align: left;
}

.holding-head,
.holding-row {
  grid-template-columns: 0.84fr 60px 56px 0.78fr 70px 72px 1.08fr 0.78fr 0.9fr 84px 104px 56px;
}

.closed-head,
.closed-row {
  grid-template-columns: 0.9fr 58px 0.74fr 0.74fr 66px 0.9fr 0.92fr 98px 98px 126px 56px;
}

.holding-head,
.closed-head {
  border-bottom: 1px solid rgba(133, 154, 169, 0.14);
  color: var(--muted);
  font-size: 11px;
}

.holding-table,
.closed-table {
  overflow: auto;
}

.holding-table {
  height: calc(100% - 36px);
  min-height: 140px;
  max-height: none;
}

.closed-wrap {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
}

.closed-table {
  height: calc(100% - 36px);
  min-height: 220px;
  max-height: none;
}

.holding-row,
.closed-row {
  border-bottom: 1px solid rgba(133, 154, 169, 0.1);
}

.holding-row span,
.closed-row span {
  color: var(--soft);
  font-size: 12px;
  text-align: left;
}

.holding-head .roi-head {
  justify-self: start;
  padding-right: 0;
}

.row-action {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  justify-self: start;
  width: 100%;
}

.manual-close-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 95, 120, 0.42);
  border-radius: 4px;
  background: rgba(58, 20, 28, 0.28);
  color: #ff9bad;
  font-size: 11px;
  cursor: pointer;
}

.manual-close-btn:hover {
  border-color: rgba(255, 95, 120, 0.68);
  color: #ffd2da;
}

.manual-close-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.holding-row .holding-side.positive,
.closed-row .positive {
  color: var(--green);
}

.holding-row .holding-side.negative,
.closed-row .negative {
  color: var(--red);
}

.holding-row .holding-side.neutral,
.closed-row .neutral {
  color: var(--soft);
}

.holding-row .score-col {
  color: var(--accent);
  font-weight: 800;
}

.holding-asset {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.holding-asset b {
  color: var(--soft);
}

.open-score {
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
  line-height: 1.15;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(133, 154, 169, 0.3);
  font-size: 10px;
  line-height: 1.1;
}

.phase-stage1 {
  color: #8aa3b6;
  background: rgba(108, 124, 139, 0.18);
  border-color: rgba(138, 163, 182, 0.3);
}

.phase-stage2 {
  color: #ffcc66;
  background: rgba(107, 81, 20, 0.24);
  border-color: rgba(255, 204, 102, 0.3);
}

.phase-trailing {
  color: #20f5cb;
  background: rgba(9, 66, 58, 0.25);
  border-color: rgba(32, 245, 203, 0.34);
}

.roi-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  min-width: 88px;
  justify-self: start;
}

.roi-cell b {
  font-size: 12px;
  line-height: 1;
}

.roi-cell small {
  font-size: 10px;
  line-height: 1;
}

.roi-track {
  position: relative;
  display: block;
  width: 84px;
  height: 6px;
  border-radius: 999px;
  background: rgba(133, 154, 169, 0.16);
  overflow: hidden;
}

.roi-track .roi-mid {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 6px;
  background: rgba(233, 241, 246, 0.45);
  transform: translateX(-0.5px);
}

.roi-track .roi-loss,
.roi-track .roi-win {
  position: absolute;
  top: 0;
  height: 6px;
}

.roi-track .roi-loss {
  right: 50%;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, rgba(238, 77, 95, 0.9), rgba(238, 77, 95, 0.3));
}

.roi-track .roi-win {
  left: 50%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, rgba(32, 245, 203, 0.35), rgba(32, 245, 203, 0.9));
}

.roi-track.no-target {
  opacity: 0.42;
}

.holding-table p,
.closed-table p {
  margin: 0;
  padding: 12px 10px;
  color: var(--muted);
  font-size: 12px;
}

.closed-row span small {
  display: block;
  font-size: 10px;
  margin-top: 2px;
}

.closed-main-row {
  cursor: pointer;
}

.closed-main-row:hover {
  background: rgba(42, 61, 75, 0.18);
}

.closed-main-symbol {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.closed-main-symbol b {
  color: var(--soft);
}

.closed-main-symbol em {
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
}

.reason-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(133, 154, 169, 0.25);
  font-style: normal;
  font-size: 10px;
  color: var(--soft);
  background: rgba(42, 58, 68, 0.34);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reason-profit {
  color: #20f5cb;
  border-color: rgba(32, 245, 203, 0.36);
  background: rgba(9, 66, 58, 0.22);
}

.reason-stop {
  color: #ffb2ba;
  border-color: rgba(238, 77, 95, 0.38);
  background: rgba(58, 22, 28, 0.32);
}

.reason-momentum {
  color: #ffd17d;
  border-color: rgba(245, 179, 67, 0.4);
  background: rgba(78, 53, 18, 0.3);
}

.reason-sync {
  color: #9fd2ff;
  border-color: rgba(80, 167, 255, 0.35);
  background: rgba(23, 48, 74, 0.3);
}

.reason-mixed,
.reason-other {
  color: #c8d4de;
  border-color: rgba(133, 154, 169, 0.28);
  background: rgba(42, 58, 68, 0.34);
}

.closed-expand,
.closed-expand-spacer {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.closed-expand {
  border: 1px solid rgba(133, 154, 169, 0.24);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.38);
  color: var(--muted);
  cursor: pointer;
  transition: transform 140ms ease, color 140ms ease, border-color 140ms ease;
}

.closed-expand.open {
  transform: rotate(90deg);
  color: var(--accent);
  border-color: rgba(32, 245, 203, 0.4);
}

.closed-subpanel {
  margin: 2px 10px 8px 28px;
  border-left: 3px solid rgba(80, 167, 255, 0.55);
  border-radius: 4px;
  background: rgba(26, 34, 44, 0.55);
  padding: 6px 8px;
}

.closed-sub-head,
.closed-sub-row {
  display: grid;
  grid-template-columns: 0.9fr 58px 0.74fr 0.74fr 66px 0.9fr 0.92fr 98px 98px 126px 56px;
  gap: 8px;
  align-items: center;
}

.source-order-id {
  font-family: "Consolas", "SFMono-Regular", "Roboto Mono", monospace;
  font-size: 10px;
  color: #9fd2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.closed-sub-head {
  color: var(--muted);
  font-size: 10px;
  padding: 2px 0 6px;
}

.closed-sub-row {
  color: var(--soft);
  font-size: 11px;
  padding: 6px 0;
  border-top: 1px solid rgba(133, 154, 169, 0.12);
}

.radar-block {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 160px;
  overflow: hidden;
}

.radar-panel .line-chart {
  height: 140px;
}

.radar-panel .radar-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.logs-panel .log-head {
  flex: 0 0 auto;
}

.logs-panel .log-table {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100% - 44px);
  max-height: none;
  overflow-y: auto;
}

body.compact-panels {
  overflow: auto;
}

body.compact-panels .app-shell {
  height: auto;
  min-height: 100vh;
}

body.compact-panels .top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
}

body.compact-panels .dashboard {
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  overflow: visible;
  height: auto;
}

body.compact-panels .opportunities-panel,
body.compact-panels .insight-panel,
body.compact-panels .holdings-page-panel,
body.compact-panels .detail-panel,
body.compact-panels .radar-panel,
body.compact-panels .logs-panel {
  grid-column: auto;
  grid-row: auto;
  min-height: 320px;
}

body.compact-panels .holding-table,
body.compact-panels .closed-table {
  max-height: none;
}

body.compact-panels .logs-panel .log-table {
  max-height: 360px;
}

.chart-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(3, 6, 8, 0.28);
}

.chart-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  z-index: 60;
  width: min(1440px, calc(100vw - 10px));
  height: 100vh;
  max-height: none;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(73, 161, 235, 0.24);
  border-left: 0;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, rgba(8, 15, 24, 0.98), rgba(5, 10, 16, 0.98));
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.52);
  transform: translate3d(calc(-100% - 24px), 0, 0);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.chart-drawer.open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
}

.chart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(133, 154, 169, 0.18);
}

.chart-drawer-head > div:first-child {
  margin-right: auto;
}

.chart-drawer-head h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.chart-drawer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-drawer-close {
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(133, 154, 169, 0.18);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.56);
  color: var(--soft);
  cursor: pointer;
}

.chart-drawer-close:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.chart-interval-switch {
  display: inline-flex;
  gap: 6px;
}

.chart-interval-switch button {
  height: 30px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid rgba(133, 154, 169, 0.2);
  border-radius: 4px;
  background: rgba(8, 13, 17, 0.56);
  color: var(--soft);
  font-size: 12px;
  cursor: pointer;
}

.chart-interval-switch button.active {
  color: #0a151d;
  border-color: rgba(32, 245, 203, 0.6);
  background: rgba(32, 245, 203, 0.88);
}

.chart-drawer-body {
  display: grid;
  grid-template-columns: 296px minmax(760px, 1fr) 214px;
  gap: 12px;
  align-items: start;
  min-height: 0;
  flex: 1 1 auto;
  padding: 10px 14px 14px 18px;
}

.chart-drawer-stack {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0;
}

.chart-drawer-stage {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 12px;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 6px;
  background: radial-gradient(circle at top, rgba(16, 30, 45, 0.55), rgba(7, 12, 18, 0.65));
}

.chart-drawer-stage span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 24px;
  padding: 0 10px;
  border-radius: 4px;
  background: rgba(242, 184, 75, 0.18);
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

.chart-drawer-stage strong {
  font-size: 30px;
  line-height: 1;
  color: var(--text);
}

.chart-drawer-stage em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.chart-drawer-canvas {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 680px;
  height: calc(100vh - 102px);
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(11, 21, 31, 0.72), rgba(7, 13, 19, 0.72));
  overflow: hidden;
}

.chart-drawer-canvas-shell {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.chart-drawer-side {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
}

.chart-signal-card {
  min-height: 0;
  overflow: hidden;
  padding: 9px 10px 10px;
}

.chart-signal-card .chart-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
}

.chart-signal-card .chart-detail-source {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding: 0 0 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(133, 154, 169, 0.14);
}

.chart-signal-card .chart-detail-source em {
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
}

.chart-detail-card {
  padding: 12px;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 6px;
  background: rgba(8, 14, 22, 0.72);
}

.chart-summary-card,
.chart-progress-card,
.chart-insight-card,
.chart-signal-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.chart-detail-card h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.chart-signal-card h4,
.chart-insight-card h4 {
  margin-bottom: 8px;
}

.chart-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.chart-detail-grid.compact {
  gap: 0;
}

.chart-detail-grid > div {
  display: grid;
  gap: 4px;
}

.chart-signal-card .chart-detail-grid > div {
  display: grid;
  gap: 2px;
  padding: 6px 8px 7px;
  border: 1px solid rgba(133, 154, 169, 0.1);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(9, 16, 22, 0.84), rgba(7, 12, 18, 0.72));
}

.chart-signal-card .chart-detail-grid > div:last-child {
  padding-bottom: 7px;
}

.chart-detail-grid span,
.chart-detail-note span {
  color: var(--muted);
  font-size: 11px;
}

.chart-detail-grid strong {
  font-size: 13px;
  color: var(--text);
}

.chart-signal-card .chart-detail-grid span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-signal-card .chart-detail-grid strong {
  font-family: "Consolas", "SFMono-Regular", "Roboto Mono", monospace;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.1;
}

.chart-signal-card .chart-detail-grid .chart-detail-source strong {
  font-size: 14px;
}

.chart-signal-card .chart-detail-grid .chart-detail-source span,
.chart-signal-card .chart-detail-grid .chart-detail-source em {
  text-transform: none;
  letter-spacing: 0.03em;
}

.chart-signal-card .chart-detail-grid .chart-detail-metric {
  min-width: 0;
}

.chart-signal-card .chart-detail-grid .chart-detail-metric strong.negative,
.chart-signal-card .chart-detail-grid .chart-detail-source strong.negative {
  color: var(--red);
}

.chart-signal-card .chart-detail-grid .chart-detail-metric strong.positive,
.chart-signal-card .chart-detail-grid .chart-detail-source strong.positive {
  color: var(--accent);
}

.chart-detail-progress {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.progress-pill {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 6px;
  background: rgba(4, 10, 16, 0.82);
}

.progress-pill b {
  font-size: 11px;
  color: var(--muted);
}

.progress-pill span {
  font-size: 12px;
  color: var(--text);
}

.progress-pill.active {
  border-color: rgba(32, 245, 203, 0.34);
  box-shadow: inset 0 0 0 1px rgba(32, 245, 203, 0.12);
}

.progress-pill.trailing {
  border-color: rgba(255, 198, 88, 0.34);
}

.progress-pill.wide {
  grid-column: span 2;
}

.chart-detail-note + .chart-detail-note {
  margin-top: 10px;
}

.chart-detail-note p {
  margin: 4px 0 0;
  color: var(--text);
  line-height: 1.5;
  font-size: 12px;
}

.chart-insight-card .chart-detail-note p {
  line-height: 1.55;
  font-size: 11px;
}

.chart-insight-card {
  padding: 9px 10px 10px;
}

.analysis-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(133, 154, 169, 0.14);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(8, 14, 22, 0.88), rgba(6, 11, 18, 0.78));
}

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

.analysis-status {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.analysis-time {
  color: var(--muted);
  font-size: 10px;
}

.analysis-summary,
.analysis-action {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.analysis-reasons {
  display: grid;
  gap: 6px;
}

.analysis-reasons span {
  display: block;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid rgba(133, 154, 169, 0.1);
  background: rgba(7, 12, 18, 0.78);
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.analysis-action {
  color: var(--muted);
  font-size: 11px;
}

.analysis-loading .analysis-summary {
  color: var(--muted);
}

.analysis-hold {
  border-color: rgba(32, 245, 203, 0.28);
}

.analysis-watch {
  border-color: rgba(133, 154, 169, 0.18);
}

.analysis-defend {
  border-color: rgba(255, 198, 88, 0.3);
}

.analysis-trim {
  border-color: rgba(255, 107, 132, 0.34);
}

.analysis-status.analysis-hold {
  color: var(--accent);
}

.analysis-status.analysis-watch {
  color: var(--muted);
}

.analysis-status.analysis-defend {
  color: #ffc658;
}

.analysis-status.analysis-trim {
  color: #ff6b84;
}

.holding-row.detail-active {
  background: linear-gradient(90deg, rgba(21, 39, 54, 0.6), rgba(9, 18, 26, 0.18));
}

.holding-row[data-position-symbol] {
  cursor: pointer;
}


.chart-hover-delta {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid rgba(133, 154, 169, 0.35);
  background: rgba(5, 12, 18, 0.86);
  color: #cfe0ea;
  font-size: 12px;
  line-height: 24px;
  pointer-events: none;
}

.chart-hover-delta.positive {
  color: #20f5cb;
  border-color: rgba(32, 245, 203, 0.42);
}

.chart-hover-delta.negative {
  color: #ff7f94;
  border-color: rgba(255, 95, 120, 0.42);
}

@media (max-width: 1180px) {
  body.chart-drawer-open .holdings-page-panel {
    margin-right: 0;
  }

  body.chart-drawer-open .positions-page {
    padding-right: 9px;
  }

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

  .holdings-page-panel,
  .logs-panel,
  .radar-panel {
    min-height: 320px;
  }

  .chart-drawer {
    top: 0;
    left: 0;
    width: calc(100vw - 10px);
    height: 100vh;
  }

  .chart-drawer-body {
    grid-template-columns: 1fr;
  }

  .chart-drawer-canvas {
    min-height: 460px;
    height: 460px;
  }

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

@media (max-width: 860px) {
  .chart-drawer-side {
    grid-template-columns: 1fr;
  }
}


/* 2026-05-22 mobile UI polish: bottom nav + compact header + hideable quote window */
.major-ticker-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 420px;
  max-width: 820px;
}

.ticker-toggle {
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(32, 245, 203, 0.28);
  border-radius: 999px;
  background: rgba(32, 245, 203, 0.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.ticker-toggle:active {
  transform: translateY(1px);
}

.major-ticker-wrap.ticker-collapsed {
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
}

.major-ticker-wrap.ticker-collapsed .major-ticker {
  display: none;
}

@media (max-width: 1180px), (pointer: coarse) {
  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
    width: 100%;
    min-height: 100dvh;
    height: auto;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .side-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex !important;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid rgba(32, 245, 203, 0.22);
    background: linear-gradient(180deg, rgba(7, 11, 14, 0.72), rgba(7, 11, 14, 0.98));
    box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .nav-item {
    flex: 1 1 0;
    max-width: 150px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid rgba(133, 154, 169, 0.12);
    border-radius: 14px;
    font-size: 12px;
    background: rgba(13, 18, 23, 0.66);
  }

  .nav-item span {
    width: 7px;
    height: 7px;
    box-shadow: 0 0 10px currentColor;
  }

  .nav-item.active {
    border-color: rgba(32, 245, 203, 0.36);
    background: rgba(32, 245, 203, 0.12);
  }

  .nav-plan {
    display: none;
  }

  .top-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 10px;
    min-height: auto;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    border-bottom: 1px solid rgba(133, 154, 169, 0.18);
    background: rgba(8, 13, 17, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
  }

  .brand h1 {
    max-width: 52vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .brand p {
    margin-top: 3px;
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .major-ticker-wrap {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
    max-width: none;
    flex: 0 0 auto;
  }

  .ticker-toggle {
    height: 30px;
    padding: 0 9px;
    font-size: 11px;
  }

  .major-ticker {
    position: fixed;
    left: 10px;
    right: 10px;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 39;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    min-width: 0;
    max-width: none;
    padding: 8px;
    border: 1px solid rgba(32, 245, 203, 0.18);
    border-radius: 14px;
    background: rgba(7, 11, 14, 0.96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .major-ticker-wrap.ticker-collapsed .major-ticker {
    display: none;
  }

  .major-card {
    min-height: 42px;
    padding: 7px 8px;
    border-radius: 10px;
  }

  .major-card strong {
    font-size: 13px;
  }

  .major-card em,
  .major-card span {
    font-size: 10px;
  }

  .status-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-width: none;
    width: 100%;
  }

  .status-cell {
    min-height: 42px;
    padding: 7px 8px;
    border-radius: 10px;
  }

  .status-cell span {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .status-cell strong {
    font-size: 11px;
  }

  #refreshButton {
    min-height: 42px;
    border-radius: 10px;
    font-size: 12px;
  }

  .dashboard,
  .positions-page {
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 9px;
  }

  .panel {
    border-radius: 12px;
  }

  .panel-title {
    gap: 8px;
    align-items: start;
  }

  .panel-title h2 {
    font-size: 16px;
  }

  .pool-inline {
    margin-left: 0;
    margin-right: 0;
    grid-template-columns: repeat(2, minmax(72px, 1fr));
  }

  .table-wrap,
  .holding-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .closed-table {
    overflow-x: hidden;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 760px;
  }

  .positions-header-bar,
  .holding-summary-grid,
  .holding-main-grid,
  .position-cards-grid {
    grid-template-columns: 1fr !important;
  }

  .chart-drawer {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .chart-drawer-head {
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
    flex-wrap: wrap;
  }

  .chart-drawer-body {
    grid-template-columns: 1fr !important;
    padding: 8px 8px calc(78px + env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .chart-drawer-canvas {
    min-height: 360px;
    height: 52vh;
  }

  .chart-drawer-side {
    grid-template-columns: 1fr !important;
  }
}

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

  .heat-cell,
  #refreshButton {
    grid-column: span 2;
  }

  .brand h1 {
    max-width: 46vw;
  }

  .major-ticker {
    grid-template-columns: 1fr 1fr;
  }
}


/* 2026-05-22 mobile positions summary fix: make trade summary / today PnL / balance visible */
@media (max-width: 1180px), (pointer: coarse) {
  .positions-meta-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .positions-meta-row > *,
  #openPositionCard,
  #tradeSummaryCard,
  #recentPnlCard,
  #symbolPnlCard {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 72px !important;
    overflow: visible !important;
  }

  #tradeSummaryCard {
    display: grid !important;
  }

  #tradeSummaryCard .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  #tradeSummaryCard .summary-item,
  #recentPnlCard,
  #symbolPnlCard,
  #openPositionCard {
    border-radius: 12px !important;
    padding: 10px 11px !important;
    background: rgba(8, 13, 17, 0.62) !important;
  }

  #recentPnlCard span,
  #symbolPnlCard span,
  #tradeSummaryCard > span,
  #openPositionCard span {
    font-size: 11px !important;
    letter-spacing: 0.02em;
  }

  #recentPnlCard strong,
  #symbolPnlCard strong,
  #openPositionCard strong,
  #tradeSummaryCard strong {
    display: block !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #recentPnlCard em,
  #symbolPnlCard em,
  #openPositionCard em,
  #tradeSummaryCard em {
    display: block !important;
    margin-top: 4px !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
  }
}

@media (min-width: 560px) and (max-width: 1180px) {
  .positions-meta-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #tradeSummaryCard {
    grid-column: 1 / -1 !important;
  }
}


/* 2026-05-22 dedicated account balance card */
#accountBalanceCard {
  display: block;
  border-color: rgba(32, 245, 203, 0.28);
  background: linear-gradient(180deg, rgba(9, 42, 36, 0.70), rgba(7, 22, 24, 0.64));
}

#accountAvailableBalance {
  color: var(--green);
}

#accountBalanceCard span,
#accountBalanceCard strong,
#accountBalanceCard em {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1180px), (pointer: coarse) {
  #accountBalanceCard {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 72px !important;
    overflow: visible !important;
    border-radius: 12px !important;
    padding: 10px 11px !important;
  }

  #accountBalanceCard span {
    font-size: 11px !important;
    letter-spacing: 0.02em;
  }

  #accountBalanceCard strong {
    display: block !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #accountBalanceCard em {
    display: block !important;
    margin-top: 4px !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
  }
}

/* 2026-07-03 mobile closed-history detail cards */
@media (max-width: 1180px), (pointer: coarse) {
  body.holding-view-closed .holdings-page-panel {
    gap: 8px !important;
  }

  body.holding-view-closed .positions-meta-row {
    /* 手机端已平仓页以列表为主；统计卡片会把记录挤到页面最下面。 */
    display: none !important;
  }

  body.holding-view-closed #holdingClosedWrap {
    order: 1 !important;
    flex: 0 0 auto !important;
  }

  body.holding-view-closed .positions-header-bar {
    order: 0 !important;
    position: sticky !important;
    top: calc(58px + env(safe-area-inset-top)) !important;
    z-index: 13 !important;
    margin-bottom: 0 !important;
    background: rgba(7, 11, 14, 0.96) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
  }

  body.holding-view-closed #openPositionCard,
  body.holding-view-closed #accountBalanceCard,
  body.holding-view-closed #symbolPnlCard {
    display: none !important;
  }

  body.holding-view-closed #tradeSummaryCard,
  body.holding-view-closed #recentPnlCard {
    min-height: 0 !important;
    padding: 8px 9px !important;
    border-radius: 11px !important;
  }

  body.holding-view-closed #tradeSummaryCard > span,
  body.holding-view-closed #recentPnlCard span {
    font-size: 10px !important;
  }

  body.holding-view-closed #tradeSummaryCard .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  body.holding-view-closed #tradeSummaryCard .summary-item {
    min-height: 0 !important;
    padding: 6px 5px !important;
    border-radius: 9px !important;
  }

  body.holding-view-closed #tradeSummaryCard .summary-item small {
    font-size: 9px !important;
    line-height: 1.1 !important;
  }

  body.holding-view-closed #tradeSummaryCard strong,
  body.holding-view-closed #recentPnlCard strong {
    font-size: 12px !important;
    line-height: 1.15 !important;
  }

  body.holding-view-closed #tradeSummaryCard em,
  body.holding-view-closed #recentPnlCard em {
    margin-top: 2px !important;
    font-size: 10px !important;
  }

  body.holding-view-closed #closedWinRateCard .stat-ring-wrap {
    width: 34px !important;
    height: 34px !important;
  }

  body.holding-view-closed #closedWinRateRing {
    width: 34px !important;
    height: 34px !important;
  }

  body.holding-view-closed #closedWinRate {
    font-size: 9px !important;
  }

  #holdingClosedWrap {
    min-height: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
  }

  #holdingClosedWrap .holding-section-title {
    position: sticky;
    top: calc(58px + env(safe-area-inset-top));
    z-index: 12;
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding: 6px 0 !important;
    border-bottom: 0 !important;
    background: rgba(7, 11, 14, 0.94) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  #holdingClosedWrap .closed-toolbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 5px !important;
    width: 100% !important;
  }

  #holdingClosedWrap .closed-search input {
    width: 100% !important;
    height: 30px !important;
    border-radius: 9px !important;
    font-size: 12px !important;
  }

  #holdingClosedWrap .closed-pager {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 5px !important;
    width: 100% !important;
    align-items: center !important;
  }

  #holdingClosedWrap .closed-pager button {
    height: 28px !important;
    border-radius: 9px !important;
    padding: 0 9px !important;
  }

  #holdingClosedWrap .closed-pager span {
    min-width: 0 !important;
    font-size: 12px !important;
    color: var(--soft) !important;
  }

  #holdingClosedWrap .closed-head,
  #holdingClosedWrap .closed-sub-head {
    display: none !important;
  }

  #holdingClosedWrap .closed-table {
    height: auto !important;
    min-height: 160px !important;
    max-height: none !important;
    display: grid !important;
    gap: 8px !important;
    padding-bottom: calc(86px + env(safe-area-inset-bottom)) !important;
  }

  #holdingClosedWrap .closed-row,
  #holdingClosedWrap .closed-sub-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px 9px !important;
    padding: 10px !important;
    border: 1px solid rgba(133, 154, 169, 0.16) !important;
    border-radius: 14px !important;
    background: rgba(8, 13, 17, 0.62) !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22) !important;
  }

  #holdingClosedWrap .closed-subpanel {
    display: grid !important;
    gap: 8px !important;
    margin: -6px 0 8px 12px !important;
    padding-left: 10px !important;
    border-left: 2px solid rgba(32, 245, 203, 0.22) !important;
  }

  #holdingClosedWrap .closed-subpanel[hidden] {
    display: none !important;
  }

  #holdingClosedWrap .closed-sub-row {
    background: rgba(14, 24, 30, 0.62) !important;
    border-color: rgba(32, 245, 203, 0.12) !important;
  }

  #holdingClosedWrap .closed-row > span,
  #holdingClosedWrap .closed-sub-row > span {
    display: grid !important;
    gap: 3px !important;
    min-width: 0 !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
  }

  #holdingClosedWrap .closed-row > span::before,
  #holdingClosedWrap .closed-sub-row > span::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  #holdingClosedWrap .closed-main-symbol,
  #holdingClosedWrap .closed-pnl-cell,
  #holdingClosedWrap .source-order-id,
  #holdingClosedWrap .row-action {
    grid-column: 1 / -1 !important;
  }

  #holdingClosedWrap .closed-pnl-cell {
    padding: 8px 10px !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.035) !important;
    font-size: 16px !important;
    font-weight: 800 !important;
  }

  #holdingClosedWrap .closed-pnl-cell small {
    margin-top: 4px !important;
    font-size: 12px !important;
  }

  #holdingClosedWrap .closed-main-symbol {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }

  #holdingClosedWrap .closed-main-symbol b {
    font-size: 16px !important;
  }

  #holdingClosedWrap .reason-chip {
    width: fit-content !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  #holdingClosedWrap .chart-trigger {
    min-width: 44px !important;
    min-height: 34px !important;
    border-radius: 10px !important;
  }
}

/* 2026-07-03 mobile closed-history unclamp: the card rows existed, but the
   active positions page / panel still inherited desktop overflow clipping.
   Release every ancestor in closed mode so the vertical card list can occupy
   the full phone page instead of being cut inside the panel. */
@media (max-width: 1180px), (pointer: coarse) {
  body.holding-view-closed,
  body.holding-view-closed .app-shell,
  body.holding-view-closed .positions-page,
  body.holding-view-closed .holdings-page-panel {
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.holding-view-closed .positions-page {
    display: block !important;
    padding-bottom: calc(104px + env(safe-area-inset-bottom)) !important;
  }

  body.holding-view-closed .holdings-page-panel {
    display: flex !important;
    gap: 6px !important;
    padding: 8px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.holding-view-closed #holdingClosedWrap,
  body.holding-view-closed #closedRows,
  body.holding-view-closed .closed-table {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }

  body.holding-view-closed #closedRows {
    align-content: start !important;
  }

  body.holding-view-closed #holdingClosedWrap .closed-row,
  body.holding-view-closed #holdingClosedWrap .closed-sub-row {
    width: 100% !important;
    max-width: 100% !important;
    contain: none !important;
  }

  body.holding-view-closed #holdingClosedWrap .closed-row > span,
  body.holding-view-closed #holdingClosedWrap .closed-sub-row > span,
  body.holding-view-closed #holdingClosedWrap .closed-main-symbol b,
  body.holding-view-closed #holdingClosedWrap .source-order-id {
    max-width: 100% !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
    word-break: break-word !important;
  }

  body.holding-view-closed #holdingClosedWrap .holding-section-title {
    top: calc(112px + env(safe-area-inset-top)) !important;
    max-width: 100% !important;
  }
}


/* 2026-07-03 mobile closed-history scroll fix: make the bottom record-card
   layer itself scroll. Body-level scrolling is unreliable inside Telegram / iOS
   webviews when sticky headers and fixed bottom nav are present; keep the page
   fixed-height and give #closedRows the remaining viewport height. */
@media (max-width: 1180px), (pointer: coarse) {
  body.holding-view-closed,
  body.holding-view-closed .app-shell,
  body.holding-view-closed .positions-page {
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  body.holding-view-closed .positions-page {
    display: flex !important;
    flex-direction: column !important;
    padding: 8px 8px calc(72px + env(safe-area-inset-bottom)) !important;
  }

  body.holding-view-closed .holdings-page-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  body.holding-view-closed #holdingClosedWrap {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  body.holding-view-closed #holdingClosedWrap .holding-section-title {
    flex: 0 0 auto !important;
    position: relative !important;
    top: auto !important;
    z-index: 2 !important;
  }

  body.holding-view-closed #closedRows,
  body.holding-view-closed #holdingClosedWrap .closed-table {
    flex: 1 1 auto !important;
    display: grid !important;
    align-content: start !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important;
  }
}


/* 2026-05-22 desktop account balance visibility fix.
   Desktop grid originally had 4 fixed columns while we now render 5 cards
   (open positions, summary, 24h PnL, account balance, symbol PnL). The extra
   card could be pushed outside the visible row. Make the desktop row explicitly
   include the account-balance card and let the legacy symbol card wrap below. */
@media (min-width: 1181px) and (pointer: fine) {
  .positions-meta-row {
    display: grid !important;
    grid-template-columns: minmax(170px, 1fr) minmax(560px, 3.2fr) minmax(210px, 1.2fr) minmax(250px, 1.4fr) !important;
    grid-auto-flow: row !important;
    grid-auto-rows: auto !important;
    gap: 8px !important;
    overflow: visible !important;
  }

  #openPositionCard {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  #tradeSummaryCard {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  #recentPnlCard {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }

  #accountBalanceCard {
    display: block !important;
    grid-column: 4 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    width: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #symbolPnlCard {
    display: none !important;
  }
}
