:root {
  --bg: #eef3f7;
  --ink: #101827;
  --muted: #5e6b7d;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #dbe3eb;
  --blue: #2563eb;
  --green: #059669;
  --red: #dc2626;
  --amber: #b7791f;
  --purple: #6d5dfc;
  --shadow: 0 16px 45px rgba(16, 24, 39, 0.1);
  --radius: 8px;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font);
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.14), rgba(5, 150, 105, 0.1) 42%, rgba(183, 121, 31, 0.12)),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-row.compact {
  font-size: 1.04rem;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green) 48%, var(--amber));
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.7);
}

.eyebrow {
  margin: 22px 0 7px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 2.35rem;
  line-height: 1.03;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.2;
}

.login-copy,
.subtitle,
.form-status {
  color: var(--muted);
}

.login-copy {
  margin-bottom: 22px;
  font-weight: 650;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.login-form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 750;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.ghost-link {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 900;
}

.primary-btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.secondary-btn,
.ghost-btn,
.ghost-link {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.login-form .primary-btn {
  margin-top: 8px;
}

.form-status {
  min-height: 20px;
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 750;
}

.form-status.error {
  color: var(--red);
}

.dashboard-view {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 42px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.subtitle {
  margin: 8px 0 0;
  font-size: 0.9rem;
  font-weight: 750;
}

.top-actions,
.button-pair {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

[data-workspace-view][hidden] {
  display: none !important;
}

[data-panel-order="1"] { order: 1; }
[data-panel-order="2"] { order: 2; }
[data-panel-order="3"] { order: 3; }
[data-panel-order="4"] { order: 4; }
[data-panel-order="5"] { order: 5; }
[data-panel-order="6"] { order: 6; }

.workspace-chrome {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 10px 30px rgba(16, 24, 39, 0.1);
  overflow: hidden;
}

.workspace-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.workspace-tab {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 900;
}

.workspace-tab:last-child {
  border-right: 0;
}

.workspace-tab:hover {
  background: #ffffff;
  color: var(--ink);
}

.workspace-tab:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: -3px;
}

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

.workspace-tab strong {
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 2px 7px;
  font-size: 0.72rem;
  line-height: 1;
}

.workspace-tab.active strong {
  border-color: rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.08);
  color: var(--blue);
}

.workspace-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 10px 14px;
}

.workspace-summary-item {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 2px 14px;
}

.workspace-summary-item:first-child {
  padding-left: 2px;
}

.workspace-summary-item:last-child {
  border-right: 0;
}

.workspace-summary-item span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.workspace-summary-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-summary-item.agent-state strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.workspace-summary-item.agent-state strong::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 370px 1fr 1fr;
  gap: 14px;
}

.dashboard-grid > * {
  min-width: 0;
}

.status-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.stat-card,
.integrity-panel,
.agent-panel,
.control-panel,
.scan-panel,
.chart-panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 1.55rem;
  line-height: 1;
}

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

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

.control-panel,
.integrity-panel,
.agent-panel,
.scan-panel,
.chart-panel,
.table-panel {
  padding: 16px;
}

.integrity-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border: 2px solid rgba(5, 150, 105, 0.45);
  background: #ffffff;
}

.integrity-copy .eyebrow {
  margin-top: 0;
}

.integrity-copy p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.integrity-status,
.integrity-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.broker-table-block {
  margin-top: 14px;
}

.control-panel {
  display: grid;
  gap: 14px;
}

.scan-panel {
  grid-column: span 2;
}

.chart-panel {
  grid-column: span 2;
}

.wide {
  grid-column: 1 / -1;
}

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

.agent-item {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.agent-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.agent-item strong {
  font-size: 0.98rem;
  line-height: 1.15;
}

.agent-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 14px;
}

.panel-head .eyebrow {
  margin-top: 0;
}

.mode-pill,
.status-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.approved {
  border-color: rgba(5, 150, 105, 0.28);
  background: rgba(5, 150, 105, 0.1);
  color: var(--green);
}

.status-pill.accepted,
.status-pill.active {
  border-color: rgba(5, 150, 105, 0.32);
  background: rgba(5, 150, 105, 0.12);
  color: var(--green);
}

.status-pill.review {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

.status-pill.research_only {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

.status-pill.shadow {
  border-color: rgba(161, 98, 7, 0.3);
  background: rgba(202, 138, 4, 0.12);
  color: #854d0e;
}

.status-pill.disconnected {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.09);
  color: var(--red);
}

.status-pill.closed,
.status-pill.expired,
.status-pill.screened_out,
.status-pill.not_actionable,
.status-pill.data_required {
  border-color: rgba(183, 121, 31, 0.32);
  background: rgba(183, 121, 31, 0.1);
  color: #854d0e;
}

.stop-btn {
  min-height: 86px;
  border: 1px solid rgba(220, 38, 38, 0.38);
  border-radius: var(--radius);
  background: var(--red);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 950;
  letter-spacing: 0;
}

.stop-btn.active {
  background: #ffffff;
  color: var(--red);
}

.risk-list {
  display: grid;
  gap: 8px;
}

.risk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.risk-row strong {
  color: var(--ink);
}

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

.stage {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 10px;
}

.stage span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stage strong {
  font-size: 0.86rem;
}

.stage.pass {
  border-color: rgba(5, 150, 105, 0.26);
  background: rgba(5, 150, 105, 0.08);
}

.stage.fail {
  border-color: rgba(220, 38, 38, 0.26);
  background: rgba(220, 38, 38, 0.07);
}

.thesis-box {
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(5, 150, 105, 0.08)),
    #ffffff;
  padding: 14px;
}

.thesis-box p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 650;
}

