:root {
  --bg: #eef0e8;
  --ink: #121511;
  --muted: #60675d;
  --line: #cbd0c4;
  --panel: #fbfcf6;
  --accent: #1f6b57;
  --blue: #126df3;
  --blue-dark: #0c56c9;
  --green: #088a55;
  --red: #d9444f;
  --buy-pin: #ffd400;
  --sell-pin: #00d4ff;
  --amber: #f5a400;
  --warn: #a33d2f;
  --topbar: #182019;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 21, 17, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 21, 17, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 28px;
  color: #f7f8ef;
  background: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(247, 248, 239, 0.12);
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar .kicker {
  color: #83c7a1;
  margin-bottom: 4px;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1;
}

h2 {
  font-size: 28px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

nav a {
  color: #f7f8ef;
  text-decoration: none;
  border: 1px solid rgba(247, 248, 239, 0.18);
  border-radius: 6px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

nav a:hover {
  background: rgba(131, 199, 161, 0.18);
  border-color: rgba(131, 199, 161, 0.55);
}

nav a.active {
  background: rgba(131, 199, 161, 0.22);
  border-color: rgba(131, 199, 161, 0.65);
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 18px;
}

.band {
  background: rgba(251, 252, 246, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 18px 45px rgba(18, 21, 17, 0.08);
}

.top-band {
  min-height: 220px;
}

.page-view {
  display: none;
}

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

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.actions,
.quote-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

button,
input {
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button {
  padding: 0 14px;
  cursor: pointer;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

input {
  width: 110px;
  padding: 0 10px;
}

.instrument-search {
  width: 180px;
}

select {
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 10px;
  font: inherit;
}

.plan-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.plan-form input,
.plan-form select {
  width: 100%;
}

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

.metrics article,
.stress-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  min-height: 92px;
}

.metrics span,
.stress-summary span {
  color: var(--muted);
  font-size: 12px;
}

.metrics strong,
.stress-summary strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
  line-height: 1.1;
}

.metrics strong span {
  font: inherit;
}

.portfolio-tools {
  position: relative;
  z-index: 20;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.symbol-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 4px;
}

.symbol-pill {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.symbol-pill.active {
  color: var(--ink);
  border-color: rgba(31, 107, 87, 0.42);
  background: rgba(31, 107, 87, 0.08);
}

.symbol-pill input {
  width: auto;
  height: auto;
  margin: 0;
}

.benchmark-picker {
  display: flex;
  gap: 8px;
}

.portfolio-review {
  padding: 16px;
}

.subhead {
  margin: 18px 0 10px;
  font-size: 18px;
}

.notice {
  min-height: 22px;
  color: var(--warn);
  margin-bottom: 12px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline article {
  border-left: 4px solid var(--accent);
  background: #fff;
  padding: 12px 14px;
}

.timeline span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  color: var(--muted);
  background: #f5f6ef;
  font-size: 12px;
}

tr:last-child td {
  border-bottom: 0;
}

.linkish {
  height: auto;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  font-weight: 800;
}

.linkish:hover {
  color: var(--warn);
  background: transparent;
}

.trade-detail {
  min-width: 0;
}

.instrument-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.status-tab {
  min-width: 118px;
  background: #fff;
  color: var(--blue);
  border: 0;
  border-radius: 6px 6px 0 0;
  font-weight: 800;
}

.status-tab.active {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 -3px 0 var(--blue);
}

.strategy-list {
  display: grid;
  gap: 14px;
}

.strategy-card {
  border: 1px solid #cfd5dc;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(18, 21, 17, 0.08);
}

.strategy-title {
  width: 100%;
  height: auto;
  min-height: 48px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  background: var(--blue);
  border: 0;
  border-radius: 0;
  text-align: left;
  font-size: 18px;
  font-weight: 800;
}

.strategy-title:hover {
  background: var(--blue-dark);
}

.strategy-title span,
.strategy-title small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-title small {
  font-size: 12px;
  opacity: 0.85;
}

.strategy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 0;
}

.strategy-actions button {
  height: 30px;
  padding: 0 10px;
  color: #fff;
  background: #1e2429;
  border-color: #1e2429;
  font-size: 12px;
}

.strategy-actions button.active {
  background: var(--blue);
  border-color: var(--blue);
}

.strategy-actions button[data-panel="trades"] {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1300;
}

.strategy-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px;
}

.strategy-kpis article,
.summary-chips article {
  min-width: 0;
  padding: 9px 10px;
  background: #f7f9fb;
  border: 1px solid #e4e8ed;
  border-radius: 4px;
}

.strategy-kpis span,
.summary-chips span {
  display: block;
  color: #5d6770;
  font-size: 12px;
  font-weight: 700;
}

.strategy-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 19px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.strategy-kpis em {
  display: block;
  margin-top: 5px;
  color: #6b737c;
  font-size: 12px;
  font-style: normal;
}

.quote-strip {
  padding: 12px 16px;
  display: grid;
  gap: 4px;
  background: #e9edf1;
  border-top: 1px solid #d8dde3;
  border-bottom: 1px solid #d8dde3;
}

.quote-strip div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.quote-strip strong {
  color: var(--red);
  font-size: 30px;
  line-height: 1;
}

.quote-strip em {
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.quote-strip span {
  color: #69737d;
  font-size: 12px;
}

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

.summary-chips strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.strategy-expanded {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 12px 12px;
}

.strategy-expanded .table-wrap,
.strategy-expanded .mini-plan-summary {
  grid-column: 1 / -1;
}

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

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

.instrument-hero {
  align-items: center;
  margin-bottom: 14px;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.instrument-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.instrument-metrics article {
  min-height: 78px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.instrument-metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.instrument-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.symbol-plan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  min-width: 0;
}

.mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.mini-head span,
.mini-plan-summary {
  color: var(--muted);
  font-size: 12px;
}

.mini-head strong {
  font-size: 12px;
}

.mini-plan-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.chart {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.chart.small {
  margin-bottom: 14px;
}

.chart-dark {
  border-color: #222;
  background: #050505;
  color: #eff5ef;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  padding: 20px;
}

.chart-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  gap: 18px;
}

.chart-main {
  min-width: 0;
}

.chart-stats {
  display: grid;
  gap: 8px;
}

.chart-stats article {
  border: 2px solid rgba(255, 255, 255, 0.72);
  background: rgba(10, 10, 10, 0.92);
  padding: 10px 8px 12px;
  text-align: center;
}

.chart-stats article.gain {
  border-color: rgba(255, 50, 50, 0.9);
  background: linear-gradient(180deg, rgba(90, 8, 8, 0.58), rgba(10, 10, 10, 0.92));
}

.chart-stats article.loss {
  border-color: rgba(0, 230, 118, 0.9);
  background: linear-gradient(180deg, rgba(0, 66, 34, 0.62), rgba(10, 10, 10, 0.92));
}

.chart-stats span {
  display: block;
  color: #d4dbcf;
  font-size: 11px;
  font-weight: 700;
}

.chart-stats strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 19px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.chart-stats article.gain strong {
  color: #ff3232;
}

.chart-stats article.loss strong {
  color: #00e676;
}

.review-title {
  margin-bottom: 12px;
  color: #f3f7ef;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
}

.review-title::before {
  content: "【网格波段】 ";
  color: #f3f7ef;
}

.review-title::after {
  content: " 复盘足迹";
  color: #8bd2ff;
}

.chart-title {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.chart-dark .chart-title {
  color: #d8ded4;
}

svg {
  display: block;
  width: 100%;
  height: 220px;
}

.chart-dark svg {
  height: 560px;
}

svg line {
  stroke: #d8ddd1;
}

svg polyline {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-dark svg line {
  stroke: rgba(255, 255, 255, 0.16);
}

.chart-dark svg polyline {
  stroke: #c5c22a;
  stroke-width: 2.5;
}

svg text {
  fill: var(--muted);
  font-size: 12px;
}

.chart-dark svg text {
  fill: #cfd6cc;
}

.grid-line {
  stroke-dasharray: 1 3;
}

.y-axis-label {
  font-size: 12px;
}

.x-axis-label {
  font-size: 11px;
}

svg circle {
  stroke: #fff;
  stroke-width: 2;
}

.buy-marker {
  fill: var(--buy-pin);
}

.sell-marker {
  fill: var(--sell-pin);
}

.trade-flag {
  font-size: 13px;
  font-weight: 800;
}

.buy-text {
  fill: var(--buy-pin);
}

.sell-text {
  fill: var(--sell-pin);
}

.reference-line {
  stroke: #ef4444;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.reference-label {
  fill: #ff8b8b;
  font-size: 11px;
}

.review-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: #9ca9a0;
  font-size: 12px;
}

.review-toolbar button {
  height: 26px;
  padding: 0 9px;
  border-color: rgba(255, 255, 255, 0.3);
  background: #101312;
  color: #e7efe9;
  font-size: 12px;
}

.review-toolbar button.active {
  background: #e5e7eb;
  color: #080808;
  border-color: #e5e7eb;
}

.chart-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #030303;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: none;
  min-width: 138px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(2, 6, 8, 0.92);
  color: #f6fff7;
  font-size: 11px;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}

.chart-tooltip.show {
  display: grid;
  gap: 2px;
}

.chart-tooltip strong {
  color: #fff;
  font-size: 12px;
}

.review-candle line {
  stroke-width: 1.2;
}

.review-candle rect {
  stroke-width: 1;
  transition: opacity 0.12s ease, filter 0.12s ease;
}

.review-candle.up line,
.review-candle.up rect {
  stroke: #ff3b30;
}

.review-candle.up rect {
  fill: rgba(255, 59, 48, 0.68);
}

.review-candle.down line,
.review-candle.down rect {
  stroke: #00f060;
}

.review-candle.down rect {
  fill: rgba(0, 240, 96, 0.55);
}

.review-candle:hover rect {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

.trade-pin line {
  stroke-width: 1.2;
  opacity: 0.72;
}

.trade-pin circle {
  stroke: #050505;
  stroke-width: 2;
}

.trade-pin text {
  fill: #fff;
  font-size: 12px;
  font-weight: 900;
}

.buy-pin line,
.buy-pin circle {
  stroke: var(--buy-pin);
  fill: var(--buy-pin);
}

.sell-pin line,
.sell-pin circle {
  stroke: var(--sell-pin);
  fill: var(--sell-pin);
}

.buy-pin text,
.sell-pin text {
  fill: #020202;
}

.trade-pin {
  cursor: pointer;
}

.trade-pin:hover circle {
  filter: drop-shadow(0 0 9px currentColor);
}

.buy-dot {
  background: var(--buy-pin);
}

.sell-dot {
  background: var(--sell-pin);
}

.compare-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.compare-head strong {
  color: var(--ink);
  font-size: 16px;
}

.compare-head i {
  width: 22px;
  height: 3px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.strategy-line {
  background: var(--red);
}

.benchmark-line {
  background: #2f74ff;
}

.compare-chart {
  height: 380px;
}

.strategy-path {
  stroke: var(--red);
  stroke-width: 3;
}

.benchmark-path {
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
}

.zero-line {
  stroke: rgba(18, 21, 17, 0.32);
  stroke-dasharray: 5 4;
}

.crosshair-x,
.crosshair-y {
  stroke: rgba(255, 255, 255, 0.62);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  pointer-events: none;
}

.chart-loading {
  min-height: 560px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cdd6ce;
}

.marker-legend {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  color: #d7ddd4;
  font-size: 12px;
  justify-content: center;
}

.marker-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: auto;
  background: rgba(5, 7, 6, 0.78);
}

.review-modal {
  width: min(1380px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #080a09;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  color: #eff5ef;
  background: rgba(8, 10, 9, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.modal-head span {
  display: block;
  color: #8bd2ff;
  font-size: 12px;
  font-weight: 800;
}

.modal-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.modal-close {
  background: #e5e7eb;
  color: #070707;
  border-color: #e5e7eb;
}

.review-modal .review-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.review-modal .chart-dark svg {
  height: min(68vh, 720px);
}

.buy-dot,
.sell-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.buy-dot {
  background: var(--buy-pin);
}

.sell-dot {
  background: var(--sell-pin);
}

.detail-head {
  margin-bottom: 12px;
}

.detail-head p,
.empty {
  color: var(--muted);
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 16px;
  }

  .metrics,
  .stress-summary,
  .instrument-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .instrument-grid,
  .strategy-expanded,
  .chart-with-sidebar {
    grid-template-columns: 1fr;
  }

  .portfolio-tools {
    grid-template-columns: 1fr;
  }

  .strategy-kpis,
  .summary-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .plan-form {
    grid-template-columns: 1fr 1fr;
  }

  .instrument-search {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .metrics,
  .stress-summary,
  .instrument-metrics,
  .strategy-kpis,
  .summary-chips {
    grid-template-columns: 1fr;
  }

  .plan-form {
    grid-template-columns: 1fr;
  }
}

/* Trading dashboard refresh */
:root {
  --bg: #f4f6fb;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe2ee;
  --panel: #ffffff;
  --accent: #1d4ed8;
  --blue: #2563eb;
  --blue-dark: #1e3a8a;
  --green: #059669;
  --red: #dc2626;
  --amber: #f59e0b;
  --warn: #f97316;
  --topbar: #07111f;
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius-card: 12px;
  --radius-control: 8px;
}

body {
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.08), transparent 260px),
    var(--bg);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 248px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 28px;
  color: #e5edf8;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.18), transparent 38%),
    #07111f;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  border-bottom: 0;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.32);
}

.topbar .kicker {
  color: #93c5fd;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

nav {
  display: grid;
  gap: 8px;
  justify-content: stretch;
}

nav a {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #cbd5e1;
  background: transparent;
  font-size: 14px;
}

nav a:hover,
nav a.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(147, 197, 253, 0.2);
}

main {
  grid-column: 2;
  max-width: none;
  width: 100%;
  min-width: 0;
  padding: 24px;
  gap: 18px;
}

.statusbar {
  position: sticky;
  top: 0;
  z-index: 12;
  min-height: 72px;
  margin: -24px -24px 18px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(244, 246, 251, 0.92);
  border-bottom: 1px solid rgba(219, 226, 238, 0.86);
  backdrop-filter: blur(18px);
}

.statusbar strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-actions span {
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.band {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 226, 238, 0.95);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.top-band {
  min-height: auto;
}

.section-head {
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.kicker {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
}

button,
input,
select {
  height: 40px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line);
  font-size: 14px;
}

input,
select {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

input:focus,
select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.62);
}

button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

button:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.icon-button {
  width: 40px;
  border-radius: 50%;
  background: #fff;
  color: var(--blue-dark);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.status-tab,
.strategy-actions button,
.benchmark-picker button,
#manual-quote,
#instrument-refresh-quotes,
#run-custom-shock {
  background: #fff;
  color: var(--blue-dark);
  border-color: var(--line);
  box-shadow: none;
}

.status-tab:hover,
.strategy-actions button:hover,
.benchmark-picker button:hover,
#manual-quote:hover,
#instrument-refresh-quotes:hover,
#run-custom-shock:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.strategy-actions button.active,
.status-tab.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.strategy-actions button[data-panel="trades"],
.actions button[data-shock] {
  color: #8a3b00;
  background: #fff7ed;
  border-color: #fed7aa;
}

.metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.metrics article,
.stress-summary article,
.instrument-metrics article,
.strategy-kpis article,
.summary-chips article,
.symbol-plan-card,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.metrics article {
  min-height: 112px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.metrics article::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -34px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.08);
}

.metrics strong,
.stress-summary strong {
  font-size: 24px;
  letter-spacing: 0;
}

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

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

.portfolio-tools {
  grid-template-columns: minmax(0, 1fr);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f8fafc;
  position: relative;
}

.portfolio-tools .benchmark-picker {
  display: none;
}

.portfolio-profile-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 12px;
  align-items: center;
}

.profile-dropdown,
.benchmark-dropdown {
  position: relative;
}

.profile-select-button,
.benchmark-select-button,
.portfolio-picker-toggle {
  height: 36px;
  width: 100%;
  white-space: nowrap;
  border-radius: 10px;
  background: #fff;
  color: var(--blue-dark);
  border-color: var(--line);
  box-shadow: none;
  justify-content: space-between;
  display: flex;
  align-items: center;
  gap: 12px;
}

.portfolio-picker-toggle.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.profile-select-button em,
.benchmark-select-button span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.benchmark-select-button {
  height: auto;
  min-height: 38px;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.benchmark-select-button strong {
  max-width: 280px;
  color: var(--blue-dark);
  font-size: 13px;
  line-height: 1.3;
  white-space: normal;
}

.profile-menu,
.benchmark-multi {
  position: absolute;
  z-index: 16;
  top: calc(100% + 8px);
  left: 0;
  display: none;
  min-width: 230px;
  padding: 8px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.16);
}

.profile-dropdown.open .profile-menu,
.benchmark-dropdown.open .benchmark-multi {
  display: grid;
}

.profile-menu {
  gap: 6px;
}

.profile-menu button {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  border-color: transparent;
  box-shadow: none;
}

.profile-menu button.active {
  color: var(--blue-dark);
  background: #eff6ff;
}

.profile-menu button.ghost {
  color: var(--muted);
  border-color: var(--line);
}

.profile-name {
  display: grid;
  gap: 4px;
}

.profile-name span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.profile-name input {
  width: 100%;
  height: 36px;
  font-weight: 800;
}

.portfolio-picker {
  display: none;
  position: absolute;
  z-index: 15;
  top: calc(100% + 10px);
  right: 14px;
  width: min(760px, calc(100% - 28px));
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.portfolio-picker.open {
  display: block;
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.picker-head strong {
  font-size: 14px;
}

.picker-head div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.picker-head button {
  height: 32px;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--blue-dark);
  border-color: var(--line);
  box-shadow: none;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.symbol-pill {
  min-height: 42px;
  height: auto;
  justify-content: flex-start;
  border-radius: 10px;
  background: #fff;
}

.symbol-pill em {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbol-pill.active {
  color: var(--blue-dark);
  border-color: #93c5fd;
  background: #eff6ff;
}

.chart {
  border-radius: var(--radius-card);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.portfolio-review {
  padding: 18px;
}

.compare-head {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) auto minmax(300px, 1.4fr);
  align-items: start;
  gap: 14px;
  padding: 2px 2px 12px;
}

.compare-head > div:first-child {
  display: grid;
  gap: 4px;
}

.compare-head small {
  color: var(--muted);
  font-size: 12px;
}

.chart-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.chart-tools button {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #fff;
  border-color: var(--line);
  box-shadow: none;
}

.benchmark-multi {
  grid-template-columns: 1fr;
  gap: 8px;
  right: 0;
  left: auto;
}

.benchmark-multi label {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.benchmark-multi label.active {
  color: var(--blue-dark);
  border-color: #93c5fd;
  background: #eff6ff;
}

.benchmark-multi input {
  width: auto;
  height: auto;
  margin: 0;
}

.compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compare-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.compare-legend i {
  width: 22px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

.compare-stage {
  position: relative;
}

.compare-point {
  fill: #fff;
  stroke: var(--red);
  stroke-width: 2;
  cursor: crosshair;
  opacity: 0.82;
}

.compare-point:hover {
  fill: var(--red);
  filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.35));
}

.annual-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.annual-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.annual-head h3 {
  font-size: 20px;
}

.annual-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.annual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.annual-card {
  min-height: 160px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.annual-card.gain {
  border-color: rgba(220, 38, 38, 0.24);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.92), #fff);
  color: var(--ink) !important;
}

.annual-card.loss {
  border-color: rgba(5, 150, 105, 0.24);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.92), #fff);
  color: var(--ink) !important;
}

.annual-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.annual-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.annual-card strong {
  font-size: 28px;
  line-height: 1;
}

.annual-card.gain strong {
  color: var(--red);
}

.annual-card.loss strong {
  color: var(--green);
}

.annual-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 12px;
  margin: 0;
  font-size: 13px;
}

.annual-card dt {
  color: var(--muted);
  font-weight: 800;
}

.annual-card dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
}

.instrument-tabs {
  margin-bottom: 16px;
  padding-bottom: 0;
  border: 0;
}

.status-tab {
  min-width: auto;
  height: 36px;
  border-radius: 999px;
  padding: 0 14px;
}

.quote-form,
.actions,
.benchmark-picker {
  align-items: center;
}

.quote-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(90px, 0.7fr) minmax(110px, 0.8fr) auto auto;
}

.quote-form input {
  width: 100%;
}

.strategy-list {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  align-items: start;
}

.strategy-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.strategy-card.expanded {
  position: fixed;
  inset: 24px 28px 24px 276px;
  z-index: 35;
  max-height: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-column: auto;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.35);
}

.strategy-title {
  min-height: 58px;
  padding: 14px 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.strategy-name {
  display: grid;
  gap: 6px;
  overflow: visible;
  white-space: normal;
}

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

.title-quote {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.title-quote b {
  color: var(--ink);
  font-size: 16px;
}

.title-quote i {
  font-style: normal;
  font-weight: 900;
}

.title-quote small {
  height: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.strategy-title .title-quote small {
  height: auto;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
  overflow: visible;
}

.strategy-title:hover {
  color: var(--blue-dark);
  background: #f8fbff;
}

.strategy-title small {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #eff6ff;
  opacity: 1;
}

.strategy-actions {
  padding: 12px 14px 0;
}

.strategy-actions button {
  height: 32px;
  border-radius: 999px;
}

.strategy-kpis,
.summary-chips {
  gap: 10px;
  padding: 12px 14px;
}

.strategy-kpis article,
.summary-chips article {
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
}

.strategy-kpis strong {
  font-size: 20px;
}

.quote-strip {
  display: none;
}

.quote-strip strong {
  color: var(--ink);
  font-size: 28px;
}

.strategy-expanded {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 14px 20px;
  scroll-behavior: auto;
}

.chart-dark {
  border-color: #111827;
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.12), transparent 36%),
    #05070b;
}

.chart-stats article {
  border-radius: 10px;
}

.chart-stats article.gain {
  border-color: rgba(220, 38, 38, 0.82);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.6), rgba(3, 7, 18, 0.92));
}

.chart-stats article.loss {
  border-color: rgba(5, 150, 105, 0.82);
  background: linear-gradient(180deg, rgba(6, 78, 59, 0.58), rgba(3, 7, 18, 0.92));
}

.chart-stats article.gain strong {
  color: #f87171;
}

.chart-stats article.loss strong {
  color: #34d399;
}

.plan-form {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #f8fafc;
}

.plan-form button {
  min-width: 140px;
}

#stress .actions {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

#stress-result .stress-summary article:last-child,
#plan-result .stress-summary article:last-child {
  border-color: #fed7aa;
  background: #fff7ed;
}

#trade-entry.page-view {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  z-index: 40;
  width: min(480px, calc(100vw - 24px));
  height: auto;
  max-height: 88vh;
  padding: 22px;
  overflow: auto;
  transform: translate(70vw, -50%) scale(0.96);
  transition: transform 0.22s ease;
  border-radius: 16px;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.32);
}

