:root {
  color-scheme: light;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f4f1ec;
  color: #1f2a2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(247, 244, 238, 0.96), rgba(236, 240, 237, 0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M0 79h80M1 0v80' stroke='%23d4d8d2' stroke-width='1' opacity='.45'/%3E%3C/svg%3E");
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #16697a;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 1050px;
  margin-bottom: 10px;
  font-size: clamp(1.55rem, 1.75vw, 1.75rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 3px;
  font-size: 1.06rem;
}

h3 {
  margin-bottom: 0;
  font-size: 0.96rem;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: #5f696b;
  font-size: 1.02rem;
  line-height: 1.55;
}

.primary-action,
.ghost-button,
.select-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  background: #16697a;
  color: #fff;
  box-shadow: 0 12px 30px rgba(22, 105, 122, 0.2);
}

.run-action {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.simulation-action-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.simulation-running-message {
  max-width: 260px;
  margin: 0;
  color: #5f696b;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.35;
  text-align: right;
}

.button-spinner,
.simulation-spinner {
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.button-spinner {
  width: 16px;
  height: 16px;
}

.simulation-spinner {
  width: 30px;
  height: 30px;
  color: #16697a;
}

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

.ghost-button,
.select-button {
  padding: 0 14px;
  border-color: #ccd6d4;
  background: #fff;
  color: #243235;
}

.secondary-action {
  border-color: #8fb4af;
  background: #edf6f4;
  color: #16697a;
  box-shadow: none;
}

.ghost-button:disabled,
.primary-action:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.compact-action {
  min-height: 34px;
  padding: 0 12px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #f4d7d2;
  color: #842316;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel,
.metric-card,
.empty-state {
  border: 1px solid rgba(36, 50, 53, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 60px rgba(35, 47, 46, 0.08);
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-heading,
.cashflow-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading p {
  margin-bottom: 0;
  color: #667174;
  font-size: 0.9rem;
}

.scenario-list {
  display: grid;
  gap: 12px;
}

.side-form {
  display: grid;
  gap: 12px;
}

.model-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 12px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  background: #fbfcfa;
}

.scenario-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: end;
}

.scenario-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0.46fr 34px;
  gap: 8px;
  align-items: end;
}

.scenario-save-panel {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.collapsible-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.collapse-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #b9ccd7;
  border-radius: 8px;
  background: #fff;
  color: #16697a;
}

.collapse-arrow {
  width: 9px;
  height: 9px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}

.collapse-arrow.is-expanded {
  transform: translateY(2px) rotate(-135deg);
}

.saved-scenarios-content {
  display: grid;
  gap: 10px;
}

.save-scenario-button {
  width: 100%;
  grid-column: span 2;
}

.saved-scenario-select {
  min-width: 0;
}

.delete-scenario-button {
  align-self: end;
}

.scenario-message {
  margin: 0;
  color: #536064;
  font-size: 0.86rem;
  font-weight: 700;
}

.field-error {
  margin: 0;
  color: #9b2c1f;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.planner-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 42, 46, 0.62);
}

.planner-modal {
  width: min(980px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow-y: auto;
  background: #fff;
}

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

.planner-solve-for {
  display: grid;
  grid-template-columns: max-content minmax(180px, 260px);
  gap: 8px;
  align-items: center;
  width: fit-content;
  margin-bottom: 16px;
  color: #526064;
  font-size: 0.86rem;
  font-weight: 850;
}

.planner-solve-for select {
  min-height: 38px;
  border: 1px solid #cfd8d5;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: #243235;
}

.planner-section {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  background: #fbfcfa;
}

.planner-fields {
  display: grid;
  gap: 10px;
}

.planner-fields.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.planner-fields label {
  display: grid;
  gap: 5px;
  align-content: start;
  color: #526064;
  font-size: 0.8rem;
  font-weight: 800;
}

.planner-fields .tooltip-label,
.planner-solve-for .tooltip-label {
  width: fit-content;
}

.planner-fields .tooltip-card,
.planner-solve-for .tooltip-card {
  font-size: 0.92rem;
}

.planner-fields input,
.planner-fields select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd8d5;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: #243235;
}

.planner-fields input.planner-calculated-input:disabled {
  border-color: #8fb4af;
  background: #edf6f4;
  color: #16697a;
  font-weight: 900;
  opacity: 1;
}

.planner-message {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 850;
  white-space: pre-line;
}

.planner-message-success {
  background: #d8f3dc;
  color: #1b5e20;
}

.planner-message-error {
  background: #f8b4ad;
  color: #7f1d1d;
}

.planner-running {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #16697a;
  font-size: 0.9rem;
  font-weight: 850;
}

.planner-progress {
  position: relative;
  width: min(360px, 100%);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe8e5;
}

.planner-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: #16697a;
  animation: planner-progress 1s ease-in-out infinite;
}

@keyframes planner-progress {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(260%);
  }
}