.equity-chart {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.extra-wide {
  min-width: 1180px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
  font-weight: 650;
}

.data-table td:not(:first-child),
.data-table th:not(:first-child) {
  font-variant-numeric: tabular-nums;
}

.table-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.arbitrage-panel {
  border-top: 3px solid var(--green);
}

.asset-class-panel {
  border-top: 3px solid var(--blue);
}

.asset-class-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.asset-class-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.asset-class-item > span,
.asset-class-item small {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  text-transform: uppercase;
}

.asset-class-item > strong {
  display: block;
  margin: 7px 0 5px;
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.asset-class-item p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.asset-class-item.active {
  border-color: rgba(5, 150, 105, 0.3);
  background: #effaf6;
}

.holding-summary {
  margin-bottom: 14px;
}

.holding-summary-item,
.holding-summary-empty {
  width: 100%;
  display: block;
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: var(--radius);
  background: #effaf6;
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

button.holding-summary-item:hover,
button.holding-summary-item:focus-visible {
  border-color: var(--green);
  outline: 2px solid rgba(5, 150, 105, 0.22);
  outline-offset: 2px;
}

.holding-summary-title,
.holding-overview-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.holding-summary-title > div > span,
.holding-overview-title > div > span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.holding-summary-title > div > strong,
.holding-overview-title > div > strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.holding-summary-grid,
.holding-overview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.holding-summary-grid > span,
.holding-overview-grid > span {
  min-width: 0;
  border-left: 2px solid rgba(5, 150, 105, 0.28);
  padding-left: 9px;
}

.holding-summary-grid small,
.holding-overview-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.holding-summary-grid strong,
.holding-overview-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.holding-summary-empty {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ledger-breakdown {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  overflow: hidden;
}

.ledger-breakdown summary {
  min-height: 44px;
  cursor: pointer;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.ledger-breakdown summary strong {
  float: right;
  color: var(--muted);
  font-size: 0.78rem;
}

.ledger-breakdown[open] summary {
  border-bottom: 1px solid var(--line);
}

.ledger-breakdown .table-wrap {
  background: #ffffff;
  padding: 0 10px 10px;
}

.opportunity-row {
  cursor: pointer;
  transition: background-color 140ms ease;
}

.opportunity-row:hover,
.opportunity-row:focus-visible {
  background: #eef7f4;
}

.opportunity-row:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.cell-subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.portfolio-voided-row {
  background: #fff8e8;
}

.portfolio-voided-row td:first-child {
  border-left: 3px solid #c78915;
}

.quantity-cell,
.money-cell {
  white-space: nowrap;
}

.opportunity-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: min(880px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 70px rgba(16, 24, 39, 0.24);
}

.opportunity-dialog::backdrop {
  background: rgba(16, 24, 39, 0.62);
}

.opportunity-dialog-shell {
  padding: 22px;
}

.holding-overview {
  margin-top: 18px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-left: 4px solid var(--blue);
  background: #f2f7ff;
  padding: 14px;
}

.holding-overview-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.holding-overview-grid > span {
  border-left-color: rgba(37, 99, 235, 0.25);
}

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

.opportunity-dialog-head .eyebrow {
  margin: 0 0 6px;
}

.dialog-close {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1;
}

.opportunity-validity {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  margin: 18px 0;
  border-left: 4px solid var(--amber);
  background: #fffaf0;
  padding: 14px;
}

.opportunity-validity.active {
  border-left-color: var(--green);
  background: #effaf6;
}

.opportunity-validity p,
.detail-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.5;
}

.opportunity-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.opportunity-detail-grid > div {
  min-width: 0;
  background: var(--panel);
  padding: 13px;
}

.opportunity-detail-grid dt,
.timing-list dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.opportunity-detail-grid dd,
.timing-list dd {
  margin: 5px 0 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.opportunity-detail-grid small,
.calculation-strip small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.opportunity-detail-section {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.economics-warning {
  margin-top: 12px;
  border-left: 4px solid var(--red);
  background: #fff4f2;
  padding: 12px 14px;
}

.economics-warning p {
  margin: 4px 0 0;
  color: #8f2f26;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.opportunity-detail-section h3 {
  margin-bottom: 10px;
}

.opportunity-detail-section p:last-child {
  margin-bottom: 0;
}

.calculation-line {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 11px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.calculation-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.calculation-strip span {
  min-width: 0;
  border-left: 2px solid var(--line);
  padding-left: 10px;
}

.calculation-strip strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.timing-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.timing-list > div {
  display: grid;
  grid-template-columns: minmax(140px, 0.35fr) 1fr;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.signal-list,
.log-list,
.metric-list,
.source-list,
.health-list {
  display: grid;
  gap: 10px;
}

.signal-list,
.log-list {
  max-height: 420px;
  overflow-x: hidden;
  overflow-y: auto;
}

.signal-item,
.log-item,
.metric-item,
.source-item,
.health-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 12px;
}

.signal-item,
.log-item,
.metric-item,
.source-item,
.health-item,
.source-list,
.signal-list,
.log-list {
  min-width: 0;
  max-width: 100%;
}

.source-item p,
.source-item a,
.signal-item p,
.log-item p {
  overflow-wrap: anywhere;
}

.signal-item {
  display: grid;
  gap: 8px;
}

.item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.log-item p,
.signal-item p,
.metric-item p,
.source-item p,
.health-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.metric-item {
  display: grid;
  gap: 6px;
}

.metric-row,
.health-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-row strong,
.health-item strong {
  white-space: nowrap;
}

.source-item {
  display: grid;
  gap: 7px;
}

.health-list {
  margin-top: 10px;
}

.health-item.ok {
  border-color: rgba(5, 150, 105, 0.28);
  background: rgba(5, 150, 105, 0.08);
}

.health-item.warn {
  border-color: rgba(183, 121, 31, 0.32);
  background: rgba(183, 121, 31, 0.09);
}

.health-item.stop {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
}

.compact-list {
  gap: 8px;
}

.empty-state {
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 1600px) {
  .extra-wide {
    min-width: 0;
  }

  .extra-wide thead {
    display: none;
  }

  .extra-wide tbody,
  .extra-wide tr,
  .extra-wide td {
    display: block;
    width: 100%;
  }

  .extra-wide tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    margin-bottom: 10px;
    overflow: hidden;
  }

  .extra-wide tbody td {
    min-height: 42px;
    position: relative;
    border-bottom: 1px solid var(--line);
    padding: 10px 9px 10px 42%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .extra-wide tbody td:last-child {
    border-bottom: 0;
  }

  .extra-wide tbody td::before {
    content: attr(data-label);
    width: 36%;
    position: absolute;
    top: 11px;
    left: 9px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .extra-wide tbody td[colspan] {
    padding: 12px;
  }

  .extra-wide tbody td[colspan]::before {
    content: none;
  }
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .control-panel,
  .scan-panel,
  .chart-panel {
    grid-column: span 2;
  }

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

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

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

  .integrity-panel {
    grid-template-columns: 1fr;
  }

  .asset-class-grid,
  .holding-summary-grid,
  .holding-overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 10px;
  }

  .workspace-summary-item:nth-child(3) {
    border-right: 0;
  }
}

@media (max-width: 1120px) {
  .dashboard-view {
    width: min(100% - 20px, 1440px);
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-grid,
  .status-strip,
  .agent-grid,
  .broker-account-grid,
  .pipeline {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .scan-panel,
  .chart-panel,
  .wide {
    grid-column: auto;
  }

  .stat-card {
    min-height: 78px;
  }

  h1 {
    font-size: 2rem;
  }

  .opportunity-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .opportunity-dialog-shell {
    padding: 16px;
  }

  .opportunity-validity,
  .opportunity-detail-grid,
  .calculation-strip {
    grid-template-columns: 1fr;
  }

  .asset-class-grid,
  .holding-summary-grid,
  .holding-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .holding-summary-title,
  .holding-overview-title,
  .holding-summary-empty {
    align-items: stretch;
    flex-direction: column;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  .extra-wide {
    min-width: 0;
  }

  table thead {
    display: none;
  }

  table tbody,
  table tr,
  table td {
    display: block;
    width: 100%;
  }

  table tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    margin-bottom: 10px;
    overflow: hidden;
  }

  table tbody td {
    min-height: 42px;
    position: relative;
    border-bottom: 1px solid var(--line);
    padding: 10px 9px 10px 42%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  table tbody td:last-child {
    border-bottom: 0;
  }

  table tbody td::before {
    content: attr(data-label);
    width: 36%;
    position: absolute;
    top: 11px;
    left: 9px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  table tbody td[colspan] {
    padding: 12px;
  }

  table tbody td[colspan]::before {
    content: none;
  }

  .cell-subtext,
  .quantity-cell,
  .money-cell {
    white-space: normal;
  }

  .timing-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (max-width: 720px) {
  .subtitle {
    display: none;
  }

  .workspace-chrome {
    position: static;
  }

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

  .workspace-tab:nth-child(2) {
    border-right: 0;
  }

  .workspace-tab:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

  .workspace-summary-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 5px 8px 10px;
  }

  .workspace-summary-item:nth-last-child(-n + 2) {
    border-bottom: 0;
    padding-bottom: 5px;
  }

  .workspace-summary-item.agent-state {
    grid-column: auto;
  }

  .workspace-summary-item:nth-child(3) {
    display: none;
  }

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

  .stat-card {
    min-height: 70px;
    padding: 12px;
  }

  .stat-card strong {
    font-size: 1.3rem;
  }
}

/* Decision workbench reference layout */
body {
  background: #f4f6f8;
}

.dashboard-view {
  width: 100%;
  height: 100vh;
  min-height: 720px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.trade-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  background: #112131;
  color: #ffffff;
  border-right: 1px solid #24374a;
}

.sidebar-brand {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0 20px;
  font-size: 1.05rem;
}

.brand-bars {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
}

.brand-bars i {
  width: 4px;
  border-radius: 1px 1px 0 0;
  background: #2580f7;
}

.brand-bars i:nth-child(1) { height: 8px; }
.brand-bars i:nth-child(2) { height: 16px; }
.brand-bars i:nth-child(3) { height: 12px; }

.sidebar-ledger {
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #91a1b2;
  padding: 13px 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.sidebar-ledger strong {
  display: block;
  margin-top: 3px;
  color: #ffffff;
  font-size: 0.9rem;
}

.trade-sidebar .workspace-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 18px 10px;
}

.trade-sidebar .workspace-tab {
  min-height: 52px;
  justify-content: flex-start;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #e9f0f7;
  padding: 0 14px;
  font-size: 0.92rem;
}

.trade-sidebar .workspace-tab::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border: 2px solid #8fa2b5;
  border-radius: 2px;
  content: "";
}

.trade-sidebar .workspace-tab:hover {
  background: #172d41;
  color: #ffffff;
}

.trade-sidebar .workspace-tab.active {
  background: #17477a;
  color: #ffffff;
  box-shadow: inset 3px 0 0 #2c8cff;
}

.trade-sidebar .workspace-tab.active::before {
  border-color: #65adff;
  background: #2580f7;
}

.trade-sidebar .workspace-tab strong {
  min-width: 22px;
  min-height: 22px;
  margin-left: auto;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #dbe7f3;
  padding: 2px 6px;
  flex: 0 0 auto;
  font-size: 0.62rem;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 16px 18px 18px;
}

.sidebar-health {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-health > span {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: #24b47e;
}

.sidebar-health strong,
.sidebar-health small {
  display: block;
}

.sidebar-health strong {
  color: #ffffff;
  font-size: 0.78rem;
}

.sidebar-health small {
  margin-top: 3px;
  color: #9eb0c1;
  font-size: 0.66rem;
  line-height: 1.35;
}

.sidebar-link {
  min-height: 34px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #b9c7d4;
  padding: 0 8px;
  text-align: left;
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 800;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.trade-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-rows: 58px minmax(0, 1fr);
  background: #f4f6f8;
}

.trade-main .workspace-chrome {
  position: static;
  z-index: auto;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #d9e0e7;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  overflow: hidden;
}

.trade-main .workspace-summary {
  height: 58px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0 18px;
}

.trade-main .workspace-summary-item {
  gap: 2px;
  border-right-color: #d9e0e7;
  padding: 0 18px;
}

.trade-main .workspace-summary-item:first-child {
  padding-left: 4px;
}

.trade-main .workspace-summary-item span {
  font-size: 0.65rem;
}

.trade-main .workspace-summary-item strong {
  font-size: 0.82rem;
}

.trade-main .dashboard-grid {
  min-width: 0;
  min-height: 0;
  grid-template-columns: 360px 1fr 1fr;
  align-content: start;
  gap: 14px;
  padding: 14px;
  overflow: auto;
}

body[data-workspace-view="scans"] .trade-main .dashboard-grid {
  display: block;
  padding: 0;
  overflow: hidden;
}

.decision-workspace {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.62fr) minmax(480px, 1.12fr) minmax(390px, 1fr);
  grid-template-rows: minmax(0, 1fr) 225px;
  grid-template-areas:
    "queue review scenario"
    "queue evidence execution";
  background: #ffffff;
  color: #17202c;
}

.decision-queue-panel,
.decision-review-panel,
.decision-side-panel,
.decision-scenario-panel,
.decision-live-panel,
.decision-evidence-panel,
.decision-execution-panel {
  min-width: 0;
  min-height: 0;
  background: #ffffff;
}

.decision-queue-panel {
  grid-area: queue;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #d9e0e7;
  overflow: hidden;
}

.decision-review-panel {
  grid-area: review;
  border-right: 1px solid #d9e0e7;
  overflow: auto;
}

.decision-side-panel {
  grid-area: scenario;
  overflow: auto;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.decision-scenario-panel:empty {
  display: none;
}

.decision-evidence-panel {
  grid-area: evidence;
  border-top: 1px solid #d9e0e7;
  border-right: 1px solid #d9e0e7;
  overflow: auto;
  padding: 14px 16px;
}

.decision-execution-panel {
  grid-area: execution;
  border-top: 1px solid #d9e0e7;
  overflow: auto;
  padding: 14px 18px;
}

.decision-section-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}

.decision-queue-panel > .decision-section-head {
  border-bottom: 1px solid #e2e7ed;
  padding: 0 16px;
}

.decision-section-head h2 {
  font-size: 0.98rem;
}

.decision-section-head > span {
  min-width: 25px;
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #edf1f5;
  color: #516071;
  font-size: 0.72rem;
  font-weight: 900;
}

.decision-buckets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  border-bottom: 1px solid #e2e7ed;
  background: #f7f9fb;
  padding: 6px 8px;
}

.decision-buckets button {
  min-width: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #667487;
  padding: 4px 3px;
  font-size: 0.57rem;
  font-weight: 900;
  line-height: 1.08;
  white-space: normal;
}

.decision-buckets button:hover {
  border-color: #cbd7e3;
  background: #ffffff;
}

.decision-buckets button.active {
  border-color: #aac9e9;
  background: #e8f2ff;
  color: #1261bc;
}

.decision-buckets button span {
  display: inline-flex;
  min-width: 17px;
  justify-content: center;
  margin-left: 2px;
  border-radius: 9px;
  background: #e5eaf0;
  padding: 1px 4px;
  font-size: 0.53rem;
}

.decision-buckets button.active span {
  background: #ffffff;
}

.decision-filters {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #e2e7ed;
  padding: 8px 10px;
}

.decision-filters label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #556579;
  font-size: 0.61rem;
  font-weight: 900;
}

.decision-filters label svg {
  width: 14px;
  height: 14px;
}

.decision-filters select {
  width: 100%;
  min-width: 0;
  height: 31px;
  border: 1px solid #cbd5df;
  border-radius: 3px;
  background: #ffffff;
  color: #25364a;
  padding: 0 8px;
  font-size: 0.65rem;
  font-weight: 800;
}

.decision-filters button {
  min-height: 30px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #667487;
  font-size: 0.7rem;
  font-weight: 900;
}

.decision-filters button.active {
  background: #e8f2ff;
  color: #1261bc;
}

.decision-filters button span {
  display: inline-flex;
  min-width: 18px;
  justify-content: center;
  margin-left: 4px;
  border-radius: 9px;
  background: #eef1f5;
  color: #5f6e81;
  padding: 1px 5px;
  font-size: 0.58rem;
}

.decision-filters button.active span {
  background: #ffffff;
  color: #1261bc;
}

.decision-filter-summary {
  min-height: 27px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #d9e0e7;
  background: #ffffff;
  color: #667588;
  padding: 5px 12px;
  font-size: 0.57rem;
  font-weight: 700;
}

.scanner-activity {
  border-bottom: 1px solid #d9e0e7;
  background: #f7f9fb;
  padding: 10px 12px;
}

.scanner-activity > header,
.scanner-activity > header > span,
.scanner-recent-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scanner-activity > header > span {
  justify-content: flex-start;
}

.scanner-activity > header strong,
.scanner-activity > header b {
  font-size: 0.63rem;
}

.scanner-activity > header b {
  border: 1px solid #d0d8e1;
  border-radius: 3px;
  background: #ffffff;
  color: #657385;
  padding: 3px 5px;
  white-space: nowrap;
}

.scanner-activity > header b.ready {
  border-color: #8ecdb3;
  background: #eaf8f2;
  color: #087a4f;
}

#scannerActivityDot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #24b47e;
}

#scannerActivityDot.running {
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

#scannerActivityDot.error {
  background: #d12630;
}

@keyframes scanner-pulse {
  50% { box-shadow: 0 0 0 4px rgba(36, 180, 126, 0.17); }
}

.scanner-current {
  min-width: 0;
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.scanner-current strong,
.scanner-current span,
.scanner-method,
.scanner-learning {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-current strong {
  color: #192638;
  font-size: 0.7rem;
}

.scanner-current span,
.scanner-method,
.scanner-learning {
  color: #657385;
  font-size: 0.58rem;
}

.scanner-method {
  margin-top: 7px;
  border-left: 2px solid #2680eb;
  padding-left: 7px;
  font-weight: 800;
}

.scanner-learning {
  margin-top: 6px;
}

.scanner-backfill {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.scanner-backfill > span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.scanner-backfill strong,
.scanner-backfill small {
  overflow: hidden;
  font-size: 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-backfill strong { color: #34465a; }
.scanner-backfill small { color: #718092; }
.scanner-backfill > i {
  height: 4px;
  overflow: hidden;
  border-radius: 1px;
  background: #dbe2e9;
}
.scanner-backfill > i > b {
  height: 100%;
  display: block;
  min-width: 2px;
  background: #1473e6;
}

.scanner-progress {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border-top: 1px solid #dce3ea;
  padding-top: 7px;
}

.scanner-progress > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scanner-progress strong,
.scanner-progress small {
  font-size: 0.57rem;
}

.scanner-progress strong { color: #173452; }
.scanner-progress small { color: #6b798b; }

#scannerProgressSteps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
}

#scannerProgressSteps i {
  height: 4px;
  border-radius: 1px;
  background: #d8dfe7;
}

#scannerProgressSteps i.complete { background: #129260; }
#scannerProgressSteps i.active {
  background: #1473e6;
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

.scanner-evidence-snapshot {
  min-width: 0;
  display: grid;
  gap: 2px;
  margin-top: 7px;
  border-left: 2px solid #129260;
  background: #ffffff;
  padding: 6px 7px;
}

.scanner-evidence-snapshot strong,
.scanner-evidence-snapshot span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-evidence-snapshot strong { color: #087a4f; font-size: 0.59rem; }
.scanner-evidence-snapshot span { color: #647387; font-size: 0.55rem; }

.scanner-trail {
  margin-top: 8px;
  border-top: 1px solid #dce3ea;
  padding-top: 7px;
}

.scanner-trail-head,
.scanner-trail-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.scanner-trail-head strong,
.scanner-recent-head {
  color: #344357;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scanner-trail-head span {
  color: #7a8796;
  font-size: 0.54rem;
}

#scannerLiveTrail {
  margin-top: 4px;
}

.scanner-trail-row {
  min-height: 25px;
  justify-content: flex-start;
  border-left: 1px solid #ccd6e1;
  margin-left: 4px;
  padding-left: 10px;
}

.scanner-trail-row i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #8593a3;
  margin-left: -14px;
}

.scanner-trail-row.active i {
  background: #1473e6;
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

.scanner-trail-row.complete i { background: #129260; }
.scanner-trail-row.error i { background: #d12630; }
.scanner-trail-row.waiting i { background: #d39b19; }

.scanner-trail-row span {
  min-width: 0;
  overflow: hidden;
  color: #526174;
  font-size: 0.56rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-recent-head {
  margin-top: 8px;
  border-top: 1px solid #dce3ea;
  padding-top: 7px;
}

.scanner-recent-block {
  border-bottom: 1px solid #d9e0e7;
  background: #f7f9fb;
  padding: 8px 12px 6px;
}

.scanner-recent-block .scanner-recent-head {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.scanner-recent {
  margin-top: 2px;
}

.scanner-recent-row {
  min-height: 34px;
  border-bottom: 1px solid #e3e8ee;
}

.scanner-recent-row:last-child {
  border-bottom: 0;
}

.scanner-recent-row > span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.scanner-recent-row strong,
.scanner-recent-row small {
  overflow: hidden;
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-recent-row a {
  color: #125cae;
  text-decoration: none;
}

.scanner-recent-row small {
  color: #718092;
}

.scanner-recent-row > b {
  flex: 0 0 auto;
  color: #6a7788;
  font-size: 0.55rem;
}

.scanner-recent-row > b.pass {
  color: #087a4f;
}

.scanner-recent-result {
  flex: 0 0 auto;
  text-align: right;
}

.scanner-recent-result b,
.scanner-recent-result small {
  font-size: 0.54rem;
  white-space: nowrap;
}

.scanner-recent-result b { color: #526174; }
.scanner-recent-result b.scored { color: #1261bc; }
.scanner-recent-result small { color: #6a7788; }
.scanner-recent-result small.pass { color: #087a4f; }

.scanner-recent-empty {
  padding: 9px 0 2px;
  color: #718092;
  font-size: 0.6rem;
}

.decision-queue-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
}

.decision-queue-item {
  width: 100%;
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 0;
  border-bottom: 1px solid #e2e7ed;
  border-left: 4px solid transparent;
  border-radius: 0;
  background: #ffffff;
  color: #17202c;
  padding: 11px 14px 11px 10px;
  text-align: left;
}

.decision-queue-item:hover {
  background: #f6f9fc;
}

.decision-queue-item.selected {
  border-left-color: #1473e6;
  background: #eaf3ff;
}

.decision-queue-item > span:not(.decision-queue-line) {
  overflow: hidden;
  color: #415063;
  font-size: 0.73rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-queue-line {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.decision-queue-line > strong {
  font-size: 0.9rem;
}

.decision-queue-line time,
.decision-queue-line small {
  min-width: 0;
  overflow: hidden;
  color: #607084;
  font-size: 0.66rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-queue-evidence {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.decision-queue-evidence b {
  color: #1261bc;
  font-size: 0.61rem;
}

.decision-queue-evidence small {
  min-width: 0;
  overflow: hidden;
  color: #6a788a;
  font-size: 0.57rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-badge {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd7df;
  border-radius: 3px;
  background: #f0f3f6;
  color: #5a6674;
  padding: 5px 8px;
  font-size: 0.67rem;
  font-weight: 900;
  white-space: nowrap;
}

.decision-badge.rejected {
  border-color: #f0a6a6;
  background: #fff0f0;
  color: #c9232d;
}

.decision-badge.needs-data,
.decision-badge.watch {
  border-color: #e3c278;
  background: #fff8e7;
  color: #986300;
}

.decision-badge.open {
  border-color: #8ecdb3;
  background: #eaf8f2;
  color: #087a4f;
}

.decision-badge.closed {
  border-color: #e3c278;
  background: #fff7df;
  color: #8c5c00;
}

.selected-decision-head {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #d9e0e7;
  padding: 14px 18px;
}

.selected-decision-head > div:first-child {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.selected-decision-head h2 {
  font-size: 1.45rem;
}

.selected-decision-head span {
  overflow: hidden;
  color: #3c4856;
  font-size: 0.9rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-decision-status {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.selected-decision-status small {
  color: #6b7888;
  font-size: 0.62rem;
  font-weight: 800;
}

.decision-metrics {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #d9e0e7;
}

.decision-metrics > div {
  min-width: 0;
  min-height: 66px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  border-right: 1px solid #d9e0e7;
  border-bottom: 1px solid #d9e0e7;
  padding: 8px;
  text-align: center;
  background: #fbfcfe;
}

.decision-metrics > div:nth-child(4),
.decision-metrics > div:last-child {
  border-right: 0;
}

.decision-metrics > div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.decision-metrics .expected-metric {
  min-height: 132px;
  grid-row: span 2;
  border-bottom: 0;
  background: #edf5ff;
  box-shadow: inset 4px 0 #1473e6;
}

.decision-metrics > div:has(> strong.positive) {
  background: #eef9f4;
}

.decision-metrics > div:has(> strong.negative) {
  background: #fff1f2;
}

.decision-metrics .expected-metric:has(> strong.positive) {
  box-shadow: inset 4px 0 #129260;
}

.decision-metrics .expected-metric:has(> strong.negative) {
  box-shadow: inset 4px 0 #d12630;
}

.decision-metrics .status-metric.open {
  background: #eaf8f2;
  color: #087a4f;
}

.decision-metrics .status-metric.watch,
.decision-metrics .status-metric.closed {
  background: #fff7df;
  color: #8c5c00;
}

.decision-metrics .status-metric.rejected,
.decision-metrics .status-metric.needs-data {
  background: #fff1f2;
  color: #c9232d;
}

.decision-metrics span {
  color: #556477;
  font-size: 0.67rem;
  font-weight: 700;
}

.decision-metrics strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.decision-metrics .expected-metric strong {
  font-size: 1.9rem;
}

.decision-gates {
  padding: 14px 16px;
}

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

.decision-subhead h3 {
  margin: 0;
  font-size: 0.82rem;
}

.decision-subhead span {
  color: #6d7a89;
  font-size: 0.62rem;
  font-weight: 700;
}

.decision-gate-row {
  min-height: 43px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #d9e0e7;
  border-bottom: 0;
  padding: 6px 10px;
}

.decision-gate-row:first-of-type {
  border-radius: 4px 4px 0 0;
}

.decision-gate-row:last-child {
  border-bottom: 1px solid #d9e0e7;
  border-radius: 0 0 4px 4px;
}

.gate-indicator {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.decision-gate-row.pass {
  border-left: 3px solid #129260;
  background: #eef9f4;
  color: #087a4f;
}

.decision-gate-row.fail {
  border-left: 3px solid #d12630;
  background: #fff1f2;
  color: #c9232d;
}

.decision-gate-row > div {
  min-width: 0;
}

.decision-gate-row strong,
.decision-gate-row small {
  display: block;
}

.decision-gate-row strong {
  overflow: hidden;
  color: #17202c;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-gate-row small {
  margin-top: 2px;
  overflow: hidden;
  color: #6c7988;
  font-size: 0.59rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-gate-row b {
  font-size: 0.68rem;
}

.decision-reason {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #d9e0e7;
  padding: 8px 16px;
}

.decision-reason.fail { background: #fff1f2; color: #c9232d; }
.decision-reason.pass { background: #eef9f4; color: #087a4f; }

.decision-reason strong {
  font-size: 0.68rem;
}

.decision-reason button,
.execution-lock button {
  min-height: 32px;
  border: 1px solid #cbd5df;
  border-radius: 3px;
  background: #ffffff;
  color: #233347;
  padding: 0 10px;
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
}

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

.scenario-cards article {
  min-height: 154px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px solid #d9e0e7;
  border-radius: 4px;
  padding: 14px;
  text-align: center;
}

.scenario-cards span,
.scenario-cards small {
  color: #536175;
  font-size: 0.72rem;
  font-weight: 700;
}

.scenario-cards strong {
  font-size: 1.55rem;
}

.scenario-cards .success strong { color: #087a4f; }
.scenario-cards .failure strong { color: #d12630; }

.weighted-result {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid;
  border-radius: 4px;
  padding: 10px 12px;
}

.weighted-result.fail {
  border-color: #efb0b3;
  background: #fff1f1;
  color: #c9232d;
}

.weighted-result.pass {
  border-color: #9dd4bd;
  background: #eef9f4;
  color: #087a4f;
}

.weighted-result span {
  font-size: 0.72rem;
  font-weight: 850;
}

.weighted-result strong {
  font-size: 1.22rem;
}

.outcome-distribution {
  margin-top: 18px;
}

.outcome-distribution > div:first-child,
.distribution-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.outcome-distribution > div:first-child strong,
.outcome-distribution > div:first-child span,
.distribution-legend span {
  color: #4f5e70;
  font-size: 0.66rem;
}

.distribution-bar {
  height: 28px;
  display: flex;
  margin: 10px 0;
  border-radius: 3px;
  overflow: hidden;
}

.distribution-bar span {
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
}

.distribution-bar .success { background: #07844f; }
.distribution-bar .failure { background: #d7353f; }

.distribution-legend i {
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 2px;
}

.distribution-legend i.success { background: #07844f; }
.distribution-legend i.failure { background: #d7353f; }

.consideration-proof {
  margin-bottom: 8px;
  border: 1px solid #d9e0e7;
  border-left: 3px solid #d18a00;
  background: #fffdf7;
  padding: 8px 10px;
}

.consideration-proof.verified {
  border-left-color: #07844f;
  background: #f5fbf8;
}

.consideration-proof header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.consideration-proof header span,
.consideration-citation > span,
.consideration-proof blockquote > span {
  color: #566679;
  font-size: 0.56rem;
  font-weight: 900;
  text-transform: uppercase;
}

.consideration-proof header strong {
  color: #9a6200;
  font-size: 0.62rem;
}

.consideration-proof.verified header strong {
  color: #067445;
}

.consideration-proof p,
.consideration-proof blockquote,
.consideration-proof cite {
  color: #263547;
  font-size: 0.62rem;
  line-height: 1.42;
}

.consideration-proof p {
  margin: 0 0 6px;
}

.consideration-proof blockquote {
  margin: 0 0 6px;
  border-left: 2px solid #bcc8d4;
  padding-left: 8px;
}

.consideration-proof blockquote > span,
.consideration-citation > span {
  display: block;
  margin-bottom: 2px;
}

.consideration-citation cite {
  display: block;
  font-style: normal;
}

.consideration-citation a {
  display: inline-block;
  margin-top: 3px;
  color: #1261bc;
  font-size: 0.59rem;
  font-weight: 800;
  text-decoration: none;
}

.decision-evidence-list {
  border: 1px solid #d9e0e7;
  border-radius: 3px;
  overflow: hidden;
}

.decision-evidence-list > div {
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(180px, 2fr) minmax(110px, 0.9fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e2e7ed;
  padding: 5px 8px;
}

.decision-evidence-list > div:last-child {
  border-bottom: 0;
}

.decision-evidence-list strong,
.decision-evidence-list span,
.decision-evidence-list time {
  min-width: 0;
  overflow: hidden;
  font-size: 0.59rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-evidence-list a {
  color: #1261bc;
  text-decoration: none;
}

.decision-evidence-list span,
.decision-evidence-list time {
  color: #59687a;
}

.execution-lock {
  min-height: 138px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid #d9e0e7;
  border-radius: 4px;
  background: #fafbfc;
  padding: 12px;
  text-align: center;
}

.lock-mark {
  width: 32px;
  height: 28px;
  position: relative;
  display: block;
  border: 2px solid #607084;
  border-radius: 4px;
}

.lock-mark::before {
  width: 17px;
  height: 13px;
  position: absolute;
  top: -14px;
  left: 5px;
  border: 2px solid #607084;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  content: "";
}

.execution-lock.legacy {
  border-color: #e2c77f;
  background: #fffaf0;
}

.execution-lock strong {
  font-size: 0.78rem;
}

.execution-lock p {
  max-width: 440px;
  margin: 0;
  color: #617083;
  font-size: 0.64rem;
  line-height: 1.4;
}

.decision-empty {
  min-height: 140px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: #617083;
  padding: 20px;
  text-align: center;
}

.decision-empty strong,
.decision-empty span {
  display: block;
}

.decision-empty span {
  font-size: 0.72rem;
}

.learning-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(460px, 1.2fr);
  gap: 10px;
}

.learning-header,
.learning-summary,
.learning-files,
.learning-memory,
.learning-coverage,
.learning-preview {
  min-width: 0;
  border: 1px solid #d8e0e8;
  border-radius: 4px;
  background: #ffffff;
}

.learning-header {
  min-height: 66px;
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
}

.learning-header h2 {
  font-size: 1.05rem;
}

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

.learning-header-actions span,
.learning-header-actions a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #ccd6e0;
  border-radius: 3px;
  background: #ffffff;
  color: #4f6072;
  padding: 0 9px;
  font-size: 0.65rem;
  font-weight: 850;
  text-decoration: none;
}

.learning-header-actions span.ready {
  border-color: #8ecdb3;
  background: #eaf8f2;
  color: #087a4f;
}

.learning-header-actions span.pending {
  border-color: #e3c278;
  background: #fff8e7;
  color: #8c6208;
}

.learning-summary {
  min-height: 70px;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
}

.learning-outcomes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(170px, 1.5fr) repeat(4, minmax(110px, 1fr));
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #d8e0e8;
  padding: 6px 12px 10px;
}

.learning-outcomes h3 {
  margin: 0;
  font-size: 0.78rem;
}

.learning-outcomes > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.learning-outcomes span {
  color: #637083;
  font-size: 0.65rem;
}

.learning-outcomes strong {
  font-size: 0.9rem;
}

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

  .learning-outcomes h3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1120px) {
  .portfolio-paper-table { display: table; min-width: 1120px; }
  .portfolio-paper-table thead { display: table-header-group; }
  .portfolio-paper-table tbody { display: table-row-group; }
  .portfolio-paper-table tr { display: table-row; width: auto; border: 0; background: transparent; margin: 0; }
  .portfolio-paper-table th,
  .portfolio-paper-table td { display: table-cell; width: auto; min-height: 0; position: static; padding: 8px 7px; white-space: nowrap; overflow-wrap: normal; }
  .portfolio-paper-table td::before { content: none; }
}

.learning-summary > div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
  border-right: 1px solid #e0e6ec;
  padding: 10px 14px;
}

.learning-summary > div:last-child {
  border-right: 0;
}

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

.learning-summary span {
  color: #677587;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.learning-summary strong {
  color: #152335;
  font-size: 1rem;
}

.learning-files > header,
.learning-memory > header,
.learning-coverage > header,
.learning-preview > header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e0e6ec;
  padding: 0 14px;
}

.learning-files h3,
.learning-memory h3,
.learning-coverage h3,
.learning-preview h3 {
  font-size: 0.82rem;
}

.learning-files header span,
.learning-memory header span,
.learning-coverage header span,
.learning-preview header span {
  color: #687789;
  font-size: 0.62rem;
}

.learning-file-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e5eaf0;
  color: #172437;
  padding: 8px 14px;
  text-decoration: none;
}

.learning-file-row:last-child {
  border-bottom: 0;
}

.learning-file-row > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.learning-file-row strong,
.learning-file-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-file-row strong { font-size: 0.72rem; }
.learning-file-row small { color: #718092; font-size: 0.62rem; }
.learning-file-row b { color: #1261bc; font-size: 0.65rem; }

#learningObservationList {
  max-height: 252px;
  overflow-y: auto;
}

.learning-observation {
  min-height: 62px;
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) 88px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #e5eaf0;
  padding: 8px 14px;
}

.learning-observation:last-child { border-bottom: 0; }
.learning-observation time,
.learning-observation span { color: #6a7889; font-size: 0.61rem; }
.learning-observation div { min-width: 0; }
.learning-observation strong { font-size: 0.68rem; text-transform: capitalize; }
.learning-observation p {
  margin: 3px 0 0;
  overflow: hidden;
  color: #526174;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-observation span { text-align: right; }
.learning-empty { color: #6a7889; padding: 24px 14px; font-size: 0.68rem; }

#learningCoverageList {
  max-height: 220px;
  overflow-y: auto;
}

.learning-coverage-row {
  min-height: 55px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #e5eaf0;
  padding: 8px 14px;
}

.learning-coverage-row:last-child { border-bottom: 0; }
.learning-coverage-row > span { min-width: 0; display: grid; gap: 3px; }
.learning-coverage-row strong,
.learning-coverage-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learning-coverage-row strong { color: #182638; font-size: 0.7rem; }
.learning-coverage-row small { color: #6b7a8d; font-size: 0.6rem; }
.learning-coverage-row b {
  border: 1px solid #a5c7b8;
  border-radius: 3px;
  background: #eef8f3;
  color: #117349;
  padding: 3px 5px;
  font-size: 0.56rem;
  text-transform: uppercase;
}

.learning-preview pre {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  background: #101d2a;
  color: #d8e4ef;
  padding: 14px;
  font: 0.66rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.insights-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(360px, 0.75fr);
  grid-template-areas:
    "header header"
    "summary summary"
    "market market"
    "hypotheses evidence"
    "hypotheses actions";
  gap: 9px;
}

.insights-header,
.insights-summary,
.insights-market,
.insights-hypotheses,
.insights-evidence,
.insights-actions {
  min-width: 0;
  border: 1px solid #d8e0e8;
  border-radius: 4px;
  background: #ffffff;
}

.insights-header {
  min-height: 66px;
  display: flex;
  grid-area: header;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
}

.insights-header h2 { font-size: 1.05rem; }

.insights-header > span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #d6c581;
  border-radius: 3px;
  background: #fff9e9;
  color: #7c6310;
  padding: 0 9px;
  font-size: 0.65rem;
  font-weight: 850;
}

.insights-header > span.ready {
  border-color: #8ecdb3;
  background: #eaf8f2;
  color: #087a4f;
}

.insights-summary {
  min-height: 68px;
  display: grid;
  grid-area: summary;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.insights-summary > div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
  border-right: 1px solid #e0e6ec;
  padding: 8px 13px;
}

.insights-summary > div:last-child { border-right: 0; }
.insights-summary span { color: #687789; font-size: 0.61rem; font-weight: 750; }
.insights-summary strong { overflow: hidden; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }

.insights-market { grid-area: market; }
.insights-hypotheses { grid-area: hypotheses; }
.insights-evidence { grid-area: evidence; }
.insights-actions { grid-area: actions; }

.insights-market > header,
.insights-hypotheses > header,
.insights-evidence article > header,
.insights-actions article > header {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e0e6ec;
  padding: 0 13px;
}

.insights-market h3,
.insights-hypotheses h3,
.insights-evidence h3,
.insights-actions h3 { font-size: 0.79rem; }

.insights-market header span,
.insights-hypotheses header span { color: #687789; font-size: 0.6rem; }

.insights-market-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insights-market-body > div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  border-right: 1px solid #e0e6ec;
  padding: 9px 13px;
}

.insights-market-body > div:last-child { border-right: 0; }
.insights-market-body span { color: #6b7a8d; font-size: 0.57rem; font-weight: 750; }
.insights-market-body strong { overflow: hidden; font-size: 0.65rem; text-overflow: ellipsis; white-space: nowrap; }
.insights-market-body p {
  margin: 0;
  overflow: hidden;
  color: #35465a;
  font-size: 0.64rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#insightsHypothesisList {
  max-height: 392px;
  overflow-y: auto;
}

.insight-hypothesis {
  border-bottom: 1px solid #e3e9ef;
  padding: 11px 13px;
}

.insight-hypothesis:last-child { border-bottom: 0; }

.insight-hypothesis > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.insight-hypothesis > header strong { font-size: 0.72rem; }

.insight-hypothesis > header span {
  flex: 0 0 auto;
  border: 1px solid #9abde3;
  border-radius: 3px;
  background: #edf5ff;
  color: #165caa;
  padding: 3px 5px;
  font-size: 0.56rem;
  font-weight: 850;
}

.insight-hypothesis > p {
  margin: 6px 0 9px;
  color: #4b5c70;
  font-size: 0.64rem;
  line-height: 1.45;
}

.insight-hypothesis dl { display: grid; gap: 5px; margin: 0; }
.insight-hypothesis dl div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
.insight-hypothesis dt { color: #708093; font-size: 0.58rem; }
.insight-hypothesis dd { margin: 0; color: #26374b; font-size: 0.59rem; line-height: 1.35; }

.insights-evidence,
.insights-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insights-evidence article,
.insights-actions article { min-width: 0; }
.insights-evidence article:first-child,
.insights-actions article:first-child { border-right: 1px solid #e0e6ec; }

.insights-evidence article > div,
.insights-actions article > div {
  max-height: 126px;
  overflow-y: auto;
  padding: 6px 11px;
}

.insights-evidence p,
.insights-actions p {
  position: relative;
  margin: 0;
  border-bottom: 1px solid #edf0f4;
  color: #45566a;
  padding: 7px 4px 7px 14px;
  font-size: 0.6rem;
  line-height: 1.4;
}

.insights-evidence p:last-child,
.insights-actions p:last-child { border-bottom: 0; }

.insights-evidence p::before,
.insights-actions p::before {
  width: 5px;
  height: 5px;
  position: absolute;
  top: 12px;
  left: 1px;
  border-radius: 50%;
  background: #2680eb;
  content: "";
}

.insights-empty { color: #6a7889; padding: 18px 13px; font-size: 0.64rem; line-height: 1.45; }

.analysis-trace {
  margin-top: 18px;
  border-top: 1px solid #dce3ea;
  padding-top: 12px;
}

.analysis-trace h3 {
  margin-bottom: 7px;
  font-size: 0.76rem;
}

.analysis-trace > div {
  min-height: 31px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e5eaf0;
}

.analysis-trace span,
.analysis-trace strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-trace span { color: #6b798a; }
.analysis-trace strong { color: #26364a; }

.live-analysis-panel {
  display: grid;
  gap: 12px;
}

.live-analysis-panel > header,
.live-analysis-events-head {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.live-analysis-panel > header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.live-analysis-panel > header h2 {
  margin: 0;
  font-size: 0.98rem;
}

.live-analysis-panel > header span,
.live-analysis-panel > header time,
.live-analysis-events-head span {
  color: #657385;
  font-size: 0.62rem;
}

.live-analysis-panel > header time {
  flex: 0 0 auto;
  font-weight: 750;
}

.live-analysis-monitor {
  min-width: 0;
  display: grid;
  gap: 5px;
  border: 1px solid #d8e1ea;
  border-left: 4px solid #7f8d9d;
  background: #f7f9fb;
  padding: 9px 10px;
}

.live-analysis-monitor > header,
.live-analysis-monitor > header > span,
.live-analysis-backfill > span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-analysis-monitor > header > span {
  justify-content: flex-start;
}

.live-analysis-monitor > header i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #7f8d9d;
}

.live-analysis-monitor > header strong { color: #26364a; font-size: 0.69rem; }

.live-analysis-monitor > header > b {
  flex: 0 0 auto;
  border: 1px solid #d0d8e1;
  border-radius: 3px;
  background: #ffffff;
  color: #657385;
  padding: 3px 5px;
  font-size: 0.58rem;
  white-space: nowrap;
}

.live-analysis-monitor > header > b.ready {
  border-color: #8ecdb3;
  background: #eaf8f2;
  color: #087a4f;
}

.live-analysis-monitor > div:not(.live-analysis-backfill) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.live-analysis-monitor > div > strong,
.live-analysis-monitor > div > span,
.live-analysis-monitor > p,
.live-analysis-monitor > small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-analysis-monitor > div > strong { color: #26364a; font-size: 0.67rem; }
.live-analysis-monitor > div > span { color: #647388; font-size: 0.59rem; }
.live-analysis-monitor > p { margin: 0; color: #355b83; font-size: 0.58rem; font-weight: 800; }
.live-analysis-monitor > small { color: #6b798b; font-size: 0.56rem; }

.live-analysis-monitor.active {
  border-color: #91bcea;
  border-left-color: #1473e6;
  background: #edf5ff;
}

.live-analysis-monitor.active > header i {
  background: #1473e6;
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

.live-analysis-monitor.complete {
  border-left-color: #129260;
}

.live-analysis-monitor.complete > header i { background: #129260; }

.live-analysis-monitor.error {
  border-color: #efb0b3;
  border-left-color: #d12630;
  background: #fff1f2;
}

.live-analysis-monitor.error > header i { background: #d12630; }

.live-analysis-backfill {
  display: grid;
  gap: 4px;
  margin-top: 2px;
}

.live-analysis-backfill strong,
.live-analysis-backfill small {
  overflow: hidden;
  color: #526174;
  font-size: 0.54rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-analysis-backfill > i {
  height: 4px;
  overflow: hidden;
  background: #d7e0e9;
}

.live-analysis-backfill > i > b {
  height: 100%;
  display: block;
  min-width: 2px;
  background: #1473e6;
}

.live-analysis-current {
  min-width: 0;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid #d8e1ea;
  border-left: 4px solid #7f8d9d;
  background: #f7f9fb;
  padding: 9px 10px;
}

.live-analysis-current > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7f8d9d;
}

.live-analysis-current > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.live-analysis-current strong,
.live-analysis-current span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-analysis-current strong { color: #26364a; font-size: 0.72rem; }
.live-analysis-current span { color: #647388; font-size: 0.61rem; }
.live-analysis-current > b { color: #4f5f73; font-size: 0.61rem; text-align: right; }

.live-analysis-current.active {
  border-color: #91bcea;
  border-left-color: #1473e6;
  background: #edf5ff;
}

.live-analysis-current.active > i {
  background: #1473e6;
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

.live-analysis-current.complete {
  border-left-color: #129260;
  background: #eef9f4;
}

.live-analysis-current.complete > i { background: #129260; }

.live-analysis-current.error {
  border-color: #efb0b3;
  border-left-color: #d12630;
  background: #fff1f2;
}

.live-analysis-current.error > i { background: #d12630; }

.live-analysis-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.live-analysis-steps > div {
  min-width: 0;
  min-height: 39px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 1px solid #dce3ea;
  background: #f7f9fb;
  padding: 6px 7px;
}

.live-analysis-steps i {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e2e7ed;
  color: #657385;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 900;
}

.live-analysis-steps span {
  overflow: hidden;
  color: #526174;
  font-size: 0.59rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-analysis-steps .complete {
  border-color: #a7d7c3;
  background: #eef9f4;
}

.live-analysis-steps .complete i { background: #129260; color: #ffffff; }

.live-analysis-steps .active {
  border-color: #7cb0e8;
  background: #eaf3ff;
  box-shadow: inset 3px 0 #1473e6;
}

.live-analysis-steps .active i {
  background: #1473e6;
  color: #ffffff;
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

.live-analysis-steps .pending { opacity: 0.62; }
.live-analysis-steps .error { border-color: #efb0b3; background: #fff1f2; }
.live-analysis-steps .error i { background: #d12630; color: #ffffff; }

.live-analysis-evidence {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(105px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #a7d7c3;
  border-left: 4px solid #129260;
  background: #eef9f4;
  padding: 9px 10px;
}

.live-analysis-evidence.pending {
  border-color: #9ec3ea;
  border-left-color: #1473e6;
  background: #edf5ff;
}

.live-analysis-evidence > span {
  display: grid;
  gap: 2px;
}

.live-analysis-evidence small,
.live-analysis-evidence p,
.live-analysis-evidence > b {
  margin: 0;
  color: #5b6b7f;
  font-size: 0.59rem;
}

.live-analysis-evidence strong { color: #087a4f; font-size: 0.75rem; }
.live-analysis-evidence.pending strong { color: #1261bc; }
.live-analysis-evidence p { line-height: 1.4; overflow-wrap: anywhere; }
.live-analysis-evidence > b { color: #087a4f; text-align: right; white-space: nowrap; }

.live-analysis-events {
  min-width: 0;
  border-top: 1px solid #dce3ea;
  padding-top: 10px;
}

.live-analysis-events-head {
  align-items: center;
  margin-bottom: 5px;
}

.live-analysis-events-head strong {
  color: #344357;
  font-size: 0.64rem;
  text-transform: uppercase;
}

.live-analysis-events .scanner-trail-row {
  min-height: 31px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  border-left: 1px solid #ccd6e1;
  margin-left: 4px;
  padding: 5px 0 5px 10px;
}

.live-analysis-events .scanner-trail-row i {
  margin-left: -14px;
}

.live-analysis-events .scanner-trail-row span {
  font-size: 0.61rem;
}

.live-analysis-events .scanner-trail-row time {
  color: #7a8796;
  font-size: 0.54rem;
  white-space: nowrap;
}

.model-walkthrough {
  display: grid;
  gap: 10px;
}

.model-walkthrough > header {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid #dce3ea;
  padding-bottom: 10px;
}

.model-walkthrough > header h2 {
  margin: 0;
  font-size: 0.98rem;
}

.model-walkthrough > header span {
  color: #657385;
  font-size: 0.62rem;
}

.walkthrough-live {
  min-height: 34px;
  display: grid;
  grid-template-columns: 8px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #d9e1e9;
  background: #f7f9fb;
  padding: 7px 9px;
}

.walkthrough-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7f8d9d;
}

.walkthrough-live strong { color: #27384d; font-size: 0.63rem; }
.walkthrough-live span {
  overflow: hidden;
  color: #647388;
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.walkthrough-live.active { border-color: #93bdeb; background: #edf5ff; }
.walkthrough-live.active i { background: #1473e6; animation: scanner-pulse 1.2s ease-in-out infinite; }
.walkthrough-live.complete i { background: #129260; }

.walkthrough-step {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  border-bottom: 1px solid #e2e7ed;
  padding: 7px 0 10px;
}

.walkthrough-step > b {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e8f2ff;
  color: #1261bc;
  font-size: 0.63rem;
}

.walkthrough-step.complete > b {
  background: #e8f7f1;
  color: #087a4f;
}

.walkthrough-step.active {
  border: 1px solid #8fbbea;
  border-left: 4px solid #1473e6;
  background: #edf5ff;
  padding: 9px 8px;
}

.walkthrough-step.active > b {
  background: #1473e6;
  color: #ffffff;
  animation: scanner-pulse 1.2s ease-in-out infinite;
}

.walkthrough-step.pending { opacity: 0.52; }

.walkthrough-step > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.walkthrough-step strong {
  color: #243449;
  font-size: 0.69rem;
}

.walkthrough-step p,
.model-evidence-column li {
  margin: 0;
  color: #607084;
  font-size: 0.61rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.model-evidence-column {
  min-width: 0;
  border: 1px solid #d9e0e7;
  padding: 9px;
}

.model-evidence-column.support { border-left: 3px solid #129260; }
.model-evidence-column.concern { border-left: 3px solid #d39b19; }

.model-evidence-column strong {
  display: block;
  margin-bottom: 5px;
  color: #344357;
  font-size: 0.64rem;
}

.model-evidence-column ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 15px;
}

.research-metrics .expected-metric strong {
  font-size: 1.65rem;
}

.decision-gate-row.review { color: #a36b00; }

@media (max-width: 1340px) {
  .dashboard-view {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .decision-workspace {
    height: auto;
    min-height: 100%;
    grid-template-columns: 270px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "queue review"
      "queue scenario"
      "evidence execution";
  }

  body[data-workspace-view="scans"] .trade-main .dashboard-grid {
    overflow: auto;
  }

  .decision-queue-panel {
    min-height: 760px;
  }

  .decision-side-panel {
    border-top: 1px solid #d9e0e7;
  }

  .decision-evidence-panel {
    border-right: 1px solid #d9e0e7;
  }

  .learning-workspace {
    grid-template-columns: 1fr;
  }

  .learning-header,
  .learning-summary,
  .learning-coverage,
  .learning-preview {
    grid-column: 1;
  }

}

@media (max-width: 1020px) {
  .insights-workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "summary"
      "market"
      "hypotheses"
      "evidence"
      "actions";
  }
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .dashboard-view {
    width: 100%;
    height: auto;
    min-height: 100vh;
    display: block;
    overflow: visible;
  }

  .trade-sidebar {
    display: block;
  }

  .sidebar-brand {
    min-height: 52px;
  }

  .sidebar-ledger,
  .sidebar-footer {
    display: none;
  }

  .trade-sidebar .workspace-tabs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    padding: 0;
  }

  .trade-sidebar .workspace-tab {
    min-height: 46px;
    justify-content: center;
    gap: 5px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    padding: 5px;
    font-size: 0.61rem;
  }

  .trade-sidebar .workspace-tab::before,
  .trade-sidebar .workspace-tab strong {
    display: none;
  }

  .trade-main {
    display: block;
  }

  .trade-main .workspace-chrome {
    position: static;
  }

  .trade-main .workspace-summary {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 0;
    padding: 8px 12px;
  }

  .trade-main .workspace-summary-item {
    min-height: 47px;
    border-right: 0;
    border-bottom: 1px solid #e2e7ed;
    padding: 5px 8px;
  }

  .trade-main .workspace-summary-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .trade-main .workspace-summary-item:nth-child(3) {
    display: none;
  }

  .trade-main .dashboard-grid,
  body[data-workspace-view="scans"] .trade-main .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px;
    overflow: visible;
  }

  .decision-workspace {
    height: auto;
    min-height: 0;
    display: block;
    border: 1px solid #d9e0e7;
  }

  .decision-queue-panel,
  .decision-review-panel,
  .decision-side-panel,
  .decision-evidence-panel,
  .decision-execution-panel {
    border: 0;
    border-bottom: 1px solid #d9e0e7;
  }

  .decision-queue-panel {
    min-height: 0;
  }

  .decision-queue-list {
    height: auto;
    max-height: 330px;
  }

  .scanner-activity {
    padding: 10px;
  }

  .selected-decision-head {
    align-items: flex-start;
  }

  .selected-decision-head > div:first-child {
    display: grid;
    gap: 3px;
  }

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

  .decision-metrics .expected-metric {
    min-height: 100px;
    grid-column: 1 / -1;
    grid-row: auto;
    border-right: 0;
    border-bottom: 1px solid #d9e0e7;
  }

  .decision-metrics > div:nth-child(4),
  .decision-metrics > div:last-child,
  .decision-metrics > div:nth-last-child(-n + 3) {
    border-right: 1px solid #d9e0e7;
    border-bottom: 1px solid #d9e0e7;
  }

  .decision-metrics > div:nth-child(odd):not(.expected-metric) {
    border-right: 0;
  }

  .decision-metrics > div:last-child {
    border-bottom: 0;
  }

  .decision-subhead,
  .decision-reason,
  .outcome-distribution > div:first-child,
  .distribution-legend {
    align-items: flex-start;
    flex-direction: column;
  }

  .decision-reason button {
    width: 100%;
  }

  .scenario-cards {
    grid-template-columns: 1fr;
  }

  .model-evidence-columns {
    grid-template-columns: 1fr;
  }

  .decision-evidence-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
    padding: 9px;
  }

  .decision-evidence-list strong,
  .decision-evidence-list span,
  .decision-evidence-list time {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .learning-workspace {
    display: grid;
    grid-template-columns: 1fr;
  }

  .learning-header,
  .learning-header-actions,
  .learning-summary {
    align-items: stretch;
  }

  .learning-header {
    flex-direction: column;
  }

  .learning-header-actions {
    display: grid;
  }

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

  .learning-summary > div {
    border-bottom: 1px solid #e0e6ec;
  }

  .learning-observation {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .learning-observation span {
    text-align: left;
  }

  .insights-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .insights-summary > div {
    border-bottom: 1px solid #e0e6ec;
  }

  .insights-summary > div:nth-child(even) { border-right: 0; }
  .insights-summary > div:last-child { grid-column: 1 / -1; border-bottom: 0; }

  .insights-evidence,
  .insights-actions { grid-template-columns: 1fr; }
  .insights-evidence article:first-child,
  .insights-actions article:first-child { border-right: 0; border-bottom: 1px solid #e0e6ec; }

  .insight-hypothesis dl div { grid-template-columns: 1fr; gap: 2px; }

  .insights-market-body { grid-template-columns: 1fr; }
  .insights-market-body > div { border-right: 0; border-bottom: 1px solid #e0e6ec; }
  .insights-market-body > div:last-child { border-bottom: 0; }
  .insights-market-body strong,
  .insights-market-body p { white-space: normal; }
}

/* Portfolio workspace */
.sr-only {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.trade-sidebar .workspace-tab::before {
  display: none;
}

.workspace-tab-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: #dce8f4;
  stroke-width: 2;
}

.trade-sidebar .workspace-tab.active .workspace-tab-icon {
  color: #ffffff;
}

body[data-workspace-view="holdings"] .trade-main .dashboard-grid {
  display: block;
  padding: 0;
  overflow: hidden;
}

.portfolio-workspace {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 68px 94px max-content minmax(410px, 1fr) 170px 94px;
  background: #ffffff;
  color: #17202c;
  overflow-y: auto;
}

.portfolio-paper {
  min-width: 0;
  border-bottom: 1px solid #d9e0e7;
  padding: 13px 24px 16px;
}

.portfolio-paper > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.portfolio-paper > header > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.portfolio-paper h3 {
  margin: 0;
  font-size: 0.88rem;
}

.portfolio-paper header span {
  color: #637083;
  font-size: 0.7rem;
  font-weight: 700;
}

.portfolio-paper-totals {
  display: flex;
  align-items: baseline;
  gap: 14px;
  white-space: nowrap;
}

.portfolio-paper-totals strong {
  font-size: 0.9rem;
}

.portfolio-paper-table .cell-subtext {
  display: block;
}

.portfolio-paper .portfolio-table-wrap { overflow-x: auto; }
.portfolio-paper-table { min-width: 1120px; table-layout: auto; }
.portfolio-table.portfolio-paper-table { min-width: 1360px; }
.portfolio-paper-table td:nth-child(6) { min-width: 250px; white-space: normal; line-height: 1.4; }
.portfolio-paper-table th,
.portfolio-paper-table td { overflow: visible; text-overflow: clip; }

.portfolio-paper-table .portfolio-paper-closed {
  color: #667286;
  background: #f7f9fb;
}

.portfolio-paper-table a {
  color: #1261b2;
  font-weight: 700;
}

.portfolio-paper-status {
  margin: 8px 0 0;
  color: #637083;
  font-size: 0.7rem;
  line-height: 1.35;
}

.portfolio-paper-review { display: grid; gap: 6px; max-height: 110px; overflow-y: auto; margin-top: 8px; font-size: 0.7rem; }
.portfolio-paper-review > strong { color: #304258; }
.portfolio-paper-review > div { display: flex; gap: 8px; color: #5f6e81; }
.portfolio-paper-review b { min-width: 54px; color: #172b45; }
.portfolio-paper-review span { min-width: 0; overflow-wrap: anywhere; }

.decision-load-more {
  display: block;
  width: calc(100% - 16px);
  margin: 8px;
  padding: 9px;
  border: 1px solid #cbd6e4;
  border-radius: 4px;
  background: #fff;
  color: #1261b2;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.decision-load-more[hidden] { display: none; }
.decision-load-more:disabled { opacity: 0.55; cursor: wait; }

@media (max-width: 820px) {
  .portfolio-paper > header,
  .portfolio-paper > header > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .portfolio-paper-totals {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
}

.portfolio-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #d9e0e7;
  padding: 0 24px;
}

.portfolio-header > div:first-child {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.portfolio-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.portfolio-header p {
  margin: 0;
  color: #637083;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.portfolio-actions select,
.portfolio-actions button {
  height: 38px;
  border: 1px solid #cfd8e2;
  border-radius: 4px;
  background: #ffffff;
  color: #17202c;
}

.portfolio-actions select {
  min-width: 150px;
  padding: 0 34px 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.portfolio-actions button {
  width: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.portfolio-actions button:hover,
.portfolio-actions button:focus-visible {
  border-color: #2580f7;
  color: #1168cc;
  outline: 2px solid rgba(37, 128, 247, 0.18);
  outline-offset: 1px;
}

.portfolio-actions svg {
  width: 18px;
  height: 18px;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  border-bottom: 1px solid #d9e0e7;
  padding: 12px 24px;
}

.portfolio-summary > div {
  min-width: 0;
  display: grid;
  gap: 7px;
  border-right: 1px solid #d9e0e7;
  padding: 0 20px;
  text-align: center;
}

.portfolio-summary > div:first-child {
  padding-left: 0;
}

.portfolio-summary > div:last-child {
  border-right: 0;
  padding-right: 0;
}

.portfolio-summary span,
.portfolio-performance span {
  color: #637083;
  font-size: 0.68rem;
  font-weight: 700;
}

.portfolio-summary strong {
  overflow: hidden;
  font-size: clamp(1rem, 1.45vw, 1.42rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-main-grid {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(600px, 1.85fr) minmax(400px, 1fr);
  border-bottom: 1px solid #d9e0e7;
}

.portfolio-holdings,
.portfolio-position-detail,
.portfolio-completed {
  min-width: 0;
  min-height: 0;
}

.portfolio-holdings {
  padding: 14px 18px 10px 24px;
  overflow: hidden;
}

.portfolio-holdings > header,
.portfolio-completed > header {
  min-height: 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portfolio-holdings h3,
.portfolio-completed h3,
.portfolio-position-detail h3,
.portfolio-performance h3 {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.2;
}

.portfolio-holdings > header span,
.portfolio-completed > header span {
  color: #637083;
  font-size: 0.68rem;
  font-weight: 700;
}

.portfolio-table-wrap {
  min-width: 0;
  overflow: hidden;
}

.portfolio-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.portfolio-table th,
.portfolio-table td {
  border-bottom: 1px solid #e1e7ed;
  padding: 8px 7px;
  overflow: hidden;
  font-size: 0.67rem;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-table th {
  color: #58677a;
  font-size: 0.61rem;
  font-weight: 700;
}

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

.portfolio-table tbody tr:hover,
.portfolio-table tbody tr:focus-visible,
.portfolio-table tbody tr.selected {
  background: #edf5ff;
  outline: none;
}

.portfolio-table tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 #1477e6;
}

.portfolio-table td strong {
  color: #075ec8;
}

.portfolio-table th:nth-child(1) { width: 8%; }
.portfolio-table th:nth-child(2) { width: 14%; }
.portfolio-table th:nth-child(3) { width: 10%; }
.portfolio-table th:nth-child(4) { width: 10%; }
.portfolio-table th:nth-child(5) { width: 9%; }
.portfolio-table th:nth-child(6) { width: 13%; }
.portfolio-table th:nth-child(7) { width: 10%; }
.portfolio-table th:nth-child(8) { width: 10%; }
.portfolio-table th:nth-child(9) { width: 11%; }
.portfolio-table th:nth-child(10) { width: 5%; }

.portfolio-row-action {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #526173;
  padding: 0;
}

.portfolio-row-action:hover,
.portfolio-row-action:focus-visible {
  background: #dcecff;
  color: #075ec8;
  outline: none;
}

.portfolio-row-action svg {
  width: 16px;
  height: 16px;
}

.portfolio-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border: 1px solid #bfc9d4;
  border-radius: 3px;
  background: #f2f5f8;
  color: #4b5969;
  padding: 2px 6px;
  font-size: 0.57rem;
  font-weight: 800;
}

.portfolio-status.live {
  border-color: #7cc8a8;
  background: #eaf8f1;
  color: #087846;
}

.portfolio-status.shadow {
  border-color: #aab8c6;
  background: #eef2f6;
  color: #435263;
}

.portfolio-position-detail {
  border-left: 1px solid #d9e0e7;
  padding: 14px 20px 12px;
  overflow: auto;
  scrollbar-width: thin;
}

.portfolio-position-detail > header p {
  margin: 5px 0 0;
  color: #536173;
  font-size: 0.67rem;
  font-weight: 600;
}

.portfolio-position-detail > header p span {
  margin: 0 5px;
  color: #98a3af;
}

.portfolio-rationale {
  margin: 10px 0;
  color: #263342;
  font-size: 0.68rem;
  line-height: 1.45;
}

.portfolio-economics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  border-top: 1px solid #e1e7ed;
  border-bottom: 1px solid #e1e7ed;
  padding: 7px 0;
}

.portfolio-economics > div {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 8px 3px 0;
}

.portfolio-economics > div:nth-child(even) {
  border-left: 1px solid #e1e7ed;
  padding-right: 0;
  padding-left: 10px;
}

.portfolio-economics dt,
.portfolio-economics dd {
  margin: 0;
  font-size: 0.63rem;
  line-height: 1.25;
}

.portfolio-economics dt {
  color: #536173;
}

.portfolio-economics dd {
  color: #17202c;
  font-weight: 750;
  text-align: right;
}

.portfolio-gates {
  margin-top: 9px;
}

.portfolio-gates h4 {
  margin: 0 0 4px;
  font-size: 0.68rem;
}

.portfolio-gates > div {
  min-height: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e5eaf0;
  font-size: 0.61rem;
}

.portfolio-gates > div strong {
  color: #c92525;
  font-size: 0.57rem;
}

.portfolio-gates > div.pass strong { color: #07814b; }
.portfolio-gates > div.review strong { color: #ac6a00; }

.portfolio-timeline-warning {
  margin-top: 9px;
  border: 1px solid #e9aa3a;
  border-radius: 4px;
  background: #fff8e8;
  padding: 8px 10px;
}

.portfolio-timeline-warning strong,
.portfolio-timeline-warning p {
  font-size: 0.61rem;
}

.portfolio-timeline-warning strong {
  color: #945c00;
}

.portfolio-timeline-warning p {
  margin: 3px 0 0;
  color: #6c4b16;
  line-height: 1.35;
}

.portfolio-execution-note {
  margin-top: 8px;
  border: 1px solid #d5dde5;
  border-radius: 3px;
  background: #f5f7f9;
  color: #536173;
  padding: 7px 9px;
  font-size: 0.59rem;
  font-weight: 650;
}

.portfolio-position-detail > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.portfolio-position-detail > footer span {
  display: flex;
  gap: 7px;
  color: #84909c;
  font-size: 0.61rem;
}

.portfolio-position-detail > footer a {
  color: #075ec8;
  font-weight: 750;
}

.portfolio-position-detail > footer i {
  font-style: normal;
}

.portfolio-position-detail > footer button {
  border: 0;
  background: transparent;
  color: #075ec8;
  padding: 3px 0;
  font-size: 0.61rem;
  font-weight: 800;
}

.portfolio-detail-empty {
  height: 100%;
  display: grid;
  place-content: center;
  gap: 5px;
  color: #637083;
  text-align: center;
}

.portfolio-detail-empty strong {
  color: #273444;
  font-size: 0.82rem;
}

.portfolio-detail-empty span {
  font-size: 0.68rem;
}

.decision-purchase-rationale {
  border-bottom: 1px solid #d9e0e7;
  background: #f7fbff;
  padding: 10px 14px;
}

.decision-purchase-rationale h3 {
  margin: 0 0 4px;
  color: #17202c;
  font-size: 0.72rem;
}

.decision-purchase-rationale p {
  margin: 0;
  color: #4d5b6b;
  font-size: 0.65rem;
  line-height: 1.4;
}

.price-tracking-strip {
  border-bottom: 1px solid #cfe0d8;
  background: #f3fbf7;
  box-shadow: inset 4px 0 #129260;
  padding: 10px 14px;
}

.price-tracking-strip.inactive {
  border-color: #d9e0e7;
  background: #f6f8fa;
  box-shadow: inset 4px 0 #7b8796;
}

.price-tracking-strip > header,
.price-tracking-strip > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price-tracking-strip > header div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price-tracking-strip h3 {
  margin: 0;
  color: #17202c;
  font-size: 0.73rem;
}

.price-tracking-strip > header span,
.price-tracking-strip > footer span,
.price-tracking-strip > footer b {
  color: #59687a;
  font-size: 0.58rem;
  font-weight: 750;
}

.price-tracking-strip > header > b {
  border: 1px solid #8ecdb3;
  border-radius: 3px;
  background: #e5f7ef;
  color: #087a4f;
  padding: 3px 6px;
  font-size: 0.58rem;
  white-space: nowrap;
}

.price-tracking-strip > div {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 8px 0;
  background: #d9e6df;
}

.price-tracking-strip > div > span {
  min-width: 0;
  display: grid;
  gap: 3px;
  background: #ffffff;
  padding: 7px 8px;
}

.price-tracking-strip small {
  color: #687789;
  font-size: 0.55rem;
  font-weight: 750;
}

.price-tracking-strip strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #26364a;
  font-size: 0.72rem;
}

.price-tracking-strip > footer b {
  color: #087a4f;
  white-space: nowrap;
}

.portfolio-completed {
  border-bottom: 1px solid #d9e0e7;
  padding: 12px 24px 8px;
  overflow: hidden;
}

.portfolio-completed > header strong {
  margin-left: 6px;
}

.portfolio-table.completed th,
.portfolio-table.completed td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.portfolio-table.completed th:nth-child(1) { width: 8%; }
.portfolio-table.completed th:nth-child(2) { width: 13%; }
.portfolio-table.completed th:nth-child(3) { width: 13%; }
.portfolio-table.completed th:nth-child(4) { width: 10%; }
.portfolio-table.completed th:nth-child(5) { width: 10%; }
.portfolio-table.completed th:nth-child(6) { width: 10%; }
.portfolio-table.completed th:nth-child(7) { width: 9%; }
.portfolio-table.completed th:nth-child(8) { width: 11%; }
.portfolio-table.completed th:nth-child(9) { width: 8%; }
.portfolio-table.completed th:nth-child(10) { width: 8%; }

.portfolio-table.completed tbody tr {
  cursor: default;
}

.portfolio-table.completed tbody tr:hover {
  background: #fafbfd;
}

.portfolio-performance {
  display: grid;
  grid-template-columns: 1.15fr repeat(5, minmax(0, 1fr));
  align-items: center;
  padding: 10px 24px 12px;
}

.portfolio-performance > div {
  min-width: 0;
  display: grid;
  gap: 5px;
  border-left: 1px solid #d9e0e7;
  padding: 0 18px;
  text-align: center;
}

.portfolio-performance strong {
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  body[data-workspace-view="holdings"] .trade-main .dashboard-grid {
    overflow: auto;
  }

  .portfolio-workspace {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto;
    overflow: visible;
  }

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

  .portfolio-position-detail {
    border-top: 1px solid #d9e0e7;
    border-left: 0;
    overflow: visible;
  }
}

@media (max-width: 820px) {
  .trade-sidebar .workspace-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .trade-sidebar .workspace-tab {
    flex-direction: column;
  }

  .trade-sidebar .workspace-tab .workspace-tab-icon {
    display: block;
    width: 17px;
    height: 17px;
  }

  body[data-workspace-view="holdings"] .trade-main .dashboard-grid {
    display: block;
    padding: 0;
  }

  .portfolio-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .portfolio-header > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .portfolio-actions,
  .portfolio-actions select {
    width: 100%;
  }

  .portfolio-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 16px;
  }

  .portfolio-summary > div {
    min-height: 64px;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid #e1e7ed;
    padding: 8px;
  }

  .portfolio-summary > div:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .portfolio-holdings,
  .portfolio-paper,
  .portfolio-position-detail,
  .portfolio-completed,
  .portfolio-performance {
    padding: 14px 16px;
  }

  .portfolio-table-wrap {
    overflow-x: auto;
  }

  .portfolio-table {
    min-width: 900px;
  }

  .portfolio-performance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 0;
  }

  .portfolio-performance h3 {
    grid-column: 1 / -1;
  }
}