#trade-entry.page-view.active {
  transform: translate(-50%, -50%) scale(1);
}

#trade-entry .section-head {
  align-items: center;
}

#trade-entry .plan-form {
  grid-template-columns: 1fr;
  background: transparent;
  border: 0;
  padding: 0;
}

#trade-entry-result {
  padding: 12px;
  border-radius: 10px;
  background: #fff7ed;
}

th {
  background: #f8fafc;
}

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

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

  .portfolio-profile-bar,
  .compare-head {
    grid-template-columns: 1fr;
  }

  .benchmark-multi,
  .chart-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    width: auto;
    padding: 16px;
  }

  main {
    grid-column: 1;
    padding: 16px;
  }

  .statusbar {
    position: static;
    margin: -16px -16px 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .portfolio-tools,
  .quote-form,
  .plan-form {
    grid-template-columns: 1fr;
  }

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

  .strategy-card.expanded {
    inset: 4vh 16px auto 16px;
  }
}

@media (max-width: 620px) {
  .metrics,
  .stress-summary,
  .strategy-kpis,
  .summary-chips {
    grid-template-columns: 1fr;
  }

  #stress .actions {
    border-radius: var(--radius-card);
  }
}

/* Apple-inspired refinement pass */
:root {
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --panel: rgba(255, 255, 255, 0.86);
  --accent: #0071e3;
  --blue: #0071e3;
  --blue-dark: #005bb5;
  --green: #248a3d;
  --red: #d70015;
  --amber: #bf6a02;
  --shadow-card: 0 18px 48px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.055);
  --radius-card: 18px;
  --radius-control: 12px;
}