.planner-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 16px;
}

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

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

.advanced-toggle {
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 8px;
  margin-bottom: 0;
  color: #344144;
  font-size: 0.86rem;
  font-weight: 850;
  text-transform: none;
}

.advanced-toggle input {
  margin: 0;
}

.reseed-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.reseed-button {
  min-height: 30px;
  padding: 0 10px;
  border-color: #d8dfdc;
  color: #526064;
  font-size: 0.76rem;
  box-shadow: none;
}

.reseed-control .tooltip-label b {
  width: 15px;
  height: 15px;
  font-size: 0.68rem;
}

.plan-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.plan-row label {
  grid-template-rows: 1.2em 40px;
}

.plan-row label > span {
  min-height: 0;
  align-items: end;
}

.assumption-row {
  display: grid;
  gap: 10px;
}

.assumption-row.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assumption-row.one-column {
  grid-template-columns: 1fr;
}

.assumption-row.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.assumption-row label span {
  min-height: 2em;
  display: flex;
  align-items: end;
}

.allocation-group {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #e1e6e3;
}

.allocation-group h3 {
  color: #344144;
}

.calculated-return {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  color: #536064;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.calculated-return span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 8px;
  background: #eef5f2;
}

.calculated-return .tooltip-label {
  grid-template-columns: auto 16px;
  align-items: center;
}

.calculated-return .tooltip-label strong {
  grid-column: 1 / -1;
}

.calculated-return strong {
  color: #16697a;
  font-size: 1rem;
}

.scenario-editor {
  display: grid;
  gap: 12px;
}

.scenario-editor.active {
  border-color: #16697a;
  box-shadow: inset 4px 0 0 #16697a;
}

.scenario-save-panel,
.scenario-editor,
.side-section {
  padding: 14px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  background: #fbfcfa;
}

.scenario-save-panel {
  border-color: #c8d8e1;
  background: #f3f7fa;
}

.side-section {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.side-section .panel-heading {
  margin-bottom: 0;
}

.scenario-topline,
.check-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.check-label {
  justify-content: start;
  color: #526064;
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 24px;
}

.model-options .check-label input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
}

.model-options .check-label {
  font-size: 0.72rem;
}

.model-options .tooltip-label b {
  width: 14px;
  height: 14px;
  font-size: 0.62rem;
}

label,
.field-label {
  display: grid;
  gap: 6px;
  color: #536064;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field-hint {
  display: block;
  color: #6b7678;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #ccd6d4;
  border-radius: 8px;
  background: #fff;
  color: #1f2a2e;
  padding: 8px 10px;
  font-size: 0.94rem;
  font-weight: 600;
  text-transform: none;
}

.highlight-input {
  border-color: #9bc7a4;
  background: #eef9f0;
}

textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.35;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.return-tax-field {
  gap: 10px;
}

.segmented-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(116px, 1fr));
  gap: 8px;
}

.tax-mode-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  background: #fff;
  color: #536064;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.tax-rate-table {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.tax-rate-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 8px;
  border-radius: 7px;
  background: #f6f8f6;
  color: #344144;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: none;
}

.tax-rate-header {
  background: transparent;
  color: #6d777a;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

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

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

.main-panel,
.results-grid {
  display: grid;
  gap: 18px;
}

.simulation-running-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  border-color: #8fb4af;
  background: #f5fbf8;
}

