:root {
  color-scheme: light;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-muted: #f6f7f8;
  --line: #dfe3e7;
  --line-strong: #cdd3d9;
  --text: #171a1d;
  --muted: #68717b;
  --accent: #1967d2;
  --accent-soft: #e8f0fe;
  --up: #d93b36;
  --down: #15936b;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.financial-workspace {
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.financial-command-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.financial-company {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 24px;
}

.financial-company h2,
.financial-section-heading h3,
.financial-signals h3 {
  margin: 0;
}

.financial-company h2 {
  font-size: 18px;
}

.financial-company-code,
.financial-company > div > span,
.financial-report-meta span,
.financial-report-meta strong {
  color: var(--muted);
  font-size: 11px;
}

.financial-report-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.financial-report-meta strong {
  margin-left: 4px;
  color: var(--text);
}

.financial-search {
  position: relative;
  flex: 0 0 280px;
}

#financial-search-input {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  outline: none;
}

#financial-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(25, 103, 210, 0.12);
}

.financial-search-results {
  top: 39px;
  right: 0;
  left: 0;
}

.financial-summary-band {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 3fr);
  border-bottom: 1px solid var(--line);
}

.financial-overview {
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  border-left: 4px solid #77818b;
}

.financial-overview.positive {
  border-left-color: #168a68;
}

.financial-overview.warning {
  border-left-color: #c98218;
}

.financial-overview.danger {
  border-left-color: #c23d35;
}

.financial-overview > span,
.financial-dimension > span,
.financial-metrics span {
  color: var(--muted);
  font-size: 10px;
}

.financial-overview > strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.financial-overview p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.financial-dimensions {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.financial-dimension {
  min-width: 0;
  padding: 14px 15px;
  border-right: 1px solid var(--line);
  border-top: 3px solid #77818b;
}

.financial-dimension:last-child {
  border-right: 0;
}

.financial-dimension.positive {
  border-top-color: #168a68;
}

.financial-dimension.warning {
  border-top-color: #c98218;
}

.financial-dimension.danger {
  border-top-color: #c23d35;
}

.financial-dimension strong,
.financial-dimension small {
  display: block;
}

.financial-dimension strong {
  min-height: 32px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.3;
}

.financial-dimension small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.financial-metrics {
  display: grid;
  grid-template-columns: repeat(10, minmax(96px, 1fr));
  border-bottom: 1px solid var(--line);
}

.financial-metrics article {
  min-width: 0;
  padding: 12px 13px;
  border-right: 1px solid var(--line);
}

.financial-metrics article:last-child {
  border-right: 0;
}

.financial-metrics strong,
.financial-metrics small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.financial-metrics strong {
  margin-top: 6px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.financial-metrics small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.financial-metrics .positive,
.financial-table .positive {
  color: var(--up);
}

.financial-metrics .negative,
.financial-table .negative {
  color: var(--down);
}

.financial-signals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.financial-signals > div {
  min-width: 0;
  padding: 11px 16px 13px;
  border-right: 1px solid var(--line);
}

.financial-signals > div:last-child {
  border-right: 0;
}

.financial-signals h3 {
  margin-bottom: 8px;
  font-size: 12px;
}

.financial-signal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.financial-signal {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.financial-signal strong {
  font-size: 10px;
}

.financial-signal span,
.financial-signal-empty {
  color: var(--muted);
  font-size: 10px;
}

.financial-signal.warning {
  border-color: #e4bf82;
  background: #fff9ef;
}

.financial-signal.danger {
  border-color: #e1aaa6;
  background: #fff5f4;
}

.financial-signal.positive {
  border-color: #9dcfbe;
  background: #f4fbf8;
}

.financial-charts {
  min-height: 320px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.financial-chart-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.financial-chart-panel:last-child {
  border-right: 0;
}

.financial-section-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}

.financial-section-heading h3 {
  font-size: 13px;
}

.financial-section-heading span,
.financial-chart-legend {
  color: var(--muted);
  font-size: 10px;
}

.financial-chart-legend {
  display: flex;
  gap: 10px;
}

.financial-chart-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.financial-chart-legend i {
  width: 10px;
  height: 3px;
}

.financial-revenue-color {
  background: #2f6fed;
}

.financial-profit-color {
  background: #d45a4a;
}

.financial-chart-wrap {
  position: relative;
  height: 280px;
}

#financial-quarterly-chart,
#financial-quality-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.financial-table-panel {
  border-bottom: 1px solid var(--line);
}

.financial-ranking-panel {
  border-bottom: 1px solid var(--line);
}

.financial-ranking-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}

.financial-ranking-heading h3 {
  margin: 0;
  font-size: 13px;
}

.financial-ranking-heading span,
.financial-ranking-note {
  color: var(--muted);
  font-size: 10px;
}

.financial-ranking-tabs {
  min-width: 0;
  max-width: min(68vw, 700px);
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-muted);
}

.financial-ranking-tabs button {
  height: 27px;
  padding: 0 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
}

.financial-ranking-tabs button.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}