body {
  background:
    radial-gradient(circle at 72% 0%, rgba(0, 113, 227, 0.12), transparent 28%),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 42%, #f1f3f6 100%);
}

.topbar {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(22px);
}

.brand-mark {
  background: linear-gradient(135deg, #0071e3, #5ac8fa);
  box-shadow: 0 14px 34px rgba(0, 113, 227, 0.24);
}

.topbar .kicker,
.kicker {
  color: #0071e3;
}

nav a {
  color: #424245;
  background: transparent;
}

nav a:hover,
nav a.active {
  color: #06c;
  background: rgba(0, 113, 227, 0.08);
  border-color: rgba(0, 113, 227, 0.12);
}

.statusbar {
  background: rgba(245, 245, 247, 0.82);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.band,
.metrics article,
.portfolio-tools,
.annual-panel,
.chart,
.strategy-card {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

button {
  border-radius: 999px;
  background: #0071e3;
  border-color: #0071e3;
  box-shadow: none;
}

button:hover {
  background: #0077ed;
  border-color: #0077ed;
}

input,
select,
.profile-select-button,
.benchmark-select-button,
.portfolio-picker-toggle {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.portfolio-profile-bar {
  grid-template-columns: minmax(260px, 1fr) minmax(200px, 240px) auto;
  align-items: center;
  gap: 12px;
  padding: 4px;
}

.portfolio-current {
  min-height: 62px;
  display: grid;
  gap: 3px;
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.08), rgba(255, 255, 255, 0.68));
  border: 1px solid rgba(0, 113, 227, 0.12);
}

.portfolio-current span,
.portfolio-current em,
.picker-head span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.portfolio-current strong {
  font-size: 18px;
  line-height: 1.15;
}

.profile-select-button,
.portfolio-picker-toggle {
  height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 800;
}

.profile-select-button::after,
.portfolio-picker-toggle::after,
.benchmark-select-button::after {
  content: "⌄";
  color: var(--muted);
  font-size: 16px;
}

.profile-dropdown.open .profile-select-button::after,
.benchmark-dropdown.open .benchmark-select-button::after {
  content: "⌃";
}

.profile-select-button em {
  color: var(--muted);
  font-size: 12px;
}

.profile-menu,
.benchmark-multi {
  min-width: 280px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(28px);
  color: var(--ink);
}

.profile-menu button,
.benchmark-multi label {
  min-height: 40px;
  border-radius: 12px;
  border-color: transparent;
}

.portfolio-picker {
  position: fixed !important;
  top: 50% !important;
  left: 50vw !important;
  right: auto !important;
  width: min(760px, calc(100vw - 48px)) !important;
  max-height: min(78vh, 720px);
  display: none;
  transform: translate(-50%, -50%) !important;
  padding: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(30px);
  overflow: hidden;
  z-index: 70 !important;
}

.portfolio-picker.open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.picker-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  align-items: center;
  gap: 12px;
}

.picker-head strong {
  font-size: 18px;
}

.picker-head > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.picker-profile-name {
  width: 180px;
  height: 36px;
  border-radius: 999px;
  font-weight: 800;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  max-height: none;
  min-height: 0;
  padding: 14px 2px 2px;
  overflow: auto;
}

.symbol-pill {
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 14px;
  border-color: rgba(0, 0, 0, 0.08);
}

.symbol-pill.active,
.benchmark-multi label.active,
.profile-menu button.active {
  color: #06c;
  background: rgba(0, 113, 227, 0.09);
  border-color: rgba(0, 113, 227, 0.14);
}

.benchmark-dropdown {
  justify-self: end;
  min-width: 230px;
  position: relative;
  z-index: 56;
}

.benchmark-select-button {
  min-height: 46px;
  padding: 9px 14px;
  border-radius: 14px;
}

.benchmark-select-button strong {
  color: var(--ink);
  font-weight: 800;
}

.benchmark-multi {
  right: 0;
  left: auto;
  top: calc(100% + 10px);
  z-index: 72;
}

.annual-card {
  border-color: rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.strategy-card.expanded {
  inset: 5vh 4vw auto 292px;
  width: auto;
  max-height: 90vh;
  min-height: min(820px, 82vh);
  border-radius: 22px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.26);
}

.floating-scrim {
  position: fixed;
  inset: 0;
  z-index: 14;
  display: block;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.001);
  box-shadow: none;
  cursor: default;
}

