.pfroi-root {
  display: grid;
  gap: 1.1rem;
  padding: 1rem;
  border: 1px solid #d6dee8;
  border-radius: 8px;
  background: #f8fbfd;
  color: #17202a;
}

.pfroi-root * {
  box-sizing: border-box;
}

.pfroi-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .9rem;
  align-content: start;
}

.pfroi-payback {
  display: grid;
  gap: .55rem;
  min-height: 13rem;
  padding: 1rem;
  border-radius: 8px;
  color: #f7fbff;
  background: linear-gradient(135deg, #123142, #286456);
}

.pfroi-payback span,
.pfroi-kpis span,
.pfroi-chart span,
.pfroi-costs span,
.pfroi-inputs label > span {
  font-size: .82rem;
  letter-spacing: 0;
}

.pfroi-payback strong {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1;
  font-weight: 600;
}

.pfroi-payback small {
  min-height: 1.2rem;
}

.pfroi-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(8.5rem, 1fr));
  gap: .55rem;
}

.pfroi-kpis article {
  display: grid;
  gap: .45rem;
  min-height: 4.8rem;
  align-content: start;
  padding: .75rem;
  border: 1px solid #dae4ec;
  border-radius: 8px;
  background: #fff;
}

.pfroi-kpis b,
.pfroi-chart b {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 500;
}

.pfroi-chart {
  display: grid;
  gap: .75rem;
  padding-top: .15rem;
}

.pfroi-bar-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) minmax(7rem, auto);
  gap: .4rem .7rem;
  align-items: center;
}

.pfroi-bar-row div {
  height: 1.15rem;
  overflow: hidden;
  border-radius: 999px;
  background: #dde7ee;
}

.pfroi-bar-row i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width .25s ease;
}

.pfroi-bar-row [data-pfroi-bar='revenue'] {
  background: #2f8d73;
}

.pfroi-bar-row [data-pfroi-bar='costs'] {
  background: #c86d4d;
}

.pfroi-bar-row b {
  grid-column: 3;
  justify-self: end;
}

.pfroi-costs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
}

.pfroi-costs span {
  padding: .45rem .6rem;
  border-radius: 8px;
  background: #e7edf2;
  overflow-wrap: anywhere;
}

.pfroi-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.pfroi-actions button {
  min-height: 2.55rem;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  padding: .55rem .7rem;
  color: #17202a;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.pfroi-actions button:first-child {
  color: #f7fbff;
  border-color: #8b4d3f;
  background: #8b4d3f;
}

.pfroi-actions button:hover {
  border-color: #2f8d73;
}

.pfroi-inputs {
  display: grid;
  gap: .8rem;
}

.pfroi-inputs label,
.pfroi-currency-field {
  display: grid;
  gap: .35rem;
}

.pfroi-inputs input {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  padding: .55rem .65rem;
  color: inherit;
  background: #fff;
  font: inherit;
}

.pfroi-currency-field > span {
  font-size: .82rem;
  letter-spacing: 0;
}

.pfroi-currency {
  position: relative;
}

.pfroi-currency button {
  font: inherit;
}

.pfroi-currency [data-pfroi-currency-button] {
  display: flex;
  width: 100%;
  min-height: 2.8rem;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  padding: .45rem .55rem .45rem .75rem;
  color: inherit;
  background: #fff;
  cursor: pointer;
}

.pfroi-currency [data-pfroi-currency-button] b {
  display: inline-grid;
  min-width: 2.2rem;
  min-height: 2rem;
  place-items: center;
  border-radius: 999px;
  color: #f8fbfd;
  background: #123142;
  font-weight: 500;
}

.pfroi-currency [data-pfroi-currency-button] small {
  margin-left: auto;
  color: #526271;
}

.pfroi-currency [data-pfroi-currency-button]::after {
  content: "";
  width: .55rem;
  height: .55rem;
  margin-right: .25rem;
  border-right: 1.5px solid #526271;
  border-bottom: 1.5px solid #526271;
  transform: translateY(-.12rem) rotate(45deg);
  transition: transform .18s ease;
}

.pfroi-currency[data-open='true'] [data-pfroi-currency-button]::after {
  transform: translateY(.12rem) rotate(225deg);
}