.simulation-running-panel h2 {
  margin-bottom: 2px;
}

.simulation-running-panel p {
  margin: 0;
  color: #5f696b;
  font-size: 0.92rem;
}

.cashflow-heading {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e1e6e3;
}

.cashflow-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.summary-table {
  display: grid;
  gap: 8px;
  overflow: visible;
}

.cashflow-table:has(.rich-tooltip:hover),
.cashflow-table:has(.rich-tooltip:focus-within),
.summary-table:has(.rich-tooltip:hover),
.summary-table:has(.rich-tooltip:focus-within) {
  overflow: visible;
}

.detail-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.cashflow-row,
.summary-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.cashflow-row:not(.cashflow-header) {
  align-items: start;
}

.cashflow-row {
  grid-template-columns: 1fr 0.45fr 0.45fr 0.34fr 0.8fr 0.95fr 0.45fr 38px;
  min-width: 1040px;
}

.cashflow-row-simple {
  grid-template-columns: 1fr 0.45fr 0.45fr 0.34fr 0.8fr 0.95fr 0.45fr;
  min-width: 1000px;
}

.cashflow-row > .icon-button {
  align-self: start;
  justify-self: end;
  margin-top: 3px;
}

.cashflow-tax-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.cashflow-tax-control:has(input) {
  grid-template-columns: minmax(0, 1fr) 70px;
}

.cashflow-tax-control .field-hint {
  grid-column: 1 / -1;
}

.cashflow-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.calculated-years > span {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  color: #344144;
  font-weight: 850;
}

.simulation-run-action {
  justify-items: start;
}

.simulation-run-action .simulation-running-message {
  max-width: none;
  text-align: left;
}

.summary-row {
  grid-template-columns: minmax(78px, 1fr) 0.42fr 0.56fr 0.52fr 0.72fr 1.02fr 0.56fr 0.56fr 0.7fr 0.78fr 0.7fr 0.7fr;
  min-width: 0;
  padding: 9px 7px;
  border-radius: 8px;
  background: #f6f8f6;
  color: #344144;
  font-size: 0.76rem;
  font-weight: 650;
}

.summary-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-row .tooltip-label {
  overflow: visible;
  white-space: nowrap;
}

.summary-header > span,
.summary-header .tooltip-label {
  white-space: normal;
}

.summary-header .rich-tooltip {
  overflow: visible;
  z-index: 5;
}

.summary-row .tooltip-card {
  white-space: normal;
}

.summary-row-simple {
  grid-template-columns: minmax(96px, 1.2fr) 0.75fr 0.85fr 1.15fr 0.8fr 0.8fr 0.95fr;
  min-width: 0;
  font-size: 0.82rem;
}

.summary-row-fixed-only {
  grid-template-columns: minmax(96px, 1.2fr) 0.8fr 0.9fr 1.15fr 0.8fr 0.95fr;
  min-width: 0;
  font-size: 0.82rem;
}

.summary-row-fixed-details {
  grid-template-columns: minmax(78px, 1fr) 0.42fr 0.56fr 0.52fr 0.72fr 1.02fr 0.56fr 0.7fr 0.78fr 0.7fr 0.7fr;
  min-width: 0;
}