.floating-scrim:hover {
  background: rgba(0, 0, 0, 0.001);
}

.benchmark-scrim {
  z-index: 55;
}

.portfolio-scrim {
  z-index: 60;
  background: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(4px);
}

.instrument-scrim {
  z-index: 34;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(4px);
}

#trade-entry.page-view {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(30px);
}

#trade-entry-scrim {
  display: none;
}

#trade-entry-scrim.active {
  display: block;
  z-index: 39;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(5px);
}

.status-actions span,
.profile-name span,
.profile-menu button,
.benchmark-multi label,
.symbol-pill,
.picker-head,
.benchmark-select-button,
.profile-select-button,
.portfolio-picker-toggle {
  color: var(--ink);
}

.status-actions span {
  background: rgba(0, 0, 0, 0.04);
}

body.dark-mode {
  --bg: #05070b;
  --ink: #f5f7fb;
  --muted: #9aa4b2;
  --line: rgba(255, 255, 255, 0.13);
  --panel: rgba(18, 24, 34, 0.82);
  --accent: #64a8ff;
  --blue: #0a84ff;
  --blue-dark: #0069d9;
  --green: #32d74b;
  --red: #ff453a;
  --amber: #ff9f0a;
  --shadow-card: 0 22px 60px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.28);
  background:
    radial-gradient(circle at 74% -6%, rgba(10, 132, 255, 0.22), transparent 32%),
    linear-gradient(180deg, #10141c 0%, #070a10 58%, #05070b 100%);
}