.financial-ranking-note {
  padding: 6px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.financial-ranking-wrap {
  height: clamp(360px, 58vh, 620px);
  max-height: 620px;
  overflow: auto;
}

.financial-ranking-pager {
  border-top: 1px solid var(--line);
}

.financial-ranking-table {
  min-width: 760px;
}

.financial-ranking-table th:first-child,
.financial-ranking-table td:first-child {
  width: 58px;
  text-align: center;
}

.financial-ranking-table th:nth-child(2),
.financial-ranking-table td:nth-child(2) {
  text-align: left;
}

.financial-ranking-table tbody tr {
  cursor: pointer;
}

.financial-ranking-stock {
  width: 100%;
  min-width: 120px;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.financial-ranking-stock strong,
.financial-ranking-stock span {
  display: block;
}

.financial-ranking-stock span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.financial-table-wrap {
  overflow: auto;
}

.financial-table {
  width: 100%;
  min-width: 930px;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.financial-table th,
.financial-table td {
  height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.financial-table th {
  position: sticky;
  top: 0;
  background: #f7f8fa;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.financial-table th[data-financial-sort],
.financial-table th[data-financial-annual-sort],
.overview-table th[data-overview-pool-sort],
.overview-table th[data-overview-ladder-sort] {
  cursor: pointer;
  user-select: none;
}

.financial-table th[data-financial-sort]::after,
.financial-table th[data-financial-annual-sort]::after,
.overview-table th[data-overview-pool-sort]::after,
.overview-table th[data-overview-ladder-sort]::after {
  content: "↕";
  margin-left: 3px;
  color: #a2aab2;
  font-size: 9px;
}

.financial-table th.sorted::after,
.overview-table th.sorted::after {
  content: "↓";
  color: var(--accent);
}

.financial-table th.sorted.ascending::after,
.overview-table th.sorted.ascending::after {
  content: "↑";
}

.financial-table th:first-child,
.financial-table td:first-child {
  text-align: left;
}

.financial-table tbody tr:hover {
  background: #f8fafc;
}

.financial-table-empty {
  color: var(--muted);
  text-align: center !important;
}

.financial-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 16px;
  color: var(--muted);
  font-size: 9px;
}

.financial-workspace[aria-busy="true"] {
  cursor: progress;
}

@media (max-width: 1100px) {
  .financial-summary-band {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .financial-dimensions {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .financial-dimension:nth-child(2) {
    border-right: 0;
  }

  .financial-metrics {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
  }

  .financial-metrics article:nth-child(5n) {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .financial-workspace {
    height: calc(100vh - 56px);
  }

  .financial-command-bar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .financial-company {
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .financial-report-meta {
    align-items: flex-end;
    flex-direction: column;
    gap: 3px;
  }

  .financial-search {
    flex: 0 0 auto;
    width: 100%;
  }

  .financial-summary-band {
    grid-template-columns: 1fr;
  }

  .financial-overview {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .financial-dimensions {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .financial-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .financial-metrics article:nth-child(2n) {
    border-right: 0;
  }

  .financial-signals,
  .financial-charts {
    grid-template-columns: 1fr;
  }

  .financial-signals > div,
  .financial-chart-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .financial-chart-wrap {
    height: 250px;
  }

  .financial-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .financial-ranking-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .financial-ranking-tabs {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .mode-switcher button {
    padding: 0 5px;
    font-size: 10px;
  }

  .financial-company h2 {
    font-size: 15px;
  }

  .financial-dimensions {
    grid-template-columns: 1fr;
  }

  .financial-dimension {
    border-right: 0;
  }
}

.overview-workspace {
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.overview-command-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.overview-command-bar h2,
.overview-command-bar p,
.overview-cap-heading h3,
.overview-panel-heading h3 {
  margin: 0;
}

.overview-command-bar h2 {
  font-size: 18px;
}

.overview-command-bar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.overview-time {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 10px;
}

.overview-time strong {
  margin-left: 4px;
  color: var(--text);
}

.overview-sentiment-band {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 3fr);
  border-bottom: 1px solid var(--line);
}

.overview-sentiment {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  border-left: 4px solid #78828c;
}

.overview-sentiment.positive {
  border-left-color: var(--up);
}

.overview-sentiment.warning {
  border-left-color: #c98218;
}

.overview-sentiment.danger {
  border-left-color: var(--down);
}

.overview-sentiment > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.overview-sentiment span,
.overview-breadth-grid span,
.overview-cap-heading span,
.overview-cap-group dt {
  color: var(--muted);
  font-size: 10px;
}

.overview-sentiment-score,
#overview-sentiment-score {
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.overview-sentiment-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
}

.overview-sentiment-copy b {
  font-size: 15px;
}

.overview-sentiment-track {
  height: 5px;
  margin-top: 11px;
  overflow: hidden;
  background: #e7eaed;
}

.overview-sentiment-track i {
  display: block;
  width: 0;
  height: 100%;
  background: #78828c;
  transition: width 180ms ease;
}

.overview-sentiment.positive .overview-sentiment-track i {
  background: var(--up);
}

.overview-sentiment.warning .overview-sentiment-track i {
  background: #c98218;
}

.overview-sentiment.danger .overview-sentiment-track i {
  background: var(--down);
}

.overview-breadth-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
}

.overview-breadth-grid article {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overview-breadth-grid article:nth-child(4n) {
  border-right: 0;
}

.overview-breadth-grid article:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.overview-breadth-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-capitalization {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.overview-cap-group {
  min-width: 0;
  padding: 14px 16px 12px;
  border-right: 1px solid var(--line);
  border-top: 3px solid #78828c;
}

.overview-cap-group:last-child {
  border-right: 0;
}

.overview-cap-group.positive {
  border-top-color: var(--up);
}

.overview-cap-group.warning {
  border-top-color: #c98218;
}

.overview-cap-group.danger {
  border-top-color: var(--down);
}

.overview-cap-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.overview-cap-heading h3 {
  margin-top: 3px;
  font-size: 14px;
}

.overview-cap-heading > strong {
  font-size: 18px;
}

.overview-cap-group dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 0;
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overview-cap-group dl div {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
}

.overview-cap-group dl div:last-child {
  border-right: 0;
}

.overview-cap-group dt,
.overview-cap-group dd {
  margin: 0;
}

.overview-cap-group dd {
  overflow: hidden;
  margin-top: 4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-cap-leaders {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.overview-cap-leaders li {
  min-width: 0;
}

.overview-cap-leaders li > span {
  color: var(--muted);
  font-size: 10px;
}

.overview-cap-leaders button {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  text-align: left;
}

.overview-cap-leaders button:hover span {
  color: var(--accent);
}

.overview-cap-leaders button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-cap-leaders button strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.overview-data-grid {
  height: 560px;
  min-height: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.overview-table-panel {
  min-width: 0;
  min-height: 0;
  height: 560px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.overview-table-panel:last-child {
  border-right: 0;
}

.overview-panel-heading {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.overview-panel-heading h3 {
  font-size: 13px;
}

.overview-panel-heading > div > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

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

.table-pager {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.table-pager button {
  width: 26px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.table-pager button:disabled {
  cursor: default;
  opacity: 0.35;
}

.overview-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.overview-table th,
.overview-table td {
  height: 42px;
  padding: 0 9px;
  border-bottom: 1px solid #edf0f2;
  text-align: right;
  white-space: nowrap;
}

.overview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.overview-table th:first-child,
.overview-table td:first-child {
  width: 52px;
  text-align: center;
}

.overview-table th:nth-child(2),
.overview-table td:nth-child(2) {
  width: 175px;
  text-align: left;
}

.overview-table tbody tr {
  cursor: pointer;
}

.overview-table tbody tr:hover td {
  background: #f7f9fb;
}

.overview-stock-button {
  width: 100%;
  min-width: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.overview-stock-button strong,
.overview-stock-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-stock-button span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.overview-empty-row {
  height: 120px !important;
  color: var(--muted);
  text-align: center !important;
}

.overview-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 16px;
  color: var(--muted);
  font-size: 9px;
}

.overview-workspace[aria-busy="true"] {
  cursor: progress;
}

@media (max-width: 1100px) {
  .overview-cap-leaders {
    grid-template-columns: repeat(3, minmax(90px, 1fr));
  }

  .overview-data-grid {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .overview-table-panel {
    height: 560px;
    min-height: 560px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .overview-workspace {
    height: calc(100vh - 56px);
  }

  .overview-command-bar {
    position: static;
    min-height: 58px;
    padding: 9px 12px;
  }

  .overview-time {
    align-items: flex-end;
    flex-direction: column;
    gap: 3px;
  }

  .overview-sentiment-band {
    grid-template-columns: 1fr;
  }

  .overview-sentiment {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .overview-breadth-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .overview-breadth-grid article:nth-child(2n) {
    border-right: 0;
  }

  .overview-breadth-grid article:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .overview-breadth-grid article:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .overview-capitalization {
    grid-template-columns: 1fr;
  }

  .overview-cap-group {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .overview-cap-group:last-child {
    border-bottom: 0;
  }

  .overview-cap-leaders {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .overview-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-panel-heading .segment-control {
    width: 100%;
  }

  .overview-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 420px) {
  .overview-command-bar h2 {
    font-size: 15px;
  }

  .overview-cap-group dl {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .overview-cap-group dl div:nth-child(2n) {
    border-right: 0;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #20252b;
  color: #fff;
  border-bottom: 1px solid #171b20;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-toggle {
  flex: 0 0 auto;
}

.topbar h1,
.topbar p,
.panel-heading h2,
.instrument-identity h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 650;
}

.topbar p {
  margin-top: 3px;
  color: #aeb7c1;
  font-size: 12px;
}

.refresh-area {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c2c8cf;
  font-size: 12px;
}

.mode-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #454d56;
  border-radius: 6px;
  background: #171c21;
}

.mode-switcher button {
  height: 28px;
  padding: 0 13px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #aeb7c1;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.mode-switcher button.active {
  background: #343c45;
  color: #fff;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #4a525c;
  border-radius: 5px;
  background: #2b3138;
  color: #fff;
  cursor: pointer;
}

.icon-button:hover {
  background: #383f47;
}

.icon-button span {
  font-size: 21px;
  line-height: 1;
}

.icon-button.loading span {
  animation: spin 0.8s linear infinite;
}

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

.workspace {
  height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 1px;
  background: var(--line-strong);
  transition: grid-template-columns 160ms ease;
}

.app-shell.watchlist-collapsed .workspace {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-shell.watchlist-collapsed .watchlist-panel {
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
}

.watchlist-panel,
.market-panel {
  min-height: 0;
  background: var(--surface);
}

.watchlist-panel {
  display: flex;
  flex-direction: column;
}

.panel-heading {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-heading h2 {
  font-size: 15px;
}

.panel-heading span,
#chart-status {
  color: var(--muted);
  font-size: 12px;
}

.group-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 32px);
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.group-bar select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.group-bar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(25, 103, 210, 0.12);
}

.compact-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: #56606a;
  cursor: pointer;
  font-size: 17px;
}

.compact-button:hover {
  background: var(--surface-muted);
  color: var(--accent);
}

.compact-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.search-box {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  background: var(--surface-muted);
  color: var(--text);
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(25, 103, 210, 0.12);
}

.search-icon {
  position: absolute;
  z-index: 1;
  left: 24px;
  top: 23px;
  width: 13px;
  height: 13px;
  border: 2px solid #7d8791;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  right: -5px;
  bottom: -2px;
  background: #7d8791;
  transform: rotate(45deg);
}

.search-results {
  position: absolute;
  z-index: 10;
  top: 52px;
  left: 12px;
  right: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(20, 28, 38, 0.14);
}

.search-result {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  background: var(--surface-muted);
}

.search-result span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.watchlist {
  overflow: auto;
  flex: 1;
}

.watch-row {
  position: relative;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(74px, 1fr) 112px 76px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 10px 16px;
  border: 0;
  border-bottom: 1px solid #eceff1;
  background: transparent;
  cursor: pointer;
}

.watch-row:hover {
  background: #f8f9fa;
}

.watch-row.selected {
  background: var(--accent-soft);
}

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

.watch-name,
.watch-price {
  font-size: 14px;
  font-weight: 650;
}

.watch-identity {
  min-width: 0;
}

.watch-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-sparkline {
  display: block;
  width: 112px;
  height: 46px;
}

.watch-code,
.watch-change {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.watch-value {
  text-align: right;
}

.remove-button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  display: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
  font-size: 18px;
}

.watch-row:hover .remove-button {
  display: block;
}

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

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

.market-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.instrument-header {
  display: grid;
  grid-template-columns: minmax(350px, 0.8fr) minmax(460px, 1.2fr);
  align-items: center;
  min-height: 108px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.instrument-identity {
  display: flex;
  align-items: center;
  gap: 28px;
}

.instrument-identity h2 {
  font-size: 21px;
  font-weight: 650;
}

.instrument-identity > div > span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.instrument-price strong {
  display: block;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.instrument-price span {
  margin-top: 2px !important;
  font-size: 13px !important;
}

.quote-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 14px 18px;
  margin: 0;
}

.quote-stats div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed #e5e8eb;
  padding-bottom: 5px;
}

.quote-stats dt,
.quote-stats dd {
  margin: 0;
  font-size: 12px;
}

.quote-stats dt {
  color: var(--muted);
}

.quote-stats dd {
  font-variant-numeric: tabular-nums;
}

.chart-toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--line);
}

.segment-control {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  overflow-x: auto;
}

.segment-control button {
  min-width: 42px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #505962;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.segment-control button:hover {
  background: #e9ecef;
}

.segment-control button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
  font-weight: 650;
}

.chart-container {
  position: relative;
  flex: 1;
  min-height: 320px;
  background: #fff;
}

#stock-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.chart-empty[hidden] {
  display: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 168px;
  padding: 8px 10px;
  border: 1px solid #cfd5db;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(26, 33, 41, 0.12);
  font-size: 11px;
  line-height: 1.7;
  pointer-events: none;
}

.chart-tooltip b {
  display: inline-block;
  width: 38px;
  color: var(--muted);
  font-weight: 400;
}

.quote-time-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.quote-time-row strong {
  color: #454d55;
  font-weight: 500;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 9px 14px;
  border-radius: 5px;
  background: #24292f;
  color: #fff;
  box-shadow: 0 8px 24px rgba(20, 28, 38, 0.22);
  font-size: 12px;
}

.empty-watchlist {
  padding: 28px 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  text-align: center;
}

.strategy-workspace {
  height: calc(100vh - 64px);
  overflow: auto;
  background: var(--surface);
}

.strategy-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.strategy-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.strategy-title h2,
.strategy-title p,
.section-heading h3 {
  margin: 0;
}

.strategy-title h2 {
  font-size: 17px;
}

.strategy-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.simulation-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #e0a128;
  border-radius: 4px;
  background: #fff8e5;
  color: #8a5a00;
  font-size: 11px;
}

.strategy-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.strategy-action-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 7px;
  border-left: 1px solid var(--line);
}

.strategy-action-cluster:first-child {
  padding-left: 0;
  border-left: 0;
}

.strategy-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
}

.strategy-actions button:hover {
  background: var(--surface-muted);
}

.strategy-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.strategy-actions .primary-command {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.strategy-actions .danger-command {
  color: #a82e29;
}

.strategy-progress {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(240px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
}

.strategy-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}

.strategy-progress progress {
  width: 100%;
  height: 8px;
}

.strategy-alert {
  padding: 10px 20px;
  border-bottom: 1px solid #e4c36e;
  background: #fff8e5;
  color: #765000;
  font-size: 12px;
}

.strategy-alert.error {
  border-color: #e4aaa7;
  background: #fff1f0;
  color: #8f2924;
}

.strategy-alert.info {
  border-color: #b8ccea;
  background: #eef5ff;
  color: #234f84;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(10, minmax(110px, 1fr));
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.strategy-metrics article {
  min-width: 120px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.strategy-metrics article:last-child {
  border-right: 0;
}

.strategy-metrics span,
.section-heading span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.strategy-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.strategy-breadth-metric small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.strategy-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.8fr);
  min-height: 390px;
  border-bottom: 1px solid var(--line);
}

.strategy-overview.no-positions {
  grid-template-columns: minmax(0, 1fr) 260px;
}

.strategy-equity-panel,
.strategy-position-panel {
  min-width: 0;
  background: var(--surface);
}

.strategy-equity-panel {
  border-right: 1px solid var(--line);
}

.section-heading {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.section-heading h3 {
  font-size: 13px;
}

.strategy-chart-wrap {
  position: relative;
  height: 340px;
}

.strategy-chart-legend {
  position: absolute;
  top: 8px;
  right: 14px;
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.strategy-chart-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.strategy-chart-legend i {
  width: 13px;
  height: 3px;
  display: inline-block;
}

.strategy-chart-legend .equity-line {
  background: #1967d2;
}

.strategy-chart-legend .drawdown-area {
  background: rgba(217, 59, 54, 0.28);
}

#strategy-equity-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.strategy-position-panel .strategy-table-wrap {
  height: 340px;
}

.strategy-records {
  min-height: 360px;
  background: var(--surface);
}

.strategy-records-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.strategy-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
}

.strategy-tabs button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.strategy-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
}

.strategy-filter {
  width: 230px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 11px;
}

.strategy-filter:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.strategy-tab-content {
  min-height: 310px;
}

.strategy-table-wrap {
  width: 100%;
  overflow: auto;
}

.strategy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.strategy-table th,
.strategy-table td {
  height: 34px;
  padding: 6px 9px;
  border-bottom: 1px solid #eceff1;
  text-align: right;
  white-space: nowrap;
}

.strategy-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #f6f7f8;
  color: #56606a;
  font-weight: 650;
}

.strategy-table th:first-child,
.strategy-table td:first-child,
.strategy-table .text-cell {
  text-align: left;
}

.strategy-table tr:hover td {
  background: #f9fafb;
}

.strategy-table .positive {
  color: var(--up);
}

.strategy-table .negative {
  color: var(--down);
}

.strategy-table .table-action {
  height: 25px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font-size: 10px;
}

.strategy-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.strategy-params {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0;
}

.strategy-params dl {
  margin: 0;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.strategy-params dt {
  color: var(--muted);
  font-size: 11px;
}

.strategy-params dd {
  margin: 5px 0 0;
  font-size: 13px;
}

.strategy-log {
  min-height: 310px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #101820;
  color: #d6e1e8;
  font: 11px/1.65 Consolas, monospace;
  white-space: pre-wrap;
}

.pairing-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 40px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(20, 28, 38, 0.24);
}

.pairing-dialog::backdrop {
  background: rgba(22, 29, 36, 0.46);
}

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

.pairing-dialog-header h3,
.pairing-dialog-header p {
  margin: 0;
}

.pairing-dialog-header h3 {
  font-size: 15px;
}

.pairing-dialog-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.pairing-dialog-header button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.pairing-code-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
}

.pairing-code-block > span,
.pairing-code-block > small {
  color: var(--muted);
  font-size: 11px;
}

.pairing-code-block strong {
  grid-row: 1 / span 2;
  font-size: 30px;
  letter-spacing: 4px;
  font-variant-numeric: tabular-nums;
}

.pairing-code-block button {
  width: max-content;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
}

.paired-device-section {
  max-height: 360px;
  overflow: auto;
}

.paired-device-list {
  min-height: 90px;
}

.paired-device-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding: 11px 18px;
  border-bottom: 1px solid #eceff1;
}

.paired-device-row strong {
  font-size: 12px;
}

.paired-device-row span {
  color: var(--muted);
  font-size: 10px;
}

.paired-device-row button {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #e2aaa7;
  border-radius: 4px;
  background: #fff;
  color: #9c2f2a;
  cursor: pointer;
  font-size: 10px;
}

.flow-workspace {
  height: calc(100vh - 64px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}

.flow-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.flow-command-bar h2,
.flow-command-bar p,
.flow-detail-header h3,
.flow-history-heading h3 {
  margin: 0;
}

.flow-command-bar h2 {
  font-size: 18px;
}

.flow-command-bar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.flow-command-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border-bottom: 1px solid var(--line);
}

.flow-metrics article {
  min-width: 0;
  padding: 11px 16px;
  border-right: 1px solid var(--line);
}

.flow-metrics article:last-child {
  border-right: 0;
}

.flow-metrics span,
.flow-detail-header > div > span,
.flow-selected-values span,
.flow-history-heading span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.flow-metrics strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-leaders {
  border-bottom: 1px solid var(--line);
}

.flow-leaders-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px 6px;
}

.flow-leaders-heading h3 {
  margin: 0;
  font-size: 13px;
}

.flow-leaders-heading span {
  color: var(--muted);
  font-size: 10px;
}

.flow-leaders-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flow-leaders-toggle {
  display: none;
}

.flow-leaders-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.flow-leaders-grid > div {
  min-width: 0;
  padding: 0 12px 8px;
  border-right: 1px solid var(--line);
}

.flow-leaders-grid > div:last-child {
  border-right: 0;
}

.flow-leaders-grid h4 {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.flow-leaders-grid ol {
  margin: 0;
  padding-left: 18px;
}

.flow-leaders-grid li {
  padding: 1px 0;
  color: var(--muted);
  font-size: 10px;
}

.flow-leaders-grid li > span {
  color: var(--muted);
}

.flow-leaders-grid li button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  text-align: left;
}

.flow-leaders-grid li button:hover {
  color: var(--accent);
}

.flow-leaders-grid li button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-leaders-grid li button strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.flow-leaders-grid .positive {
  color: var(--up);
}

.flow-leaders-grid .negative {
  color: var(--down);
}

.flow-main {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(330px, 0.72fr) minmax(0, 1.55fr);
}

.flow-ranking-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.flow-ranking-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.flow-ranking-toolbar h3 {
  margin: 0;
  font-size: 14px;
}

.flow-ranking-toolbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

#flow-search {
  width: 128px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
}

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

.flow-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.flow-table th,
.flow-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf0f2;
  text-align: right;
  white-space: nowrap;
}

.flow-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.flow-table th:first-child,
.flow-table td:first-child {
  width: 34%;
  text-align: left;
}

.flow-table th:nth-child(2),
.flow-table td:nth-child(2) {
  width: 24%;
  padding-right: 4px;
  padding-left: 4px;
  text-align: center;
}

.flow-table th:nth-child(3),
.flow-table td:nth-child(3) {
  width: 25%;
}

.flow-table th:nth-child(4),
.flow-table td:nth-child(4) {
  width: 17%;
}

.flow-table td:first-child strong,
.flow-table td:first-child span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-sparkline {
  width: 100%;
  height: 28px;
  display: block;
}

.flow-table td:first-child span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.flow-table tr {
  cursor: pointer;
}

.flow-table tr:hover td {
  background: #f7f9fb;
}

.flow-table tr.selected td {
  background: var(--accent-soft);
}

.flow-table .positive,
.flow-detail-panel .positive {
  color: var(--up);
}

.flow-table .negative,
.flow-detail-panel .negative {
  color: var(--down);
}

.flow-empty-row {
  padding: 28px 10px !important;
  color: var(--muted);
  text-align: center !important;
}

.flow-detail-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.flow-detail-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px 8px;
}

.flow-detail-header h3 {
  font-size: 17px;
}

.flow-detail-header > div > span {
  margin-top: 4px;
}

.flow-selected-values {
  display: flex;
  gap: 16px;
  text-align: right;
}

.flow-selected-values strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.flow-selected-values b {
  font-weight: 650;
}

.flow-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px 8px;
}

.flow-chart-toolbar > span {
  color: var(--muted);
  font-size: 10px;
}

.flow-kline-wrap {
  position: relative;
  min-height: 300px;
  flex: 0 0 300px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.flow-member-panel {
  flex: 0 0 360px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.flow-member-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 7px;
  border-bottom: 1px solid var(--line);
}

.flow-member-heading h3 {
  margin: 0;
  font-size: 13px;
}

.flow-member-heading span,
.flow-member-controls > span {
  color: var(--muted);
  font-size: 10px;
}

.flow-member-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

#flow-member-search {
  width: 142px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 10px;
}

.flow-member-table-wrap {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.flow-member-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.flow-member-table th,
.flow-member-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #edf0f2;
  text-align: right;
  white-space: nowrap;
}

.flow-member-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.flow-member-table th:nth-child(1),
.flow-member-table td:nth-child(1) {
  width: 58px;
  text-align: left;
}

.flow-member-table th:nth-child(2),
.flow-member-table td:nth-child(2) {
  width: 27%;
  text-align: left;
}

.flow-member-table th:nth-child(3),
.flow-member-table td:nth-child(3),
.flow-member-table th:nth-child(4),
.flow-member-table td:nth-child(4),
.flow-member-table th:nth-child(5),
.flow-member-table td:nth-child(5) {
  width: 78px;
}

.flow-member-table th:nth-child(6),
.flow-member-table td:nth-child(6),
.flow-member-table th:nth-child(7),
.flow-member-table td:nth-child(7) {
  width: 94px;
}

.flow-member-table tr {
  cursor: pointer;
}

.flow-member-table tr:hover td {
  background: #f7f9fb;
}

.flow-member-stock {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.flow-member-stock strong,
.flow-member-stock span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-member-stock span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.flow-member-badge,
.flow-limit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 20px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
}

.flow-member-badge.up,
.flow-limit-badge.up {
  background: rgba(217, 59, 54, 0.1);
  color: var(--up);
}

.flow-member-badge.down,
.flow-limit-badge.down {
  background: rgba(21, 147, 107, 0.1);
  color: var(--down);
}

.flow-member-badge.neutral {
  background: var(--surface-muted);
  color: var(--muted);
}

.flow-limit-panel {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
  min-height: 260px;
}

.flow-limit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 7px;
  border-bottom: 1px solid var(--line);
}

.flow-limit-heading h3 {
  margin: 0;
  font-size: 13px;
}

.flow-limit-heading span,
.flow-limit-counts span {
  color: var(--muted);
  font-size: 10px;
}

.flow-limit-counts {
  display: flex;
  gap: 12px;
  white-space: nowrap;
}

.flow-limit-counts strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.flow-limit-table-wrap {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.flow-limit-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.flow-limit-table th,
.flow-limit-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #edf0f2;
  text-align: right;
  white-space: nowrap;
}

.flow-limit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.flow-table th[data-flow-ranking-sort],
.flow-member-table th[data-flow-member-sort],
.flow-limit-table th[data-flow-limit-sort],
.strategy-table th[data-strategy-sort] {
  cursor: pointer;
  user-select: none;
}

.flow-table th[data-flow-ranking-sort]::after,
.flow-member-table th[data-flow-member-sort]::after,
.flow-limit-table th[data-flow-limit-sort]::after,
.strategy-table th[data-strategy-sort]::after {
  content: "↕";
  margin-left: 3px;
  color: #a2aab2;
  font-size: 9px;
}

.flow-table th[data-flow-ranking-sort].sorted::after,
.flow-member-table th[data-flow-member-sort].sorted::after,
.flow-limit-table th[data-flow-limit-sort].sorted::after,
.strategy-table th[data-strategy-sort].sorted::after {
  content: "↓";
  color: var(--accent);
}

.flow-table th[data-flow-ranking-sort].sorted.ascending::after,
.flow-member-table th[data-flow-member-sort].sorted.ascending::after,
.flow-limit-table th[data-flow-limit-sort].sorted.ascending::after,
.strategy-table th[data-strategy-sort].sorted.ascending::after {
  content: "↑";
}

th[tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.flow-limit-table th:nth-child(1),
.flow-limit-table td:nth-child(1) {
  width: 58px;
  text-align: left;
}

.flow-limit-table th:nth-child(2),
.flow-limit-table td:nth-child(2) {
  width: 30%;
  text-align: left;
}

.flow-limit-table th:nth-child(3),
.flow-limit-table td:nth-child(3),
.flow-limit-table th:nth-child(4),
.flow-limit-table td:nth-child(4) {
  width: 88px;
}

.flow-limit-table th:nth-child(5),
.flow-limit-table td:nth-child(5) {
  width: 72px;
}

.flow-limit-table th:nth-child(6),
.flow-limit-table td:nth-child(6) {
  width: 55px;
}

.flow-limit-table tr {
  cursor: pointer;
}

.flow-limit-table tr:hover td {
  background: #f7f9fb;
}

.flow-limit-stock {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.flow-limit-stock strong,
.flow-limit-stock span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-limit-stock span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

#flow-kline-chart,
#flow-history-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.flow-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 6px;
}

.flow-history-heading h3 {
  font-size: 13px;
}

.flow-history-wrap {
  position: relative;
  height: 170px;
  flex: 0 0 170px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .watch-row {
    grid-template-columns: minmax(66px, 1fr) 78px 68px;
    gap: 6px;
    padding-left: 12px;
    padding-right: 10px;
  }

  .watch-sparkline {
    width: 78px;
  }

  .instrument-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .quote-stats {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }

  .strategy-command-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .strategy-actions {
    justify-content: flex-start;
  }

  .strategy-overview {
    grid-template-columns: 1fr;
  }

  .strategy-overview.no-positions {
    grid-template-columns: 1fr;
  }

  .strategy-equity-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .flow-main {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .flow-command-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .flow-leaders-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .flow-leaders-grid > div:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 680px) {
  .dashboard-v2.public-mode .refresh-area {
    display: none;
  }

  .dashboard-v2.public-mode .topbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .dashboard-v2.public-mode .mode-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body {
    overflow-x: hidden;
  }

  .topbar {
    height: 56px;
    gap: 5px;
    padding: 0 8px;
  }

  .brand-area {
    flex: 0 0 auto;
    gap: 8px;
  }

  .brand-area > div {
    display: none;
  }

  .topbar p,
  #refresh-countdown {
    display: none;
  }

  .mode-switcher button {
    min-width: 40px;
    flex: 1 0 40px;
    padding: 0 4px;
    font-size: 10px;
  }

  .mode-switcher {
    min-width: 0;
    flex: 1;
    overflow-x: auto;
  }

  .refresh-area {
    flex: 0 0 auto;
    gap: 0;
  }

  .topbar .icon-button {
    width: 32px;
    height: 32px;
  }

  .workspace {
    height: calc(100vh - 56px);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(145px, 42vw) minmax(0, 1fr);
  }

  .watchlist-panel {
    width: auto;
    max-width: none;
    height: 100%;
    min-height: 0;
    border-right: 1px solid var(--line-strong);
    border-bottom: 0;
  }

  .app-shell.watchlist-collapsed .watchlist-panel {
    display: none;
  }

  .panel-heading {
    height: 44px;
    padding: 0 10px;
  }

  .panel-heading h2 {
    font-size: 14px;
  }

  .search-box {
    padding: 7px 8px;
  }

  .search-box input {
    height: 34px;
    padding-left: 30px;
    font-size: 12px;
  }

  .search-icon {
    left: 18px;
    top: 18px;
  }

  .search-results {
    top: 45px;
    left: 8px;
    right: 8px;
  }

  .watchlist {
    width: 100%;
    max-width: 100%;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .watch-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 82px;
    height: 82px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 34px 34px;
    grid-template-areas:
      "identity value"
      "spark spark";
    gap: 2px 6px;
    padding: 6px 8px;
    border-right: 0;
  }

  .watch-identity {
    grid-area: identity;
  }

  .watch-value {
    grid-area: value;
  }

  .watch-sparkline {
    grid-area: spark;
    width: 100%;
    height: 32px;
  }

  .watch-name,
  .watch-price {
    font-size: 12px;
  }

  .watch-code,
  .watch-change {
    margin-top: 2px;
    font-size: 10px;
  }

  .remove-button {
    display: block;
    top: auto;
    right: 1px;
    bottom: 0;
    opacity: 0.55;
  }

  .group-bar {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px 8px;
  }

  .group-bar select {
    grid-column: 1 / -1;
    height: 30px;
    font-size: 12px;
  }

  .group-bar .compact-button {
    width: 100%;
    height: 28px;
  }

  .market-panel {
    width: auto;
    max-width: none;
    min-width: 0;
    height: 100%;
  }

  .instrument-header {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 238px;
    padding: 10px;
    overflow: hidden;
  }

  .instrument-identity {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }

  .instrument-price {
    min-width: 0;
    text-align: left;
  }

  .instrument-price strong {
    font-size: 23px;
  }

  .quote-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    width: 100%;
    max-width: 100%;
  }

  .quote-stats div {
    display: block;
  }

  .quote-stats dd {
    margin-top: 2px;
  }

  .chart-toolbar {
    min-height: 50px;
    padding: 7px 12px;
    overflow: hidden;
  }

  #chart-status {
    display: none;
  }

  .segment-control {
    width: 100%;
  }

  .chart-container {
    min-height: 0;
  }

  .quote-time-row {
    padding: 0 12px;
  }

  .quote-time-row span:last-child {
    display: none;
  }

  .strategy-workspace {
    height: calc(100vh - 56px);
  }

  .flow-workspace {
    height: calc(100vh - 56px);
    overflow: auto;
  }

  .flow-command-bar {
    padding: 10px;
  }

  .flow-command-controls {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .flow-command-controls .segment-control {
    width: 100%;
  }

  .flow-metrics {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .flow-metrics article:nth-child(2) {
    border-right: 0;
  }

  .flow-leaders-grid {
    grid-template-columns: 1fr;
  }

  .flow-leaders-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 7px 12px;
  }

  .flow-leaders-grid > div:last-child {
    border-bottom: 0;
  }

  .flow-main {
    min-height: 850px;
    display: flex;
    flex-direction: column;
  }

  .flow-ranking-panel {
    height: 330px;
    flex: 0 0 330px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .flow-detail-panel {
    min-height: 650px;
  }

  .flow-detail-header,
  .flow-chart-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .flow-selected-values {
    text-align: left;
  }

  .flow-kline-wrap {
    min-height: 300px;
    flex: 0 0 300px;
  }

  .flow-limit-panel {
    flex-basis: 300px;
  }

  .flow-member-panel {
    flex-basis: 340px;
  }

  .flow-member-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }

  .flow-member-controls {
    width: 100%;
    justify-content: space-between;
  }

  .flow-limit-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }

  .flow-limit-table-wrap {
    height: auto;
  }

  .strategy-command-bar {
    padding: 10px;
  }

  .strategy-title {
    min-width: 0;
    width: 100%;
  }

  .strategy-title h2 {
    font-size: 15px;
  }

  .strategy-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .strategy-action-cluster {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: 100%;
    padding: 0;
    border: 0;
  }

  .strategy-actions button {
    padding: 0 4px;
    font-size: 10px;
  }

  .strategy-progress {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 10px;
  }

  .strategy-metrics {
    grid-template-columns: repeat(2, minmax(125px, 1fr));
  }

  .strategy-overview {
    min-height: 0;
  }

  .strategy-chart-wrap,
  .strategy-position-panel .strategy-table-wrap {
    height: 280px;
  }

  .strategy-params {
    grid-template-columns: 1fr 1fr;
  }

  .strategy-records-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px 7px;
  }

  .strategy-filter {
    width: 100%;
  }
}

/* dashboard-v2: a calmer, denser workspace skin */
body.dashboard-v2 {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --line: #e5eaf0;
  --line-strong: #d4dce6;
  --text: #172235;
  --muted: #718096;
  --accent: #2f6fed;
  --accent-soft: #edf4ff;
  --up: #d24c4c;
  --down: #168b71;
  --shadow: 0 8px 24px rgba(30, 55, 90, 0.07);
  background: var(--bg);
  color: var(--text);
}

.dashboard-v2,
.dashboard-v2 button,
.dashboard-v2 input,
.dashboard-v2 select {
  letter-spacing: 0;
}

.dashboard-v2 ::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.dashboard-v2 ::-webkit-scrollbar-track {
  background: transparent;
}

.dashboard-v2 ::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #cbd5e1;
  background-clip: padding-box;
}

.dashboard-v2 ::-webkit-scrollbar-thumb:hover {
  background: #aebdce;
  background-clip: padding-box;
}

.dashboard-v2 .topbar {
  height: 72px;
  padding: 0 28px;
  background: #111b2d;
  border-bottom: 1px solid #25344c;
  box-shadow: 0 4px 18px rgba(18, 31, 52, 0.18);
}

.dashboard-v2 .brand-area {
  min-width: 235px;
  gap: 13px;
}

.dashboard-v2 .brand-area > div {
  min-width: 0;
}

.dashboard-v2 .topbar h1 {
  color: #f7faff;
  font-size: 18px;
  letter-spacing: 0;
}

.dashboard-v2 .topbar p {
  color: #9caec5;
  font-size: 11px;
}

.dashboard-v2 .panel-toggle {
  width: 38px;
  height: 38px;
  border-color: #354863;
  background: #1a2940;
}

.dashboard-v2 .panel-toggle:hover,
.dashboard-v2 .refresh-area .icon-button:hover {
  border-color: #6588b7;
  background: #243954;
}

.dashboard-v2 .mode-switcher {
  gap: 4px;
  padding: 4px;
  border: 1px solid #2e405c;
  border-radius: 9px;
  background: #17243a;
}

.dashboard-v2 .mode-switcher button {
  height: 34px;
  min-width: 58px;
  padding: 0 15px;
  border-radius: 6px;
  color: #a9b8cc;
  font-size: 12px;
  transition: background 140ms ease, color 140ms ease;
}

.dashboard-v2 .mode-switcher button:hover {
  color: #fff;
  background: #223550;
}

.dashboard-v2 .mode-switcher button.active {
  background: #3777df;
  color: #fff;
  box-shadow: 0 3px 10px rgba(47, 111, 237, 0.32);
}

.dashboard-v2 .refresh-area {
  min-width: 150px;
  justify-content: flex-end;
  color: #9caec5;
}

.dashboard-v2 .refresh-area .icon-button {
  border-color: #354863;
  background: #1a2940;
}

.dashboard-v2 .workspace {
  height: calc(100vh - 72px);
  gap: 14px;
  padding: 14px;
  background: var(--bg);
}

.dashboard-v2 .watchlist-panel,
.dashboard-v2 .market-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.dashboard-v2 .watchlist-panel {
  background: #fbfcfe;
}

.dashboard-v2 .market-panel {
  background: var(--surface);
}

.dashboard-v2 .panel-heading {
  height: 62px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dashboard-v2 .panel-heading h2 {
  color: var(--text);
  font-size: 15px;
}

.dashboard-v2 .group-bar {
  padding: 10px 13px;
  background: #fbfcfe;
}

.dashboard-v2 .search-box {
  padding: 11px 13px;
  background: #fbfcfe;
}

.dashboard-v2 .search-box input {
  border-color: #d9e1eb;
  border-radius: 8px;
  background: #f4f7fb;
}

.dashboard-v2 .search-box input:focus,
.dashboard-v2 #financial-search-input:focus {
  border-color: #78a3ed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.dashboard-v2 .watch-row {
  margin: 0 8px 5px;
  min-height: 66px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.dashboard-v2 .watch-row:hover {
  border-color: #d8e3f2;
  background: #f5f8fd;
}

.dashboard-v2 .watch-row.selected {
  border-color: #b9d0f7;
  background: #edf4ff;
}

.dashboard-v2 .watch-row.selected::before {
  left: -1px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
}

.dashboard-v2 .instrument-header {
  min-height: 120px;
  padding: 20px 24px;
  background: #fff;
}

.dashboard-v2 .instrument-identity h2 {
  font-size: 22px;
  letter-spacing: 0;
}

.dashboard-v2 .instrument-price strong {
  font-size: 34px;
}

.dashboard-v2 .quote-stats div {
  border-bottom-color: #edf1f5;
}

.dashboard-v2 .chart-toolbar {
  min-height: 54px;
  padding: 9px 20px;
  background: #fbfcfe;
  border-top: 1px solid var(--line);
}

.dashboard-v2 .segment-control {
  gap: 3px;
  padding: 3px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f3f6fa;
}

.dashboard-v2 .segment-control button {
  height: 29px;
  border-radius: 5px;
  color: #6f7f92;
  font-size: 11px;
}

.dashboard-v2 .segment-control button:hover {
  color: var(--accent);
  background: #eaf1fc;
}

.dashboard-v2 .segment-control button.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(30, 55, 90, 0.12);
}

.dashboard-v2 .quote-time-row {
  min-height: 38px;
  padding: 0 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.dashboard-v2 .overview-workspace,
.dashboard-v2 .financial-workspace,
.dashboard-v2 .flow-workspace,
.dashboard-v2 .strategy-workspace {
  height: calc(100vh - 72px);
  padding: 16px 20px 24px;
  background: var(--bg);
}

.dashboard-v2 .overview-command-bar,
.dashboard-v2 .financial-command-bar,
.dashboard-v2 .flow-command-bar,
.dashboard-v2 .strategy-command-bar {
  min-height: 70px;
  margin: -16px -20px 16px;
  padding: 14px 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 16px rgba(30, 55, 90, 0.06);
}

.dashboard-v2 .overview-command-bar h2,
.dashboard-v2 .financial-company h2,
.dashboard-v2 .flow-command-bar h2,
.dashboard-v2 .strategy-title h2 {
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
}

.dashboard-v2 .overview-command-bar p,
.dashboard-v2 .flow-command-bar p,
.dashboard-v2 .strategy-title p {
  color: var(--muted);
}

.dashboard-v2 .overview-time,
.dashboard-v2 .financial-report-meta {
  color: var(--muted);
}

.dashboard-v2 .overview-sentiment-band,
.dashboard-v2 .overview-capitalization,
.dashboard-v2 .overview-data-grid,
.dashboard-v2 .financial-summary-band,
.dashboard-v2 .financial-metrics,
.dashboard-v2 .financial-ranking-panel,
.dashboard-v2 .financial-signals,
.dashboard-v2 .financial-charts,
.dashboard-v2 .financial-table-panel,
.dashboard-v2 .flow-metrics,
.dashboard-v2 .flow-leaders,
.dashboard-v2 .flow-main,
.dashboard-v2 .strategy-metrics,
.dashboard-v2 .strategy-overview,
.dashboard-v2 .strategy-records {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-v2 .overview-sentiment-band,
.dashboard-v2 .overview-capitalization,
.dashboard-v2 .overview-data-grid {
  overflow: hidden;
}

.dashboard-v2 .overview-sentiment,
.dashboard-v2 .overview-breadth-grid,
.dashboard-v2 .overview-cap-group {
  background: #fff;
}

.dashboard-v2 .overview-cap-group {
  border-top-width: 4px;
}

.dashboard-v2 .overview-table-panel {
  background: #fff;
}

.dashboard-v2 .overview-panel-heading,
.dashboard-v2 .financial-ranking-heading,
.dashboard-v2 .financial-section-heading,
.dashboard-v2 .section-heading {
  background: #fff;
}

.dashboard-v2 .overview-table-wrap,
.dashboard-v2 .financial-ranking-wrap {
  scrollbar-color: #bcc9d8 transparent;
}

.dashboard-v2 .overview-table th,
.dashboard-v2 .financial-table th,
.dashboard-v2 .flow-table th {
  background: #f7f9fc;
  color: #69788c;
}

.dashboard-v2 .overview-table tbody tr:hover td,
.dashboard-v2 .financial-table tbody tr:hover td,
.dashboard-v2 .flow-table tr:hover td {
  background: #f1f6ff;
}

.dashboard-v2 .financial-workspace {
  display: block;
}

.dashboard-v2 .financial-command-bar {
  top: 0;
}

.dashboard-v2 .financial-summary-band,
.dashboard-v2 .financial-metrics,
.dashboard-v2 .financial-signals,
.dashboard-v2 .financial-charts {
  overflow: hidden;
}

.dashboard-v2 .financial-overview {
  background: #fbfcfe;
}

.dashboard-v2 .financial-metrics article {
  min-height: 78px;
  background: #fff;
}

.dashboard-v2 .financial-metrics strong {
  color: var(--text);
  font-size: 16px;
}

.dashboard-v2 .financial-ranking-note {
  background: #fbfcfe;
}

.dashboard-v2 .financial-ranking-wrap {
  height: 560px;
  max-height: 560px;
}

.dashboard-v2 .financial-chart-panel,
.dashboard-v2 .financial-table-panel {
  background: #fff;
}

.dashboard-v2 .financial-signal {
  border-radius: 7px;
}

.dashboard-v2 .financial-note,
.dashboard-v2 .overview-note {
  padding: 10px 4px;
}

.dashboard-v2 .flow-workspace,
.dashboard-v2 .strategy-workspace {
  overflow: auto;
}

.dashboard-v2 .flow-main {
  min-height: 560px;
  overflow: hidden;
}

.dashboard-v2 .flow-ranking-panel,
.dashboard-v2 .flow-detail-panel,
.dashboard-v2 .strategy-equity-panel,
.dashboard-v2 .strategy-position-panel {
  background: #fff;
}

.dashboard-v2 .flow-ranking-toolbar,
.dashboard-v2 .flow-detail-header,
.dashboard-v2 .flow-chart-toolbar,
.dashboard-v2 .flow-history-heading {
  background: #fff;
}

.dashboard-v2 .strategy-command-bar {
  align-items: center;
}

.dashboard-v2 .strategy-actions button {
  min-height: 34px;
  border-radius: 7px;
  border-color: #d4deea;
  background: #fff;
}

.dashboard-v2 .strategy-actions .primary-command {
  border-color: var(--accent);
  background: var(--accent);
}

.dashboard-v2 .strategy-metrics article {
  background: #fff;
}

.dashboard-v2 .taco-monitor-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dashboard-v2 .taco-monitor-panel.stale {
  border-color: #e2b765;
}

.dashboard-v2 .taco-monitor-panel.stale .taco-monitor-heading {
  background: #fffaf0;
}

.taco-monitor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.taco-monitor-heading h3 {
  margin: 0;
  font-size: 14px;
}

.taco-monitor-heading span,
.taco-monitor-sources {
  color: var(--muted);
  font-size: 10px;
}

.taco-monitor-value {
  display: flex;
  align-items: center;
  gap: 10px;
}

.taco-monitor-value strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.taco-status {
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px !important;
}

.taco-status.normal { background: #eaf7ef; color: #237342; }
.taco-status.warning { background: #fff5df; color: #946000; }
.taco-status.danger { background: #fff0ef; color: #a12d28; }

.taco-monitor-body {
  padding: 12px 16px;
}

.taco-monitor-factors {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
}

.taco-factor {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.taco-factor span,
.taco-factor strong,
.taco-factor small {
  display: block;
}

.taco-factor span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.taco-factor strong {
  margin-top: 4px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.taco-factor small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.taco-monitor-sources {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .taco-monitor-factors {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .taco-monitor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

.dashboard-v2 .strategy-tabs button.active {
  border-bottom-color: var(--accent);
}

.dashboard-v2 .chart-empty {
  color: #8694a6;
}

.watchlist-backdrop {
  display: none;
}

.dashboard-v2.public-mode .mode-switcher button[data-mode="strategy"],
.dashboard-v2.public-mode #strategy-workspace,
.dashboard-v2.public-mode #pairing-dialog {
  display: none !important;
}

@media (max-width: 900px) {
  .dashboard-v2 .topbar {
    padding: 0 18px;
  }

  .dashboard-v2 .brand-area {
    min-width: 180px;
  }

  .dashboard-v2 .workspace {
    padding: 10px;
    gap: 10px;
  }

  .dashboard-v2 .overview-workspace,
  .dashboard-v2 .financial-workspace,
  .dashboard-v2 .flow-workspace,
  .dashboard-v2 .strategy-workspace {
    padding: 12px 14px 20px;
  }

  .dashboard-v2 .overview-command-bar,
  .dashboard-v2 .financial-command-bar,
  .dashboard-v2 .flow-command-bar,
  .dashboard-v2 .strategy-command-bar {
    margin: -12px -14px 14px;
  }
}

@media (max-width: 680px) {
  .dashboard-v2 .topbar {
    height: 60px;
    padding: 0 8px;
  }

  .dashboard-v2 .mode-switcher button {
    min-width: 42px;
    flex-basis: 42px;
    padding: 0 5px;
  }

  .dashboard-v2 .workspace {
    height: calc(100vh - 60px);
    padding: 8px;
    gap: 8px;
  }

  .dashboard-v2 .overview-workspace,
  .dashboard-v2 .financial-workspace,
  .dashboard-v2 .flow-workspace,
  .dashboard-v2 .strategy-workspace {
    height: calc(100vh - 60px);
    padding: 8px;
  }

  .dashboard-v2 .overview-command-bar,
  .dashboard-v2 .financial-command-bar,
  .dashboard-v2 .flow-command-bar,
  .dashboard-v2 .strategy-command-bar {
    margin: -8px -8px 10px;
    padding: 11px 12px;
    border-radius: 0 0 9px 9px;
  }

  .dashboard-v2 .overview-sentiment-band,
  .dashboard-v2 .overview-capitalization,
  .dashboard-v2 .overview-data-grid,
  .dashboard-v2 .financial-summary-band,
  .dashboard-v2 .financial-metrics,
  .dashboard-v2 .financial-ranking-panel,
  .dashboard-v2 .financial-signals,
  .dashboard-v2 .financial-charts,
  .dashboard-v2 .financial-table-panel,
  .dashboard-v2 .flow-metrics,
  .dashboard-v2 .flow-leaders,
  .dashboard-v2 .flow-main,
  .dashboard-v2 .strategy-metrics,
  .dashboard-v2 .strategy-overview,
  .dashboard-v2 .strategy-records {
    margin-bottom: 10px;
    border-radius: 8px;
  }

  .dashboard-v2 .overview-data-grid {
    height: auto;
    min-height: 0;
  }

  .dashboard-v2 .overview-table-panel {
    height: 520px;
    min-height: 520px;
  }

  .dashboard-v2 .financial-ranking-wrap {
    height: 520px;
    max-height: 520px;
  }

  .dashboard-v2 .overview-panel-heading,
  .dashboard-v2 .financial-ranking-heading {
    padding: 9px 10px;
  }

  .dashboard-v2 .overview-panel-heading .segment-control,
  .dashboard-v2 .financial-ranking-tabs {
    width: 100%;
  }

  .dashboard-v2 .flow-main {
    min-height: 0;
  }
}

/* Phone layout: full-width content with an on-demand watchlist drawer. */
@media (max-width: 680px) {
  .dashboard-v2 .topbar {
    height: 60px;
    gap: 7px;
    padding-right: max(8px, env(safe-area-inset-right));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .dashboard-v2 .brand-area {
    min-width: 0;
    gap: 0;
  }

  .dashboard-v2 .panel-toggle,
  .dashboard-v2 .refresh-area .icon-button {
    width: 40px;
    height: 40px;
  }

  .dashboard-v2 .mode-switcher {
    min-width: 0;
    flex: 1 1 auto;
    gap: 2px;
    padding: 3px;
    overflow: hidden;
  }

  .dashboard-v2 .mode-switcher button {
    min-width: 0;
    height: 32px;
    flex: 1 1 0;
    padding: 0 3px;
    font-size: 11px;
  }

  .dashboard-v2 .refresh-area {
    min-width: 0;
    flex: 0 0 auto;
  }

  .dashboard-v2 .workspace {
    position: relative;
    display: block;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    padding: 8px;
    overflow: hidden;
  }

  .dashboard-v2 .watchlist-panel {
    position: absolute;
    z-index: 30;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: min(86vw, 340px);
    height: auto;
    max-width: none;
    border: 1px solid var(--line-strong);
    box-shadow: 10px 0 32px rgba(17, 27, 45, 0.22);
  }

  .dashboard-v2 .app-shell.watchlist-collapsed .watchlist-panel {
    display: none;
  }

  .dashboard-v2 .app-shell:not(.watchlist-collapsed) .watchlist-backdrop {
    position: absolute;
    z-index: 20;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(17, 27, 45, 0.38);
    cursor: default;
  }

  .dashboard-v2 .market-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    min-width: 0;
  }

  .dashboard-v2 .instrument-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    overflow: visible;
  }

  .dashboard-v2 .instrument-identity {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
  }

  .dashboard-v2 .instrument-identity h2 {
    font-size: 19px;
  }

  .dashboard-v2 .instrument-price {
    text-align: right;
  }

  .dashboard-v2 .instrument-price strong {
    font-size: 27px;
  }

  .dashboard-v2 .quote-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
  }

  .dashboard-v2 .quote-stats div {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .dashboard-v2 .quote-stats dd {
    overflow: hidden;
    margin-top: 0;
    text-overflow: ellipsis;
  }

  .dashboard-v2 .chart-toolbar {
    min-height: 48px;
    padding: 6px 10px;
    overflow: visible;
  }

  .dashboard-v2 .chart-toolbar .segment-control {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .dashboard-v2 .chart-toolbar .segment-control::-webkit-scrollbar {
    display: none;
  }

  .dashboard-v2 .chart-toolbar .segment-control button {
    min-width: 44px;
    height: 32px;
    flex: 0 0 auto;
  }

  .dashboard-v2 .chart-container {
    min-height: 280px;
  }

  .dashboard-v2 .quote-time-row {
    min-height: 36px;
    padding: 0 12px;
  }

  .dashboard-v2 .overview-cap-group dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-v2 .overview-cap-group dl div:nth-child(2n) {
    border-right: 0;
  }

  .dashboard-v2 .overview-cap-leaders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-v2 .overview-workspace,
  .dashboard-v2 .financial-workspace,
  .dashboard-v2 .flow-workspace,
  .dashboard-v2 .strategy-workspace {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
}

@media (max-width: 360px) {
  .dashboard-v2 .topbar {
    gap: 5px;
    padding-right: 6px;
    padding-left: 6px;
  }

  .dashboard-v2 .panel-toggle,
  .dashboard-v2 .refresh-area .icon-button {
    width: 36px;
    height: 36px;
  }

  .dashboard-v2 .mode-switcher button {
    font-size: 10px;
  }

  .dashboard-v2 .instrument-header {
    padding: 12px;
  }

  .dashboard-v2 .quote-stats {
    gap: 7px 8px;
  }
}

/* Consolidated workspace navigation and detail views. */
.workspace-subtabs {
  min-height: 42px;
  display: flex;
  align-items: flex-end;
  gap: 22px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-subtabs button {
  position: relative;
  height: 41px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.workspace-subtabs button::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
}

.workspace-subtabs button:hover {
  color: var(--text);
}

.workspace-subtabs button.active {
  color: var(--accent);
}

.workspace-subtabs button.active::after {
  background: var(--accent);
}

.dashboard-v2 .overview-data-tabs {
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  box-shadow: var(--shadow);
}

.dashboard-v2 .overview-data-grid {
  height: min(62vh, 620px);
  min-height: 520px;
  grid-template-columns: minmax(0, 1fr);
  margin-top: -1px;
  border-radius: 0 0 10px 10px;
}

.dashboard-v2 .overview-table-panel {
  width: 100%;
  height: 100%;
  border-right: 0;
}

.dashboard-v2 .financial-view-tabs {
  position: sticky;
  z-index: 12;
  top: 0;
  margin: -16px -20px 16px;
  padding: 0 22px;
  box-shadow: 0 4px 16px rgba(30, 55, 90, 0.06);
}

.dashboard-v2 .financial-command-bar {
  position: relative;
  top: auto;
  min-height: 66px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.dashboard-v2 .financial-ranking-panel {
  min-height: 650px;
}

.dashboard-v2 .financial-ranking-wrap {
  height: min(68vh, 650px);
  max-height: none;
}

.strategy-maintenance-menu {
  position: relative;
}

.strategy-maintenance-menu summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid #d4deea;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  list-style: none;
}

.strategy-maintenance-menu summary::-webkit-details-marker {
  display: none;
}

.strategy-maintenance-menu summary::after {
  content: "⌄";
  margin-left: 7px;
  color: var(--muted);
}

.strategy-maintenance-menu[open] summary {
  border-color: #9db9e8;
  color: var(--accent);
}

.strategy-maintenance-menu > div {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: 150px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(30, 55, 90, 0.18);
}

.dashboard-v2 .strategy-maintenance-menu > div button {
  width: 100%;
  min-height: 32px;
  display: block;
  border: 0;
  text-align: left;
}

.flow-leaders-heading {
  min-height: 48px;
  gap: 16px;
  padding: 7px 14px;
}

.flow-leaders-heading > div:first-child {
  flex: 0 0 auto;
}

.flow-leader-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.flow-leader-list li {
  min-width: 0;
  padding: 7px 12px;
  border-right: 1px solid var(--line);
}

.flow-leader-list li:last-child {
  border-right: 0;
}

.flow-leader-list li > span {
  color: var(--muted);
  font-size: 10px;
}

.flow-leader-list li button {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
}

.flow-leader-list li button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-leader-list li button strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.flow-leader-list .positive {
  color: var(--up);
}

.flow-leader-list .negative {
  color: var(--down);
}

.dashboard-v2 .flow-main {
  min-height: 600px;
}

.flow-detail-panel {
  overflow: hidden;
}

.flow-detail-tabs {
  flex: 0 0 42px;
  padding: 0 18px;
  background: #fbfcfe;
}

.flow-chart-toolbar[data-flow-detail-section="kline"] {
  flex: 0 0 auto;
  padding-top: 8px;
}

.flow-kline-wrap[data-flow-detail-section="kline"] {
  min-height: 360px;
  flex: 1 1 auto;
}

.flow-member-panel[data-flow-detail-section="members"],
.flow-limit-panel[data-flow-detail-section="limits"],
.flow-history-panel[data-flow-detail-section="history"] {
  min-height: 0;
  flex: 1 1 auto;
}

.flow-history-panel {
  display: flex;
  flex-direction: column;
}

.flow-history-wrap {
  min-height: 260px;
  height: auto;
  flex: 1 1 auto;
}

/* Public feature surfaces: alerts, disclosures, ETF scanning and rotation. */
.alert-center-button {
  position: relative;
  height: 34px;
  padding: 0 11px;
  border: 1px solid #354863;
  border-radius: 6px;
  background: #1a2940;
  color: #d9e5f4;
  cursor: pointer;
  font-size: 11px;
}

.alert-center-button:hover {
  border-color: #6588b7;
  background: #243954;
}

.alert-center-button strong {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #111b2d;
  border-radius: 9px;
  background: #d24c4c;
  color: #fff;
  font-size: 9px;
  line-height: 1;
}

.alert-center-dialog {
  width: min(430px, 100vw);
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text);
}

.alert-center-dialog::backdrop {
  background: rgba(10, 18, 30, 0.48);
}

.alert-center-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #111b2d;
  color: #fff;
}

.alert-center-header h3,
.alert-center-header span {
  margin: 0;
}

.alert-center-header h3 {
  font-size: 16px;
}

.alert-center-header span {
  display: block;
  margin-top: 3px;
  color: #9caec5;
  font-size: 10px;
}

.alert-center-tabs {
  padding: 0 16px;
}

.alert-events-section,
.alert-rules-section {
  height: calc(100dvh - 106px);
  overflow-y: auto;
}

.alert-events-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.alert-events-toolbar button,
.alert-rule-form > button {
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
}

.alert-event,
.alert-rule {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.alert-event.unread {
  box-shadow: inset 3px 0 0 var(--accent);
  background: var(--accent-soft);
}

.alert-event > div,
.alert-rule {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-event strong,
.alert-rule strong {
  font-size: 12px;
}

.alert-event span,
.alert-event time,
.alert-event small,
.alert-rule span {
  color: var(--muted);
  font-size: 9px;
}

.alert-event time {
  margin-left: auto;
}

.alert-event p {
  margin: 7px 0 4px;
  font-size: 11px;
}

.alert-rule-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.alert-rule-form label {
  min-width: 0;
}

.alert-rule-form label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
}

.alert-rule-form input,
.alert-rule-form select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
}

.alert-rule-form > button {
  grid-column: 1 / -1;
  height: 36px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.alert-rule > div {
  min-width: 0;
  flex: 1;
}

.alert-rule > div strong,
.alert-rule > div span {
  display: block;
}

.alert-rule > div span {
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-rule > label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}

.alert-rule > button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}

.alert-rule.disabled {
  opacity: 0.55;
}

.alert-empty,
.financial-public-empty {
  padding: 34px 16px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.overview-etf-panel {
  overflow: hidden;
}

.overview-index-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.overview-index-strip article {
  min-width: 100px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.overview-index-strip article:last-child {
  border-right: 0;
}

.overview-index-strip span,
.overview-index-strip strong,
.overview-index-strip small {
  display: block;
}

.overview-index-strip span {
  color: var(--muted);
  font-size: 9px;
}

.overview-index-strip strong {
  margin-top: 4px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.overview-index-strip small {
  margin-top: 2px;
  font-size: 9px;
}

.overview-etf-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.financial-public-panel {
  min-height: 560px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.financial-public-heading {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}

.financial-public-heading h3 {
  margin: 0;
  font-size: 13px;
}

.financial-public-heading span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.financial-announcement-list {
  max-height: calc(100dvh - 220px);
  overflow-y: auto;
}

.financial-announcement-item {
  display: block;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.financial-announcement-item:hover {
  background: var(--surface-muted);
}

.financial-announcement-copy > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.financial-announcement-copy strong {
  font-size: 11px;
}

.financial-announcement-copy span,
.financial-announcement-copy time {
  color: var(--muted);
  font-size: 9px;
}

.financial-announcement-copy time {
  margin-left: auto;
}

.financial-announcement-copy p {
  margin: 7px 0 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.6;
}

.financial-calendar-table {
  min-width: 680px;
}

.financial-calendar-table td:nth-child(2) strong,
.financial-calendar-table td:nth-child(2) span {
  display: block;
}

.financial-calendar-table td:nth-child(2) span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.calendar-report-mobile {
  display: none;
}

.flow-rotation-panel {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
}

.flow-rotation-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
}

.flow-rotation-heading h3 {
  margin: 0;
  font-size: 13px;
}

.flow-rotation-heading span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.flow-rotation-leaders {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  border-bottom: 1px solid var(--line);
}

.flow-rotation-leaders article {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.flow-rotation-leaders article:last-child {
  border-right: 0;
}

.flow-rotation-leaders span,
.flow-rotation-leaders strong,
.flow-rotation-leaders small {
  display: block;
}

.flow-rotation-leaders span,
.flow-rotation-leaders small {
  color: var(--muted);
  font-size: 9px;
}

.flow-rotation-leaders strong {
  overflow: hidden;
  margin: 4px 0;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-rotation-timeline section {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}

.flow-rotation-timeline time {
  padding: 11px 10px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.flow-rotation-timeline section > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
}

.flow-rotation-timeline section span {
  min-width: 130px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 10px;
}

.flow-rotation-timeline section span.entered {
  border-color: #9dbdf0;
  background: var(--accent-soft);
}

.flow-rotation-timeline b {
  color: var(--muted);
  font-size: 9px;
}

.flow-rotation-timeline em {
  margin-left: auto;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .overview-etf-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .flow-rotation-leaders {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 680px) {
  .dashboard-v2.public-mode .refresh-area {
    display: flex;
  }

  .dashboard-v2.public-mode .refresh-area #refresh-button,
  .dashboard-v2.public-mode .refresh-area #refresh-countdown {
    display: none;
  }

  .dashboard-v2.public-mode .topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .alert-center-button {
    width: 42px;
    height: 40px;
    padding: 0 8px;
  }

  .alert-center-dialog {
    width: 100vw;
  }

  .alert-center-header {
    padding-top: env(safe-area-inset-top);
    height: calc(60px + env(safe-area-inset-top));
  }

  .alert-events-section,
  .alert-rules-section {
    height: calc(100dvh - 102px - env(safe-area-inset-top));
    padding-bottom: env(safe-area-inset-bottom);
  }

  .alert-rule-form {
    grid-template-columns: 1fr;
  }

  .alert-rule-form > button {
    grid-column: auto;
  }

  .overview-index-strip {
    grid-template-columns: repeat(7, 112px);
  }

  .overview-etf-panel .overview-panel-heading,
  .financial-public-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .overview-etf-controls .segment-control,
  .financial-public-heading .segment-control {
    width: 100%;
    overflow-x: auto;
  }

  .financial-public-panel {
    min-height: calc(100dvh - 118px);
    margin-bottom: 0;
    border-radius: 0;
  }

  .financial-announcement-list {
    max-height: none;
  }

  .financial-announcement-copy > div {
    flex-wrap: wrap;
  }

  .financial-announcement-copy time {
    width: 100%;
    margin-left: 0;
  }

  .financial-calendar-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
  }

  .financial-calendar-table th,
  .financial-calendar-table td {
    padding-right: 7px;
    padding-left: 7px;
  }

  .financial-calendar-table th:nth-child(1),
  .financial-calendar-table td:nth-child(1) {
    width: 86px;
  }

  .financial-calendar-table th:nth-child(2),
  .financial-calendar-table td:nth-child(2) {
    width: auto;
  }

  .financial-calendar-table th:nth-child(3),
  .financial-calendar-table td:nth-child(3) {
    display: none;
  }

  .financial-calendar-table th:nth-child(4),
  .financial-calendar-table td:nth-child(4) {
    width: 48px;
  }

  .financial-calendar-table th:nth-child(5),
  .financial-calendar-table td:nth-child(5) {
    width: 56px;
  }

  .calendar-report-mobile {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 400;
  }

  .flow-rotation-leaders {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .flow-rotation-timeline section {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .flow-rotation-timeline section span {
    width: 100%;
    min-width: 0;
  }
}

.overview-etf-panel .overview-table {
  min-width: 720px;
  table-layout: auto;
}

.overview-etf-panel .overview-table th:first-child,
.overview-etf-panel .overview-table td:first-child {
  width: 220px;
  text-align: left;
}

.overview-etf-panel .overview-table th:nth-child(2),
.overview-etf-panel .overview-table td:nth-child(2) {
  width: 80px;
  text-align: right;
}

@media (max-width: 680px) {
  .overview-etf-panel .overview-table {
    min-width: 620px;
  }

  .overview-etf-panel .overview-table th:first-child,
  .overview-etf-panel .overview-table td:first-child {
    width: 170px;
  }
}

@media (max-width: 900px) {
  .dashboard-v2 .overview-data-grid {
    height: 580px;
    min-height: 580px;
  }

  .flow-leaders-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .flow-leaders-heading .segment-control {
    width: 100%;
    overflow-x: auto;
  }

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

  .flow-leader-list li {
    border-bottom: 1px solid var(--line);
  }

  .flow-leader-list li:nth-child(2n) {
    border-right: 0;
  }

  .flow-leader-list li:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 680px) {
  .workspace-subtabs {
    gap: 18px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .workspace-subtabs::-webkit-scrollbar {
    display: none;
  }

  .workspace-subtabs button {
    min-width: max-content;
    flex: 0 0 auto;
  }

  .dashboard-v2 .financial-view-tabs {
    top: 0;
    margin: -10px -10px 10px;
    padding: 0 12px;
  }

  .dashboard-v2 .financial-command-bar {
    margin-bottom: 10px;
    border-radius: 8px;
  }

  .strategy-maintenance-menu {
    position: static;
  }

  .strategy-maintenance-menu > div {
    right: 10px;
    left: 10px;
    width: auto;
  }

  .flow-detail-tabs {
    padding: 0 10px;
  }

  .flow-leader-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-leader-list li,
  .flow-leader-list li:nth-child(2n) {
    border-right: 0;
  }

  .dashboard-v2 .flow-main {
    min-height: 760px;
  }

  .flow-detail-panel {
    min-height: 520px;
  }
}

.mobile-pane-tabs {
  display: none;
}

.mobile-pane-hidden {
  display: none !important;
}

@media (max-width: 680px) {
  .mobile-pane-tabs {
    position: sticky;
    z-index: 14;
    top: 0;
    min-height: 44px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    margin: 0 -8px 10px;
    padding: 0 8px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 12px rgba(30, 55, 90, 0.05);
  }

  .mobile-pane-tabs button {
    position: relative;
    min-width: 0;
    height: 44px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }

  .mobile-pane-tabs button::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 0;
    left: 8px;
    height: 2px;
    background: transparent;
  }

  .mobile-pane-tabs button.active {
    color: var(--accent);
  }

  .mobile-pane-tabs button.active::after {
    background: var(--accent);
  }

  .dashboard-v2 .financial-mobile-panes {
    z-index: 13;
    top: 42px;
    margin-top: -10px;
  }

  .dashboard-v2 .overview-command-bar {
    margin-bottom: 0;
  }

  .dashboard-v2 .overview-sentiment-band,
  .dashboard-v2 .overview-capitalization,
  .dashboard-v2 .overview-data-grid,
  .dashboard-v2 .financial-summary-band,
  .dashboard-v2 .financial-metrics,
  .dashboard-v2 .financial-signals,
  .dashboard-v2 .financial-charts,
  .dashboard-v2 .financial-table-panel,
  .dashboard-v2 .flow-metrics,
  .dashboard-v2 .flow-leaders,
  .dashboard-v2 .flow-main,
  .dashboard-v2 .strategy-metrics,
  .dashboard-v2 .strategy-overview,
  .dashboard-v2 .strategy-records {
    margin-bottom: 0;
  }

  .dashboard-v2 .overview-data-tabs {
    margin: 0;
    border-radius: 8px 8px 0 0;
  }

  .dashboard-v2 .overview-data-grid {
    height: calc(100dvh - 228px);
    min-height: 470px;
  }

  .dashboard-v2 .overview-table-panel {
    height: 100%;
    min-height: 0;
  }

  .overview-table,
  .overview-ladder-table {
    min-width: 100%;
  }

  .overview-table th:nth-child(5),
  .overview-table td:nth-child(5),
  .overview-table th:nth-child(6),
  .overview-table td:nth-child(6) {
    display: none;
  }

  .overview-table th:first-child,
  .overview-table td:first-child {
    width: 42px;
  }

  .overview-table th:nth-child(2),
  .overview-table td:nth-child(2) {
    width: auto;
  }

  .overview-table th:nth-child(3),
  .overview-table td:nth-child(3),
  .overview-table th:nth-child(4),
  .overview-table td:nth-child(4) {
    width: 72px;
  }

  .dashboard-v2 .financial-command-bar {
    margin-top: 0;
  }

  .financial-summary-band {
    grid-template-columns: 1fr;
  }

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

  .financial-dimension {
    min-height: 126px;
    padding: 12px;
    border-right: 1px solid var(--line);
  }

  .financial-dimension:nth-child(2n) {
    border-right: 0;
  }

  .financial-dimension strong {
    min-height: 0;
  }

  .financial-metrics {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .financial-metrics::-webkit-scrollbar,
  .strategy-metrics::-webkit-scrollbar,
  .flow-leader-list::-webkit-scrollbar {
    display: none;
  }

  .financial-metrics article {
    min-height: 96px;
    flex: 0 0 148px;
    scroll-snap-align: start;
    border-right: 1px solid var(--line) !important;
  }

  .financial-metrics article:last-child {
    border-right: 0 !important;
  }

  .financial-chart-wrap {
    height: 260px;
  }

  .financial-ranking-table {
    min-width: 100%;
    table-layout: fixed;
  }

  .financial-ranking-table th:nth-child(5),
  .financial-ranking-table td:nth-child(5),
  .financial-ranking-table th:nth-child(6),
  .financial-ranking-table td:nth-child(6) {
    display: none;
  }

  .financial-ranking-table th:first-child,
  .financial-ranking-table td:first-child {
    width: 42px;
  }

  .financial-ranking-table th:nth-child(2),
  .financial-ranking-table td:nth-child(2) {
    width: auto;
  }

  .financial-ranking-table th:nth-child(3),
  .financial-ranking-table td:nth-child(3),
  .financial-ranking-table th:nth-child(4),
  .financial-ranking-table td:nth-child(4) {
    width: 78px;
  }

  .dashboard-v2 .financial-ranking-wrap {
    height: calc(100dvh - 260px);
    min-height: 460px;
    max-height: none;
  }

  .dashboard-v2 .flow-main {
    min-height: 0;
    display: block;
  }

  .flow-command-controls {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 8px;
  }

  .flow-command-controls .segment-control {
    min-width: 0;
  }

  .flow-command-controls .segment-control button {
    min-width: 0;
    padding: 0 7px;
  }

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

  .flow-leaders-heading {
    gap: 8px;
  }

  .flow-leader-list {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .flow-leader-list li,
  .flow-leader-list li:nth-child(2n) {
    min-width: 142px;
    flex: 0 0 142px;
    scroll-snap-align: start;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .flow-ranking-panel {
    height: calc(100dvh - 420px);
    min-height: 390px;
    border-bottom: 0;
  }

  .flow-detail-panel {
    height: calc(100dvh - 124px);
    min-height: 620px;
  }

  .flow-detail-header {
    min-height: 112px;
    padding: 12px;
  }

  .flow-detail-tabs {
    flex: 0 0 44px;
  }

  .flow-member-panel {
    flex-basis: auto;
  }

  .flow-member-table,
  .flow-limit-table {
    min-width: 100%;
    table-layout: fixed;
  }

  .flow-member-table th:nth-child(n + 5),
  .flow-member-table td:nth-child(n + 5) {
    display: none;
  }

  .flow-member-table th:first-child,
  .flow-member-table td:first-child {
    width: 52px;
  }

  .flow-member-table th:nth-child(2),
  .flow-member-table td:nth-child(2) {
    width: auto;
  }

  .flow-member-table th:nth-child(3),
  .flow-member-table td:nth-child(3),
  .flow-member-table th:nth-child(4),
  .flow-member-table td:nth-child(4) {
    width: 68px;
  }

  .flow-limit-table th:nth-child(4),
  .flow-limit-table td:nth-child(4),
  .flow-limit-table th:nth-child(6),
  .flow-limit-table td:nth-child(6) {
    display: none;
  }

  .flow-limit-table th:first-child,
  .flow-limit-table td:first-child {
    width: 52px;
  }

  .flow-limit-table th:nth-child(2),
  .flow-limit-table td:nth-child(2) {
    width: auto;
  }

  .flow-limit-table th:nth-child(3),
  .flow-limit-table td:nth-child(3),
  .flow-limit-table th:nth-child(5),
  .flow-limit-table td:nth-child(5) {
    width: 82px;
  }

  .strategy-actions {
    gap: 8px;
  }

  .strategy-action-cluster {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .strategy-actions button,
  .strategy-maintenance-menu summary {
    min-height: 40px;
    font-size: 11px;
  }

  .strategy-metrics {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .strategy-metrics article {
    min-height: 96px;
    flex: 0 0 148px;
    scroll-snap-align: start;
    border-right: 1px solid var(--line) !important;
  }

  .strategy-metrics article:last-child {
    border-right: 0 !important;
  }

  .strategy-overview {
    display: block;
  }

  .strategy-equity-panel,
  .strategy-position-panel {
    border: 0;
  }

  .strategy-chart-wrap,
  .strategy-position-panel .strategy-table-wrap {
    height: calc(100dvh - 282px);
    min-height: 390px;
  }

  .strategy-records {
    min-height: calc(100dvh - 124px);
  }

  .strategy-records-toolbar {
    padding-top: 8px;
  }

  .strategy-tabs {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .strategy-tabs::-webkit-scrollbar {
    display: none;
  }

  .strategy-tabs button {
    min-width: max-content;
    flex: 0 0 auto;
  }
}

@media (max-width: 360px) {
  .dashboard-v2 .mode-switcher button {
    padding: 0 2px;
    font-size: 9px;
  }

  .mobile-pane-tabs button {
    padding: 0 5px;
    font-size: 11px;
  }

  .financial-dimension {
    padding: 10px;
  }

  .flow-command-controls {
    grid-template-columns: 1fr;
  }
}

/* Flow workspace controls */
.flow-command-controls {
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.flow-control-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.flow-control-group > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.flow-level-control {
  flex: 1 1 450px;
  justify-content: flex-end;
}

.flow-level-switcher {
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.flow-level-switcher::-webkit-scrollbar {
  display: none;
}

.flow-level-switcher button {
  min-width: 38px;
  flex: 0 0 auto;
}

#flow-direction-switcher button[data-flow-direction="inflow"].active {
  background: rgba(210, 76, 76, 0.1);
  color: var(--up);
}

#flow-direction-switcher button[data-flow-direction="outflow"].active {
  background: rgba(22, 139, 113, 0.1);
  color: var(--down);
}

.flow-detail-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.flow-detail-identity > div {
  min-width: 0;
}

.flow-detail-identity span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.flow-detail-back {
  width: 34px;
  height: 34px;
  display: none;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.flow-chart-toolbar:has(> span:only-child) {
  justify-content: flex-end;
  min-height: 30px;
}

@media (max-width: 1100px) {
  .flow-command-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .flow-command-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .flow-command-bar {
    gap: 10px;
  }

  .flow-command-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .flow-control-group {
    display: grid;
    align-content: start;
    gap: 4px;
  }

  .flow-control-group > span {
    padding-left: 2px;
  }

  .flow-control-group .segment-control {
    width: 100%;
  }

  .flow-level-control {
    grid-column: 1 / -1;
  }

  .flow-level-switcher {
    display: flex;
  }

  .flow-level-switcher button {
    min-width: 42px !important;
    padding: 0 8px !important;
  }

  .flow-metrics {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .flow-metrics::-webkit-scrollbar {
    display: none;
  }

  .flow-metrics article {
    min-height: 66px;
    flex: 0 0 158px;
    scroll-snap-align: start;
    border-right: 1px solid var(--line) !important;
  }

  .flow-metrics article:last-child {
    border-right: 0 !important;
  }

  .flow-leaders-heading {
    align-items: center;
    flex-direction: row;
  }

  .flow-leaders-heading .segment-control {
    width: auto;
    flex: 0 0 auto;
  }

  .flow-ranking-panel {
    height: calc(100dvh - 390px);
    min-height: 410px;
  }

  .flow-detail-panel {
    height: calc(100dvh - 112px);
    min-height: 560px;
  }

  .flow-detail-header {
    min-height: 82px;
    align-items: center !important;
    flex-direction: row !important;
    padding: 10px 12px;
  }

  .flow-detail-back {
    display: inline-grid;
  }

  .flow-selected-values {
    margin-left: auto;
    gap: 12px;
    text-align: right;
  }

  .flow-chart-toolbar {
    min-height: 30px;
    align-items: center !important;
    flex-direction: row !important;
    padding: 0 12px 6px;
  }
}

@media (max-width: 360px) {
  .flow-command-controls {
    grid-template-columns: 1fr;
  }

  .flow-level-control {
    grid-column: auto;
  }
}

/* Android WebView uses a bottom workspace bar and a quieter top app bar. */
@media (max-width: 680px) {
  .android-app {
    overflow: hidden;
    padding-bottom: calc(58px + env(safe-area-inset-bottom));
  }

  .android-app .topbar {
    position: sticky;
    z-index: 45;
    top: 0;
    height: 52px;
    padding: 0 10px;
  }

  .android-app .brand-area {
    min-width: 0;
    flex: 1;
  }

  .android-app .brand-area > div {
    min-width: 0;
    display: block;
  }

  .android-app .topbar h1 {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .android-app .topbar p {
    display: none;
  }

  .android-app:not([data-workspace-mode="market"]) #watchlist-toggle {
    display: none;
  }

  .android-app .mode-switcher {
    position: fixed;
    z-index: 60;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(58px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 0 4px env(safe-area-inset-bottom);
    border: 0;
    border-top: 1px solid #314158;
    border-radius: 0;
    background: #101d31;
    box-shadow: 0 -6px 18px rgba(15, 29, 49, 0.16);
  }

  .android-app .mode-switcher button {
    min-width: 0;
    height: 57px;
    padding: 0 2px;
    border-radius: 0;
    background: transparent;
    color: #9fb0c6;
    font-size: 11px;
    font-weight: 650;
  }

  .android-app .mode-switcher button.active {
    border-top: 2px solid #68a0ff;
    background: rgba(47, 111, 237, 0.12);
    color: #ffffff;
  }

  .android-app .workspace,
  .android-app .overview-workspace,
  .android-app .financial-workspace,
  .android-app .flow-workspace,
  .android-app .strategy-workspace {
    height: calc(100dvh - 110px - env(safe-area-inset-bottom));
  }

  .android-app .overview-workspace,
  .android-app .financial-workspace,
  .android-app .flow-workspace,
  .android-app .strategy-workspace {
    padding-bottom: 8px;
  }

  .android-app .toast {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

/* Android portrait density: keep filters usable while prioritizing the ranking. */
@media (max-width: 680px) {
  .android-app .mobile-pane-tabs[data-mobile-pane-nav="flow"] {
    min-height: 36px;
    margin-bottom: 6px;
  }

  .android-app .mobile-pane-tabs[data-mobile-pane-nav="flow"] button {
    height: 36px;
    font-size: 11px;
  }

  .android-app .flow-command-bar {
    gap: 6px;
    padding: 8px 10px;
  }

  .android-app .flow-command-bar > div:first-child {
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .android-app .flow-command-bar h2 {
    flex: 0 0 auto;
    font-size: 17px;
  }

  .android-app .flow-command-bar p {
    min-width: 0;
    overflow: hidden;
    margin: 0;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .android-app .flow-command-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .android-app .flow-control-group {
    gap: 3px;
  }

  .android-app .flow-control-group:not(.flow-level-control) > span {
    display: none;
  }

  .android-app .flow-control-group > span {
    padding-left: 1px;
    font-size: 9px;
  }

  .android-app .flow-control-group .segment-control {
    min-width: 0;
    width: 100%;
    padding: 2px;
  }

  .android-app .flow-control-group .segment-control button {
    min-width: 0;
    height: 27px;
    padding: 0 2px;
    font-size: 10px;
  }

  .android-app .flow-level-control {
    grid-column: 1 / -1;
    gap: 3px;
    grid-template-columns: minmax(0, 1fr);
    justify-content: normal;
  }

  .android-app .flow-level-switcher {
    width: 100%;
    overflow: visible;
  }

  .android-app .flow-level-switcher button {
    min-width: 0 !important;
    flex: 1 1 0;
    padding: 0 1px !important;
    font-size: 9px !important;
  }

  .android-app.dashboard-v2 .flow-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    margin-bottom: 6px;
  }

  .android-app .flow-metrics article {
    display: none;
  }

  .android-app .flow-metrics article:nth-child(2),
  .android-app .flow-metrics article:nth-child(3) {
    min-height: 52px;
    display: block;
    padding: 7px 10px;
    border-right: 1px solid var(--line) !important;
  }

  .android-app .flow-metrics article:nth-child(3) {
    border-right: 0 !important;
  }

  .android-app .flow-metrics span {
    font-size: 9px;
  }

  .android-app .flow-metrics strong {
    margin-top: 3px;
    font-size: 12px;
  }

  .android-app.dashboard-v2 .flow-leaders {
    margin-bottom: 6px;
  }

  .android-app .flow-leaders-heading {
    min-height: 38px;
    align-items: center;
    flex-direction: row;
    gap: 6px;
    padding: 4px 8px;
  }

  .android-app .flow-leaders-heading > div:first-child {
    min-width: 0;
  }

  .android-app .flow-leaders-heading h3 {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .android-app .flow-leaders-heading > div:first-child > span {
    display: none;
  }

  .android-app .flow-leaders-actions {
    margin-left: auto;
    gap: 4px;
  }

  .android-app .flow-leaders-heading .segment-control {
    width: auto;
    flex: 0 0 auto;
  }

  .android-app .flow-leaders-heading .segment-control button {
    min-width: 42px;
    height: 28px;
    padding: 0 7px;
    font-size: 10px;
  }

  .android-app .flow-leaders-toggle {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface);
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
  }

  .android-app .flow-leaders.collapsed .flow-leader-list {
    display: none;
  }

  .android-app .flow-leader-list li,
  .android-app .flow-leader-list li:nth-child(2n) {
    min-width: 132px;
    flex-basis: 132px;
    padding: 6px 8px;
  }

  .android-app .flow-ranking-panel {
    height: calc(100dvh - 350px);
    min-height: 440px;
  }

  .android-app .flow-ranking-toolbar {
    min-height: 46px;
    align-items: center;
    padding: 7px 9px;
  }

  .android-app .flow-ranking-toolbar h3 {
    font-size: 13px;
  }

  .android-app .flow-ranking-toolbar span {
    margin-top: 1px;
    font-size: 9px;
  }

  .android-app #flow-search {
    width: 116px;
    height: 28px;
    font-size: 10px;
  }

  .android-app .flow-table {
    font-size: 10px;
  }

  .android-app .flow-table th,
  .android-app .flow-table td {
    padding: 6px;
  }

  .android-app .flow-table th:first-child,
  .android-app .flow-table td:first-child {
    width: 31%;
  }

  .android-app .flow-table th:nth-child(2),
  .android-app .flow-table td:nth-child(2) {
    width: 22%;
  }

  .android-app .flow-table th:nth-child(3),
  .android-app .flow-table td:nth-child(3) {
    width: 27%;
  }

  .android-app .flow-table th:nth-child(4),
  .android-app .flow-table td:nth-child(4) {
    width: 20%;
  }

  .android-app .flow-sparkline {
    height: 24px;
  }

  .android-app .flow-detail-header {
    min-height: 68px;
    gap: 8px;
    padding: 8px 9px;
  }

  .android-app .flow-detail-header h3 {
    font-size: 15px;
  }

  .android-app .flow-detail-identity {
    gap: 6px;
  }

  .android-app .flow-detail-identity span {
    overflow: hidden;
    margin-top: 2px;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .android-app .flow-selected-values {
    gap: 8px;
  }

  .android-app .flow-selected-values span {
    font-size: 9px;
  }

  .android-app .flow-selected-values strong {
    margin-top: 2px;
    font-size: 12px;
  }

  .android-app .flow-detail-tabs {
    min-height: 38px;
    flex-basis: 38px;
    gap: 15px;
    padding: 0 9px;
  }

  .android-app .flow-detail-tabs button {
    height: 37px;
    font-size: 10px;
  }
}