.pfroi-currency-list {
  position: absolute;
  z-index: 4;
  top: calc(100% + .35rem);
  left: 0;
  right: 0;
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35rem;
  max-height: 13rem;
  overflow: auto;
  border: 1px solid #c8d4dd;
  border-radius: 8px;
  padding: .45rem;
  background: #fff;
  box-shadow: 0 1rem 2rem rgba(23, 32, 42, 0.14);
}

.pfroi-currency[data-open='true'] .pfroi-currency-list {
  display: grid;
}

.pfroi-currency-list button {
  display: grid;
  gap: .1rem;
  min-height: 3rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .35rem;
  color: inherit;
  background: #f2f6f9;
  cursor: pointer;
}

.pfroi-currency-list button:hover,
.pfroi-currency-list button[aria-selected='true'] {
  border-color: #2f8d73;
  background: #e5f3ee;
}

.pfroi-currency-list b {
  font-weight: 500;
}

.pfroi-currency-list small {
  color: #526271;
}

.pfroi-money {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .5rem;
}

.pfroi-money b {
  min-width: 2.2rem;
  text-align: right;
  font-weight: 500;
}

.pfroi-money i {
  font-style: normal;
}

.pfroi-range span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.pfroi-range input {
  accent-color: #2f8d73;
}

.pfroi-root[data-state='negative'] .pfroi-payback {
  background: linear-gradient(135deg, #4b2630, #8b4d3f);
}

.theme-dark .pfroi-root {
  color: #e8eef3;
  border-color: #304354;
  background: #111b24;
}

.theme-dark .pfroi-kpis article,
.theme-dark .pfroi-inputs input,
.theme-dark .pfroi-actions button,
.theme-dark .pfroi-currency [data-pfroi-currency-button],
.theme-dark .pfroi-currency-list {
  border-color: #34485a;
  background: #172532;
}

.theme-dark .pfroi-actions button {
  color: #e8eef3;
}

.theme-dark .pfroi-actions button:first-child {
  border-color: #8b4d3f;
  background: #8b4d3f;
}

.theme-dark .pfroi-currency-list button {
  background: #111b24;
}

.theme-dark .pfroi-currency-list button:hover,
.theme-dark .pfroi-currency-list button[aria-selected='true'] {
  background: #17352f;
}

.theme-dark .pfroi-currency [data-pfroi-currency-button] small,
.theme-dark .pfroi-currency-list small {
  color: #aeb9c3;
}

.theme-dark .pfroi-currency [data-pfroi-currency-button]::after {
  border-color: #aeb9c3;
}

.theme-dark .pfroi-bar-row div,
.theme-dark .pfroi-costs span {
  background: #263747;
}

@media (min-width: 760px) {
  .pfroi-root {
    grid-template-columns: minmax(0, 1.12fr) minmax(24rem, .88fr);
    align-items: start;
  }

  .pfroi-results {
    grid-template-columns: minmax(0, 1.15fr) minmax(12rem, .85fr);
  }

  .pfroi-payback,
  .pfroi-chart {
    grid-column: 1;
  }

  .pfroi-kpis,
  .pfroi-costs {
    grid-column: 2;
  }

  .pfroi-kpis {
    grid-template-columns: 1fr;
  }

  .pfroi-chart {
    align-self: end;
  }

  .pfroi-costs {
    grid-template-columns: 1fr;
  }

  .pfroi-actions {
    grid-column: 2;
    align-self: start;
  }

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

  .pfroi-currency-field,
  .pfroi-range {
    grid-column: span 2;
  }
}

@media (min-width: 1080px) {
  .pfroi-root {
    grid-template-columns: minmax(0, 1.1fr) minmax(28rem, .9fr);
  }

  .pfroi-results {
    grid-template-columns: minmax(0, 1.35fr) minmax(10rem, .65fr);
  }
}

@media (max-width: 520px) {
  .pfroi-kpis,
  .pfroi-costs,
  .pfroi-actions {
    grid-template-columns: 1fr;
  }

  .pfroi-bar-row {
    grid-template-columns: 4.5rem 1fr;
  }

  .pfroi-bar-row b {
    grid-column: 2;
    justify-self: start;
  }
}