body.dark-mode .topbar,
body.dark-mode .statusbar,
body.dark-mode .band,
body.dark-mode .metrics article,
body.dark-mode .portfolio-tools,
body.dark-mode .annual-panel,
body.dark-mode .chart,
body.dark-mode .strategy-card,
body.dark-mode #trade-entry.page-view {
  color: var(--ink);
  background: rgba(18, 24, 34, 0.78);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-card);
}

body.dark-mode .topbar {
  border-right-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode nav a,
body.dark-mode .status-actions span,
body.dark-mode .portfolio-current,
body.dark-mode .profile-menu,
body.dark-mode .benchmark-multi,
body.dark-mode .portfolio-picker,
body.dark-mode input,
body.dark-mode select,
body.dark-mode .profile-select-button,
body.dark-mode .benchmark-select-button,
body.dark-mode .portfolio-picker-toggle {
  color: var(--ink);
  background: rgba(25, 32, 44, 0.94);
  border-color: rgba(255, 255, 255, 0.13);
}

body.dark-mode .portfolio-current {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.18), rgba(25, 32, 44, 0.78));
}

body.dark-mode .symbol-pill,
body.dark-mode .annual-card,
body.dark-mode th,
body.dark-mode td,
body.dark-mode .summary-chips article,
body.dark-mode .strategy-kpis article {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .symbol-pill.active,
body.dark-mode .benchmark-multi label.active,
body.dark-mode .profile-menu button.active {
  color: #8ec7ff;
  background: rgba(10, 132, 255, 0.18);
  border-color: rgba(10, 132, 255, 0.26);
}

body.dark-mode .kicker,
body.dark-mode .topbar .kicker {
  color: #8ec7ff;
}

body.dark-mode .gain {
  color: var(--red) !important;
}

body.dark-mode .loss {
  color: var(--green) !important;
}

body.dark-mode .strategy-title,
body.dark-mode .strategy-title:hover {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.96), rgba(17, 24, 39, 0.96));
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .strategy-title small,
body.dark-mode .strategy-title .title-quote small {
  color: #9fc9ff;
  background: rgba(10, 132, 255, 0.14);
}