.summary-detail-toggle {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.success-rate {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  font-weight: 850;
  white-space: nowrap;
}

.funded-status {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  font-weight: 850;
  white-space: nowrap;
}

.funded-status-very-good,
.funded-status-good {
  background: #d8f3dc;
  color: #1b5e20;
}

.funded-status-adequate {
  background: #f6e2a8;
  color: #5f4700;
}

.funded-status-marginal {
  background: #f7c59f;
  color: #7a3a00;
}

.funded-status-fragile {
  background: #f8b4ad;
  color: #7f1d1d;
}

.success-rate-green {
  background: #d8f3dc;
  color: #1b5e20;
}

.success-rate-yellow {
  background: #f6e2a8;
  color: #5f4700;
}

.success-rate-orange {
  background: #f7c59f;
  color: #7a3a00;
}

.success-rate-red {
  background: #f8b4ad;
  color: #7f1d1d;
}

.detail-row {
  display: grid;
  grid-template-columns: 0.34fr 0.34fr 0.9fr 0.88fr 0.8fr 0.76fr 0.8fr 0.74fr 0.68fr 0.86fr;
  gap: 4px;
  align-items: center;
  min-width: 0;
  padding: 9px 8px;
  border-radius: 8px;
  background: #f6f8f6;
  color: #344144;
  font-size: 0.8rem;
  font-weight: 650;
}

.detail-row-with-return-percent {
  grid-template-columns: 0.32fr 0.32fr 0.84fr 0.5fr 0.82fr 0.74fr 0.7fr 0.74fr 0.68fr 0.62fr 0.82fr;
}

.detail-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cashflow-header,
.summary-header,
.detail-header {
  background: transparent;
  color: #6d777a;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.inline-select {
  width: min(260px, 100%);
}

.detail-controls {
  display: grid;
  grid-template-columns: minmax(160px, 190px);
  justify-content: end;
  align-items: end;
  gap: 10px;
}

.detail-controls.has-view {
  grid-template-columns: minmax(160px, 190px) minmax(160px, 190px);
}

.detail-controls .inline-select {
  width: min(190px, 100%);
}

.detail-view-hint {
  grid-column: 2;
  margin-top: -4px;
  color: #16697a;
  font-weight: 850;
}

.tooltip-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tooltip-label b {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #9aaba8;
  border-radius: 50%;
  color: #16697a;
  font-family: inherit;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.rich-tooltip {
  position: relative;
}

.tooltip-card {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: min(380px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid #b9cbc7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(35, 47, 46, 0.16);
  color: #344144;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  text-transform: none;
}

.calculated-return .tooltip-card {
  display: none;
  pointer-events: none;
}

.cashflow-table .tooltip-card,
.summary-table .tooltip-card {
  right: 0;
  left: auto;
}

.summary-table .summary-header .tooltip-card {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
}

.model-options .tooltip-card,
.calculated-return .tooltip-card,
.summary-table .tooltip-card,
.cashflow-table .tooltip-card {
  font-size: 0.92rem;
}

.assumption-row label .tooltip-card {
  display: none;
  min-height: 0;
  align-items: initial;
}

.tooltip-card span,
.tooltip-card a {
  display: block;
}

.tooltip-card .tooltip-spacer {
  height: 8px;
}

.tooltip-card a {
  margin-top: 4px;
  color: #16697a;
  overflow-wrap: anywhere;
}

.rich-tooltip:hover .tooltip-card,
.rich-tooltip:focus-within .tooltip-card {
  display: block;
}

.calculated-return .rich-tooltip:focus-within .tooltip-card {
  display: none;
}

.calculated-return .rich-tooltip:hover .tooltip-card {
  display: block;
}

.histogram-frame {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.histogram-y-axis {
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  height: 180px;
  margin-top: 8px;
  color: #6d777a;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: right;
}

.histogram {
  --bar-count: 45;
  display: grid;
  grid-template-columns: repeat(var(--bar-count), minmax(12px, 1fr));
  gap: 4px;
  min-height: 220px;
  overflow-x: auto;
  padding: 8px 0 4px;
}

.histogram-item {
  display: grid;
  grid-template-rows: 180px auto;
  gap: 8px;
  min-width: 16px;
}

.histogram-bar-wrap {
  display: flex;
  align-items: end;
  min-height: 180px;
  border-radius: 6px;
  background: #edf2ef;
  overflow: hidden;
}

.histogram-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 6px 6px 0 0;
  background: #16697a;
}

.histogram-item span {
  color: #6d777a;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
}

.chart-panel {
  overflow: hidden;
}

.chart-panel .line-chart {
  overflow: visible;
}

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

.line-chart {
  min-width: 680px;
  width: 100%;
  height: auto;
  display: block;
}

.axis {
  stroke: #738083;
  stroke-width: 1.4;
}

.axis-tick {
  stroke: #738083;
  stroke-width: 1.2;
}

.grid-line {
  stroke: #dfe5e2;
  stroke-width: 1;
}

.tick-label {
  fill: #6a7679;
  font-size: 13px;
  font-weight: 700;
}

.x-tick-label {
  font-size: 12px;
}

.axis-label {
  fill: #536064;
  font-size: 13px;
  font-weight: 850;
}

.result-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zero-result-line {
  stroke: #c44536;
}

.iteration-line {
  fill: none;
  stroke: #16697a;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.12;
}

.all-path-average-line {
  stroke: #16697a;
  stroke-width: 4;
  opacity: 0.95;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
  color: #536064;
  font-size: 0.9rem;
  font-weight: 750;
}

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

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: #16697a;
  font-size: 2.4rem;
  line-height: 1;
}

.metric-card > span {
  color: #657174;
  font-weight: 700;
}

.metric-pair {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: #536064;
}

.metric-pair b {
  color: #263235;
}

.empty-state {
  min-height: 240px;
  padding: 38px;
  display: grid;
  place-content: center;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: #667174;
}

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

  .masthead {
    align-items: start;
  }

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

  .cashflow-row,
  .summary-row,
  .detail-row {
    gap: 6px;
    font-size: 0.9rem;
  }

  .cashflow-header,
  .summary-header,
  .detail-header {
    font-size: 0.7rem;
  }

  .cashflow-row {
    min-width: 980px;
  }

  .cashflow-row-simple {
    min-width: 940px;
  }

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

@media (max-width: 820px) {
  .shell {
    width: min(100% - 20px, 760px);
    padding-top: 10px;
  }

  .masthead {
    display: grid;
    gap: 16px;
    padding: 18px 0;
  }

  .run-action,
  .primary-action {
    width: 100%;
  }

  .run-action {
    justify-items: stretch;
  }

  .simulation-running-message {
    max-width: none;
    text-align: left;
  }

  .panel {
    padding: 14px;
  }

  .panel-heading {
    display: grid;
    align-items: start;
  }

  .panel-heading .ghost-button,
  .panel-heading .inline-select {
    width: 100%;
  }

  .detail-controls {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .detail-controls .inline-select {
    width: 100%;
  }

  .detail-view-hint {
    grid-column: auto;
  }

  .scenario-list,
  .compact-grid,
  .assumption-grid,
  .metric-strip,
  .plan-row,
  .assumption-row.two-column,
  .assumption-row.three-column,
  .tax-mode-row,
  .calculated-return {
    grid-template-columns: 1fr;
  }

  .scenario-actions {
    grid-template-columns: 1fr 34px;
  }

  .scenario-name-row {
    grid-template-columns: 1fr 34px;
  }

  .scenario-name-row label {
    grid-column: 1 / -1;
  }

  .saved-scenario-select {
    grid-column: 1 / -1;
  }

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

  .planner-grid,
  .planner-fields.two-column {
    grid-template-columns: 1fr;
  }

  .planner-solve-for {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .planner-actions {
    display: grid;
  }

  .planner-actions .primary-action,
  .planner-actions .ghost-button {
    width: 100%;
  }

  .histogram-frame {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .histogram {
    grid-template-columns: repeat(var(--bar-count), minmax(16px, 1fr));
  }

  .cashflow-row,
  .summary-row,
  .detail-row {
    font-size: 0.82rem;
  }

  .cashflow-row input,
  .cashflow-row select {
    padding: 6px 7px;
    font-size: 0.82rem;
  }

  .cashflow-row {
    min-width: 900px;
  }

  .cashflow-row-simple {
    min-width: 860px;
  }

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

@media (max-width: 560px) {
  .shell {
    width: min(100% - 12px, 540px);
  }

  .scenario-save-panel,
  .scenario-editor,
  .side-section {
    padding: 12px;
  }

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

  .save-scenario-button {
    grid-column: auto;
  }

  .cashflow-row,
  .summary-row,
  .detail-row {
    gap: 5px;
    font-size: 0.76rem;
  }

  .cashflow-header,
  .summary-header,
  .detail-header {
    font-size: 0.66rem;
  }

  .cashflow-row {
    min-width: 840px;
  }

  .cashflow-row-simple {
    min-width: 800px;
  }

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

  .line-chart {
    min-width: 620px;
  }

  .tooltip-card {
    width: min(320px, calc(100vw - 24px));
  }
}
