/* Brand palette (purple + green), read by both the badges and the Plotly charts. */
:root {
  --investment-direct: #7a005e;
  --investment-shared: #3d8664;
  --investment-system: #a8508f;
  --investment-emerging: #6fb08f;
}

html[data-theme='dark'] {
  --investment-direct: #d08bbd;
  --investment-shared: #52a582;
  --investment-system: #b86aa3;
  --investment-emerging: #7fc0a0;
}

.investment-outlook-shell {
  display: grid;
  gap: 1.25rem;
}

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

.investment-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-block: 1px solid var(--border);
  background: var(--surface-2);
}

.investment-kpi-strip > div {
  min-width: 0;
  padding: 1rem;
  border-right: 1px solid var(--border);
}

.investment-kpi-strip > div:last-child {
  border-right: 0;
}

.investment-kpi-strip span,
.investment-phase-control > span,
.investment-reactor-control > span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.investment-kpi-strip strong {
  display: block;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
}

.investment-kpi-strip .primary strong {
  color: var(--primary);
}

.investment-kpi-strip small {
  display: block;
  margin-top: 0.3rem;
  color: var(--text-faint);
  font-size: 0.7rem;
  line-height: 1.3;
}

.investment-control-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.65fr);
  gap: 1rem;
  align-items: end;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.investment-segments {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}

.investment-segments button {
  min-height: 34px;
  padding: 0.42rem 0.75rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: 600 0.76rem var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

.investment-segments button:hover {
  color: var(--text);
}

.investment-segments button.active {
  background: var(--surface);
  color: var(--investment-direct);
  box-shadow: 0 1px 3px rgba(20, 20, 20, 0.12);
}

.investment-reactor-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 0.25rem 0.75rem;
  align-items: center;
}

.investment-reactor-control > span {
  margin: 0;
}

.investment-reactor-control input {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 78px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font: 700 0.9rem var(--font-mono);
  text-align: center;
}

.investment-reactor-control small {
  display: block;
  color: var(--text-faint);
  font-size: 0.68rem;
  line-height: 1.35;
}

.investment-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1rem;
}

.investment-chart-panel {
  min-width: 0;
  border-block: 1px solid var(--border);
  background: var(--surface);
}

.investment-chart-panel > header,
.investment-timeline-band > header,
.investment-portfolio-band > header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 0;
}

.investment-chart-panel h2,
.investment-timeline-band h2,
.investment-portfolio-band h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 700;
}

.investment-chart-panel header p,
.investment-timeline-band header p,
.investment-portfolio-band header p {
  max-width: 760px;
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.investment-chart {
  min-height: 385px;
  width: 100%;
}

.investment-chart.emissions {
  min-height: 385px;
}

.investment-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  color: var(--text-muted);
}

.investment-timeline-band,
.investment-portfolio-band {
  border-top: 1px solid var(--border);
}

.investment-timeline-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--border);
}

.investment-time-column {
  min-width: 0;
  padding: 0.85rem;
  background: var(--surface-2);
}

.investment-time-column > strong {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
}

.investment-time-column > span {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: start;
  min-height: 34px;
  padding: 0.4rem 0;
  border-top: 1px solid var(--divider);
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.investment-time-column > span.disabled {
  opacity: 0.42;
}

.investment-time-column i {
  width: 7px;
  height: 7px;
  margin-top: 0.25rem;
  border-radius: 50%;
  background: var(--investment-direct);
}

.investment-time-column i.shared {
  background: var(--investment-shared);
}

.investment-time-column i.system {
  background: var(--investment-system);
}

.investment-time-column b {
  color: var(--text-faint);
  font: 600 0.66rem var(--font-mono);
}

.investment-reset {
  min-height: 36px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-muted);
  font: 600 0.74rem var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

.investment-reset:hover {
  border-color: var(--investment-direct);
  color: var(--investment-direct);
}

.investment-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.investment-table {
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
  background: var(--surface);
  table-layout: fixed;
}

.investment-table th,
.investment-table td {
  padding: 0.72rem;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: top;
}

.investment-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

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

.investment-table tbody tr.disabled td {
  opacity: 0.42;
  background: var(--surface-2);
}

.investment-table td > strong,
.investment-cost-cell strong {
  display: block;
  color: var(--text);
  font-size: 0.74rem;
  line-height: 1.35;
}

.investment-table td > small,
.investment-cost-cell small,
.investment-trl {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-faint);
  font-size: 0.66rem;
  line-height: 1.35;
}

.investment-tech-name label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
  cursor: pointer;
}

.investment-tech-name input {
  width: 15px;
  height: 15px;
  margin-top: 0.15rem;
  accent-color: var(--investment-direct);
}

.investment-tech-name strong {
  display: block;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
}

.investment-tech-name small {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.investment-scope,
.investment-status {
  display: inline-block;
  padding: 0.28rem 0.42rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.25;
}

.investment-scope.direct,
.investment-status.ready {
  background: rgba(122, 0, 94, 0.09);
  color: var(--investment-direct);
}

.investment-scope.shared,
.investment-status.scaling {
  background: rgba(61, 134, 100, 0.12);
  color: var(--investment-shared);
}

.investment-scope.system,
.investment-status.system,
.investment-status.conditional {
  background: rgba(168, 80, 143, 0.12);
  color: var(--investment-system);
}

.investment-status.emerging {
  background: rgba(111, 176, 143, 0.16);
  color: var(--investment-emerging);
}

.investment-confidence {
  display: block;
  width: 62px;
  height: 6px;
  margin-top: 0.25rem;
  overflow: hidden;
  border-radius: 3px;
  background: var(--divider);
}

.investment-confidence b {
  display: block;
  height: 100%;
  background: var(--investment-direct);
}

.investment-assumption-band {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  border-left: 3px solid var(--investment-system);
  background: var(--surface-2);
}

.investment-assumption-band strong {
  color: var(--text);
  font-size: 0.78rem;
}

.investment-assumption-band p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.investment-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  color: var(--text-faint);
  font-size: 0.67rem;
}

.investment-sources span {
  font-weight: 700;
}

.investment-sources a {
  color: var(--primary);
  text-decoration: none;
}

.investment-sources a:hover {
  text-decoration: underline;
}

html[data-theme='dark'] .investment-segments button.active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.38);
}

@media (max-width: 1280px) {
  .investment-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .investment-kpi-strip > div:nth-child(3n) {
    border-right: 0;
  }

  .investment-kpi-strip > div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .investment-analysis-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .investment-control-band,
  .investment-assumption-band {
    grid-template-columns: 1fr;
  }

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

  .investment-chart-panel > header,
  .investment-portfolio-band > header {
    flex-direction: column;
  }

  .investment-segments {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .investment-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .investment-kpi-strip > div,
  .investment-kpi-strip > div:nth-child(3n) {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .investment-kpi-strip > div:nth-child(2n) {
    border-right: 0;
  }

  .investment-kpi-strip > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .investment-kpi-strip strong {
    font-size: 1.25rem;
  }

  .investment-control-band {
    padding: 0.75rem;
  }

  .investment-phase-control .investment-segments,
  .investment-chart-panel .investment-segments {
    grid-auto-flow: row;
  }

  .investment-reactor-control {
    grid-template-columns: minmax(0, 1fr) 68px;
  }

  .investment-timeline-grid {
    grid-template-columns: 1fr;
  }

  .investment-chart-panel .investment-chart {
    overflow-x: auto;
  }
}