body.dark-mode .title-quote,
body.dark-mode .title-quote small,
body.dark-mode .portfolio-current span,
body.dark-mode .portfolio-current em,
body.dark-mode .picker-head span,
body.dark-mode .metrics span,
body.dark-mode .strategy-kpis span,
body.dark-mode .strategy-kpis em,
body.dark-mode .summary-chips span,
body.dark-mode .annual-card span,
body.dark-mode .annual-card dt,
body.dark-mode .chart-title,
body.dark-mode .notice {
  color: var(--muted);
}

body.dark-mode .title-quote b,
body.dark-mode .strategy-name strong,
body.dark-mode .metrics strong,
body.dark-mode .strategy-kpis strong,
body.dark-mode .summary-chips strong,
body.dark-mode .annual-card dd,
body.dark-mode .picker-head strong {
  color: var(--ink);
}

body.dark-mode .plan-form,
body.dark-mode #stress .actions,
body.dark-mode .table-wrap,
body.dark-mode .timeline article,
body.dark-mode .annual-card {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode th,
body.dark-mode td {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chart:not(.chart-dark) {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .chart:not(.chart-dark) svg line {
  stroke: rgba(255, 255, 255, 0.18);
}

body.dark-mode .chart:not(.chart-dark) svg text {
  fill: var(--muted);
}

body.dark-mode .chart:not(.chart-dark) svg polyline {
  stroke: #74a9ff;
}

body.dark-mode .annual-card.gain,
body.dark-mode .annual-card.loss,
body.dark-mode #trade-entry-result,
body.dark-mode #stress-result .stress-summary article:last-child,
body.dark-mode #plan-result .stress-summary article:last-child {
  color: var(--ink) !important;
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(255, 255, 255, 0.14);
}

body.dark-mode .review-toolbar button {
  color: var(--ink);
  background: rgba(31, 41, 55, 0.92);
  border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .review-toolbar button.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

body.dark-mode .modal-scrim,
body.dark-mode .instrument-scrim,
body.dark-mode .portfolio-scrim {
  background: rgba(0, 0, 0, 0.42);
}

@media (max-width: 980px) {
  .portfolio-profile-bar {
    grid-template-columns: 1fr;
  }

  .portfolio-picker {
    left: 50vw !important;
    width: min(760px, calc(100vw - 32px)) !important;
  }

  .benchmark-dropdown {
    justify-self: start;
  }

  .strategy-card.expanded {
    inset: 18px 16px;
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: sticky;
    width: auto;
    min-height: auto;
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .brand-lockup {
    min-width: 0;
  }

  nav {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  nav a {
    white-space: nowrap;
  }

  main {
    grid-column: 1;
    padding: 12px;
  }

  .statusbar {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: -12px -12px 12px;
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .status-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .section-head,
  .compare-head,
  .picker-head {
    align-items: stretch;
    flex-direction: column;
  }

  .portfolio-tools,
  .quote-form,
  .plan-form,
  .portfolio-profile-bar,
  .metrics,
  .stress-summary,
  .strategy-kpis,
  .summary-chips {
    grid-template-columns: 1fr;
  }

  .quote-form input,
  .quote-form button,
  .plan-form input,
  .plan-form select,
  .plan-form button {
    width: 100%;
  }

  .portfolio-picker {
    left: 50vw !important;
    width: calc(100vw - 20px) !important;
    max-height: 88vh;
    padding: 14px;
  }

  .picker-head > div:last-child {
    justify-content: flex-start;
  }

  .picker-profile-name {
    width: 100%;
  }

  .picker-grid,
  .strategy-list {
    grid-template-columns: 1fr;
  }

  .benchmark-dropdown {
    justify-self: stretch;
    width: 100%;
  }

  .benchmark-multi {
    left: 0;
    right: auto;
    width: min(100%, 360px);
  }

  .compare-stage {
    min-height: 340px;
  }

  .strategy-title {
    align-items: flex-start;
  }

  .title-quote {
    grid-template-columns: 1fr;
  }

  .strategy-card.expanded {
    inset: 12px;
    max-height: calc(100vh - 24px);
    min-height: calc(100vh - 24px);
  }

  .chart-with-sidebar,
  .review-shell {
    grid-template-columns: 1fr;
  }

  #trade-entry.page-view.active {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}

/* Final modal, scroll, and dark-theme hardening. */
.strategy-card.expanded {
  position: fixed;
  inset: 24px 28px 24px 276px;
  width: auto;
  max-height: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
}

.strategy-card.expanded .strategy-expanded {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#trade-entry-scrim {
  display: none;
}

#trade-entry-scrim.active {
  display: block;
  z-index: 39;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(5px);
}

#trade-entry input[type="date"] {
  min-width: 0;
  color-scheme: light;
}

body.dark-mode #trade-entry input[type="date"] {
  color-scheme: dark;
}

body.dark-mode .strategy-title,
body.dark-mode .strategy-title:hover,
body.dark-mode button.strategy-title,
body.dark-mode button.strategy-title:hover,
body.dark-mode .plan-form,
body.dark-mode .table-wrap,
body.dark-mode .timeline article,
body.dark-mode .annual-card,
body.dark-mode #stress .actions,
body.dark-mode .strategy-kpis article,
body.dark-mode .summary-chips article,
body.dark-mode th,
body.dark-mode td {
  color: var(--ink) !important;
  background: rgba(15, 23, 42, 0.78) !important;
  border-color: rgba(255, 255, 255, 0.13) !important;
}

body.dark-mode .strategy-title,
body.dark-mode button.strategy-title {
  background: linear-gradient(180deg, rgba(31, 41, 55, 0.98), rgba(15, 23, 42, 0.98)) !important;
}

body.dark-mode .chart:not(.chart-dark),
body.dark-mode #trade-entry-result,
body.dark-mode .notice {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.76);
  border-color: rgba(255, 255, 255, 0.13);
}

body.dark-mode .strategy-title small,
body.dark-mode .strategy-title .title-quote small {
  color: #9fc9ff !important;
  background: rgba(10, 132, 255, 0.16) !important;
}

body.dark-mode .title-quote,
body.dark-mode .title-quote small,
body.dark-mode .metrics span,
body.dark-mode .stress-summary span,
body.dark-mode .strategy-kpis span,
body.dark-mode .strategy-kpis em,
body.dark-mode .summary-chips span,
body.dark-mode .annual-card span,
body.dark-mode .annual-card dt,
body.dark-mode .chart-title,
body.dark-mode .review-toolbar,
body.dark-mode .timeline span,
body.dark-mode input::placeholder {
  color: var(--muted);
}

body.dark-mode .strategy-name strong,
body.dark-mode .strategy-title span,
body.dark-mode .strategy-title strong,
body.dark-mode .title-quote b,
body.dark-mode .metrics strong,
body.dark-mode .stress-summary strong,
body.dark-mode .strategy-kpis strong,
body.dark-mode .summary-chips strong,
body.dark-mode .annual-card dd,
body.dark-mode .picker-head strong,
body.dark-mode label,
body.dark-mode table {
  color: var(--ink) !important;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  color: var(--ink);
  background: rgba(9, 14, 23, 0.92);
  border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .chart:not(.chart-dark) svg line {
  stroke: rgba(255, 255, 255, 0.18);
}

body.dark-mode .chart:not(.chart-dark) svg text {
  fill: var(--muted);
}

body.dark-mode .chart:not(.chart-dark) svg polyline {
  stroke: #74a9ff;
}

body.dark-mode .annual-card.gain,
body.dark-mode .annual-card.loss {
  color: var(--ink) !important;
  background: rgba(15, 23, 42, 0.78);
}

body.dark-mode .review-toolbar button {
  color: var(--ink);
  background: rgba(31, 41, 55, 0.94);
  border-color: rgba(255, 255, 255, 0.16);
}

body.dark-mode .review-toolbar button.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

body.dark-mode .modal-scrim,
body.dark-mode .instrument-scrim,
body.dark-mode .portfolio-scrim,
body.dark-mode #trade-entry-scrim.active {
  background: rgba(0, 0, 0, 0.42);
}

@media (max-width: 980px) {
  .strategy-card.expanded {
    inset: 18px 16px;
  }
}

@media (max-width: 760px) {
  .strategy-card.expanded {
    inset: 10px;
    max-height: none;
    min-height: 0;
  }
}

/* Instrument workstation refinement: compact watchlist rows + cinematic review modal. */
.strategy-list {
  grid-template-columns: 1fr !important;
  gap: 10px;
}

.strategy-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: stretch;
  overflow: visible;
  border-radius: 18px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.strategy-card:not(.expanded):hover {
  transform: translateY(-1px);
  border-color: rgba(0, 113, 227, 0.25);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.12);
}

.strategy-card:not(.expanded) .strategy-title {
  min-height: 74px;
  border-bottom: 0;
  border-radius: 18px 0 0 18px;
}

.strategy-card:not(.expanded) .strategy-title > small {
  margin-left: auto;
}

.strategy-compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 8px;
  min-width: min(52vw, 560px);
  padding: 12px 14px;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.strategy-compact span {
  display: grid;
  align-content: center;
  min-width: 0;
}

.strategy-compact b {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-compact em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.strategy-card:not(.expanded) .strategy-actions,
.strategy-card:not(.expanded) .strategy-kpis,
.strategy-card:not(.expanded) .summary-chips {
  display: none;
}

.strategy-card.expanded {
  grid-template-columns: 1fr;
  inset: 18px 24px 18px 280px;
  z-index: 45;
  opacity: 1;
  transform-origin: 55% 16%;
  animation: instrument-pop 220ms cubic-bezier(0.2, 0.85, 0.28, 1);
}

.strategy-card.expanded .strategy-title {
  border-radius: 22px 22px 0 0;
}

.strategy-card.expanded .strategy-compact {
  display: none;
}

.strategy-card.expanded .strategy-actions {
  padding: 14px 16px 0;
}

.strategy-card.expanded .strategy-kpis,
.strategy-card.expanded .summary-chips {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-inline: 16px;
}

.instrument-scrim {
  z-index: 44;
}

@keyframes instrument-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.review-modal {
  width: min(1760px, calc(100vw - 36px));
  max-height: calc(100vh - 28px);
  border-radius: 24px;
  overflow: hidden;
  animation: instrument-pop 220ms cubic-bezier(0.2, 0.85, 0.28, 1);
}

.review-modal .review-panel {
  max-height: calc(100vh - 92px);
  overflow: auto;
  padding: 22px;
  background: #05070b;
}

.review-modal .chart-with-sidebar {
  grid-template-columns: minmax(780px, 1fr) 240px;
  align-items: start;
}

.review-modal .chart-dark svg {
  width: 100%;
  height: min(76vh, 820px);
}

.review-modal .chart-stats {
  align-content: start;
  grid-auto-rows: max-content;
  gap: 12px;
}

.review-title {
  color: #eaf2ff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.review-toolbar {
  color: #d8e4f2;
}

body:not(.dark-mode) .review-toolbar,
body:not(.dark-mode) .review-title {
  color: #172033;
}

.chart-dark .review-title,
.chart-dark .review-toolbar,
.review-modal .review-title,
.review-modal .review-toolbar {
  color: #eaf2ff !important;
}

body:not(.dark-mode) .strategy-card,
body:not(.dark-mode) .strategy-card.expanded,
body:not(.dark-mode) .strategy-card.expanded .strategy-title,
body:not(.dark-mode) .strategy-kpis article,
body:not(.dark-mode) .summary-chips article {
  color: #172033;
  background: rgba(255, 255, 255, 0.96);
}

body:not(.dark-mode) .strategy-name strong,
body:not(.dark-mode) .strategy-title span,
body:not(.dark-mode) .strategy-title strong,
body:not(.dark-mode) .title-quote b,
body:not(.dark-mode) .strategy-kpis strong,
body:not(.dark-mode) .summary-chips strong {
  color: #172033 !important;
}

body:not(.dark-mode) .strategy-title .title-quote small,
body:not(.dark-mode) .strategy-kpis span,
body:not(.dark-mode) .strategy-kpis em,
body:not(.dark-mode) .summary-chips span {
  color: #667085 !important;
}

body.dark-mode .strategy-compact {
  border-left-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.42);
}

body.dark-mode .strategy-compact b {
  color: var(--ink);
}

body.dark-mode .strategy-compact em {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .strategy-card {
    grid-template-columns: 1fr;
  }

  .strategy-card:not(.expanded) .strategy-title {
    border-radius: 18px 18px 0 0;
  }

  .strategy-compact {
    min-width: 0;
    border-left: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .strategy-card.expanded {
    inset: 14px;
  }

  .review-modal .chart-with-sidebar {
    grid-template-columns: 1fr;
  }
}

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

  .strategy-card.expanded .strategy-kpis,
  .strategy-card.expanded .summary-chips {
    grid-template-columns: 1fr;
  }
}

/* Instrument workstation polish: watchlist density, larger detail workspace, stronger light-mode contrast. */
.strategy-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.strategy-card:not(.expanded) {
  min-height: 86px;
  grid-template-columns: minmax(320px, 1.15fr) minmax(480px, 1fr);
  border-radius: 18px;
  overflow: hidden;
}

.strategy-card:not(.expanded)::before {
  content: "";
  width: 4px;
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(180deg, rgba(0, 113, 227, 0.9), rgba(90, 200, 250, 0.62));
  opacity: 0.85;
}

.strategy-card:not(.expanded) .strategy-title {
  min-height: 86px;
  padding-left: 22px;
  border-radius: 18px 0 0 18px;
}

.strategy-card:not(.expanded) .strategy-name {
  width: 100%;
  min-width: 0;
}

.strategy-card:not(.expanded) .strategy-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-card:not(.expanded) .title-quote {
  grid-template-columns: auto minmax(86px, auto) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
}

.strategy-card:not(.expanded) .title-quote small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-card:not(.expanded) .strategy-compact {
  min-width: 0;
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.45), rgba(248, 250, 252, 0.8));
}

.strategy-card.expanded {
  inset: 18px 28px 18px 276px !important;
  z-index: 82 !important;
  max-height: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 40px 120px rgba(15, 23, 42, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.66) inset;
}

.strategy-card.expanded .strategy-title {
  flex: 0 0 auto;
  min-height: 86px;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.strategy-card.expanded .strategy-actions {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 18px;
  background: inherit;
  backdrop-filter: blur(18px);
}

.strategy-card.expanded .strategy-kpis,
.strategy-card.expanded .summary-chips {
  flex: 0 0 auto;
  padding-inline: 18px;
}

.strategy-card.expanded .strategy-expanded {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.strategy-card.expanded .chart-with-sidebar {
  grid-template-columns: minmax(760px, 1fr) minmax(190px, 240px);
  gap: 18px;
}

.strategy-card.expanded .chart-dark svg {
  min-height: 520px;
}

.review-modal {
  width: min(1840px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  border-radius: 26px;
}

.review-modal .review-panel {
  padding: 24px;
}

.review-modal .chart-with-sidebar {
  grid-template-columns: minmax(900px, 1fr) minmax(220px, 260px);
  gap: 24px;
}

.review-modal .chart-dark svg {
  height: min(80vh, 880px);
}

body:not(.dark-mode) .strategy-card:not(.expanded),
body:not(.dark-mode) .strategy-card.expanded {
  color: #172033;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.1);
}

body:not(.dark-mode) .strategy-title,
body:not(.dark-mode) button.strategy-title,
body:not(.dark-mode) .strategy-title:hover,
body:not(.dark-mode) button.strategy-title:hover {
  color: #172033 !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)) !important;
}

body:not(.dark-mode) .strategy-card.expanded .strategy-title {
  background:
    linear-gradient(90deg, rgba(235, 246, 255, 0.98), rgba(255, 255, 255, 0.98)),
    #fff !important;
}

body:not(.dark-mode) .strategy-card.expanded .strategy-actions {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body:not(.dark-mode) .strategy-compact b,
body:not(.dark-mode) .strategy-name strong,
body:not(.dark-mode) .strategy-title span,
body:not(.dark-mode) .strategy-title strong,
body:not(.dark-mode) .title-quote b,
body:not(.dark-mode) .strategy-kpis strong,
body:not(.dark-mode) .summary-chips strong {
  color: #172033 !important;
}

body:not(.dark-mode) .strategy-compact em,
body:not(.dark-mode) .title-quote small,
body:not(.dark-mode) .strategy-title .title-quote small,
body:not(.dark-mode) .strategy-kpis span,
body:not(.dark-mode) .strategy-kpis em,
body:not(.dark-mode) .summary-chips span {
  color: #596579 !important;
}

body:not(.dark-mode) .strategy-kpis article,
body:not(.dark-mode) .summary-chips article {
  background: rgba(248, 250, 252, 0.98);
  border-color: rgba(15, 23, 42, 0.1);
}

body.dark-mode .strategy-card:not(.expanded) {
  background: rgba(15, 23, 42, 0.92);
}

body.dark-mode .strategy-card:not(.expanded) .strategy-compact {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.42), rgba(30, 41, 59, 0.62));
  border-left-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .strategy-card.expanded .strategy-actions {
  background: rgba(15, 23, 42, 0.88);
}

.instrument-scrim {
  z-index: 78 !important;
  background: rgba(15, 23, 42, 0.28) !important;
  backdrop-filter: blur(7px);
}

@media (max-width: 1180px) {
  .strategy-card:not(.expanded) {
    grid-template-columns: 1fr;
  }

  .strategy-card:not(.expanded) .strategy-title {
    border-radius: 18px 18px 0 0;
  }

  .strategy-card:not(.expanded) .strategy-compact {
    border-left: 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
  }

  .strategy-card.expanded {
    inset: 14px !important;
  }

  .strategy-card.expanded .chart-with-sidebar,
  .review-modal .chart-with-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .strategy-card:not(.expanded) .title-quote {
    grid-template-columns: 1fr;
  }

  .strategy-card.expanded {
    inset: 8px !important;
    border-radius: 20px;
  }

  .strategy-card.expanded .strategy-title {
    border-radius: 20px 20px 0 0;
  }

  .strategy-card.expanded .strategy-expanded {
    padding: 12px;
  }

  .review-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }
}
