*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --roi-ink: #2f3e46;
  --roi-muted: #69747c;
  --roi-blue: #274852;
  --roi-teal: #32a3b7;
  --roi-teal-dark: #274852;
  --roi-teal-soft: #d6f3f7;
  --roi-sand: #e6c19a;
  --roi-action: #32a3b7;
  --roi-coral: #d85a30;
  --roi-coral-soft: #faece7;
  --roi-red-soft: #fcebeb;
  --roi-red: #791f1f;
  --roi-page: #f4f8fa;
  --roi-border: #e7edf0;
  --roi-panel: #ffffff;
  --roi-mono: "DM Mono", monospace;
}

body.roi-page {
  margin: 0;
  background:
    linear-gradient(
      180deg,
      var(--roi-teal-dark) 0,
      #2c5661 330px,
      #80cbd5 520px,
      #e3f8fb 680px,
      #ffffff 980px
    );
  color: var(--roi-ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.roi-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: clamp(70px, 4.6vw, 92px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(24px, 3.8vw, 78px);
  background: #ffffff;
  border-bottom: 1px solid #edf1f3;
  box-shadow: 0 1px 14px rgba(28, 36, 46, 0.06);
}

.roi-logo {
  display: block;
  width: clamp(150px, 10.6vw, 216px);
  height: auto;
}

.roi-pill {
  display: inline-flex;
  min-height: clamp(36px, 2.25vw, 46px);
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  padding: 0 clamp(18px, 1.85vw, 34px);
  color: inherit;
  font: inherit;
  font-size: clamp(0.85rem, 0.82vw, 1.05rem);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.roi-pill-light {
  background: #ffffff;
  color: var(--roi-blue);
  box-shadow: inset 0 0 0 1px rgba(50, 163, 183, 0.24);
}

.roi-pill-primary {
  background: var(--roi-action);
  color: #ffffff;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(50, 163, 183, 0.24);
}

.roi-hero {
  position: relative;
  overflow: hidden;
  background: transparent;
  color: #ffffff;
}

.roi-hero::after {
  content: none;
}

.roi-hero-overlay {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(54px, 4.8vw, 92px) clamp(24px, 4vw, 56px) clamp(116px, 7.4vw, 154px);
}

.roi-brand {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 18px;
  margin: 0 0 20px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--roi-ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.roi-hero h1 {
  max-width: 760px;
  margin: 0 0 16px;
  color: #ffffff;
  font-size: clamp(3.05rem, 4.6vw, 5.2rem);
  font-weight: 700;
  line-height: 1.08;
}

.roi-hero p:last-child {
  max-width: 740px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(1rem, 1.25vw, 1.35rem);
}

.roi-content {
  position: relative;
  z-index: 2;
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0 24px clamp(70px, 6vw, 112px);
  transform: translateY(clamp(-92px, -5.2vw, -58px));
}

.roi-card {
  margin-bottom: clamp(18px, 1.6vw, 28px);
  padding: clamp(24px, 2.1vw, 34px);
  border: 1px solid var(--roi-border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, #ffffff 100%);
  box-shadow: 0 20px 48px rgba(28, 36, 46, 0.09);
}

.roi-card:first-child {
  position: relative;
  overflow: hidden;
  border-color: rgba(50, 163, 183, 0.24);
  box-shadow: 0 28px 72px rgba(28, 36, 46, 0.12);
}

.roi-card:first-child::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--roi-teal) 0%, var(--roi-teal-dark) 100%);
}

.roi-card:nth-of-type(2) {
  border: 0;
  background:
    linear-gradient(135deg, rgba(50, 163, 183, 0.96) 0%, rgba(39, 72, 82, 0.92) 100%);
  color: #ffffff;
  box-shadow: 0 26px 62px rgba(39, 72, 82, 0.18);
}

.roi-card:nth-of-type(2) .roi-card-title {
  color: rgba(255, 255, 255, 0.86);
}

.roi-card:nth-of-type(3) {
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fcfd 100%);
}

.roi-card-title,
.roi-section-divider {
  margin: 0;
  color: var(--roi-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.roi-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.roi-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}

.roi-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.roi-input-group label {
  color: var(--roi-muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.roi-input-group input {
  width: 100%;
  border: 1.5px solid #d9e2e6;
  border-radius: 9px;
  outline: none;
  background: #f7fafb;
  color: var(--roi-ink);
  font-family: var(--roi-mono);
  font-size: 1rem;
  padding: 12px 14px;
  transition: border-color 0.15s, background-color 0.15s;
}

.roi-input-group input:focus {
  border-color: var(--roi-teal);
  background: #ffffff;
}

.roi-input-hint {
  margin-top: 2px;
  color: #9aa7ad;
  font-size: 0.75rem;
}

.roi-input-prefix,
.roi-input-suffix {
  position: relative;
}

.roi-input-prefix input {
  padding-left: 30px;
}

.roi-input-prefix::before {
  content: "$";
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #9aa7ad;
  font-family: var(--roi-mono);
  pointer-events: none;
}

.roi-input-suffix input {
  padding-right: 48px;
}

.roi-input-suffix::after {
  content: attr(data-suffix);
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: #9aa7ad;
  font-family: var(--roi-mono);
  font-size: 0.82rem;
  pointer-events: none;
}

.roi-reset-btn,
.roi-toggle-row {
  font: inherit;
  cursor: pointer;
}

.roi-reset-btn {
  border: 1px solid rgba(50, 163, 183, 0.35);
  border-radius: 999px;
  background: #ffffff;
  color: var(--roi-blue);
  padding: 9px 16px;
  font-size: 0.8rem;
  font-weight: 600;
}

.roi-toggle-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  border: 1px solid rgba(50, 163, 183, 0.28);
  border-radius: 10px;
  background: linear-gradient(90deg, #d6f3f7 0%, #eefbfc 100%);
  padding: 14px 16px;
  text-align: left;
}

.roi-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #b7c5ca;
  transition: background-color 0.2s;
}

.roi-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s;
}

.roi-toggle-switch.on {
  background: var(--roi-teal);
}

.roi-toggle-switch.on::after {
  transform: translateX(16px);
}

.roi-toggle-label {
  color: var(--roi-ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.roi-custom-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.roi-custom-section.show {
  max-height: 1400px;
}

.roi-custom-inner {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--roi-border);
}

.roi-section-divider {
  margin: 26px 0 14px;
  color: var(--roi-blue);
}

.roi-section-divider:first-child {
  margin-top: 0;
}

.roi-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.roi-metric-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  border: 1px solid rgba(50, 163, 183, 0.18);
  border-radius: 16px;
  background: #ffffff;
  padding: 22px 22px 20px;
  box-shadow: 0 16px 34px rgba(28, 36, 46, 0.11);
}

.roi-metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
}

.roi-metric-card.saving::before,
.roi-metric-card.roi::before {
  background: var(--roi-teal);
}

.roi-metric-card.cost::before {
  background: var(--roi-coral);
}

.roi-metric-label {
  margin-bottom: 10px;
  color: var(--roi-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roi-metric-value {
  font-family: var(--roi-mono);
  font-size: clamp(1.55rem, 2.25vw, 2.2rem);
  font-weight: 500;
  line-height: 1.2;
}

.roi-positive {
  color: #0a5a46;
}

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

.roi-metric-sub {
  margin-top: 8px;
  color: var(--roi-muted);
  font-size: 0.78rem;
}

.roi-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--roi-mono);
  font-size: clamp(1.15rem, 1.8vw, 1.65rem);
  font-weight: 500;
}

.roi-badge-positive,
.roi-badge-free {
  background: var(--roi-teal-soft);
  color: #085041;
}

.roi-badge-negative {
  background: var(--roi-red-soft);
  color: var(--roi-red);
}

.roi-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.roi-bar-label {
  width: 130px;
  flex: 0 0 auto;
  color: var(--roi-muted);
  font-size: 0.84rem;
  text-align: right;
}

.roi-bar-track {
  position: relative;
  flex: 1;
  height: 38px;
  overflow: hidden;
  border-radius: 10px;
  background: #edf3f5;
}

.roi-bar-fill {
  display: flex;
  height: 100%;
  min-width: 2px;
  align-items: center;
  border-radius: 10px;
  padding: 0 16px;
  font-family: var(--roi-mono);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: width 0.2s ease;
}

.roi-bar-teal {
  background: var(--roi-teal);
  color: #04342c;
}

.roi-bar-coral {
  background: #f0997b;
  color: #7a2f16;
}

.roi-bar-outside {
  margin-left: 8px;
  color: var(--roi-muted);
  font-family: var(--roi-mono);
  font-size: 0.84rem;
  white-space: nowrap;
}

.roi-breakeven {
  margin-top: 16px;
  padding: 16px 18px;
  border-top: 1px solid var(--roi-border);
  border-radius: 12px;
  background: var(--roi-teal-soft);
  color: var(--roi-muted);
  font-size: 0.86rem;
}

.roi-breakeven strong {
  color: var(--roi-ink);
  font-family: var(--roi-mono);
  font-weight: 500;
}

.roi-summary-block {
  margin-top: 26px;
}

.roi-summary-block h3 {
  margin: 0 0 12px;
  color: var(--roi-ink);
  font-size: 1rem;
  font-weight: 700;
}

.roi-assumptions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 44px;
}

.roi-assumption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--roi-border);
  padding: 9px 0;
  font-size: 0.84rem;
}

.roi-assumption-key {
  color: var(--roi-muted);
}

.roi-assumption-val {
  color: var(--roi-ink);
  font-family: var(--roi-mono);
  font-weight: 500;
  text-align: right;
}

.roi-summary-total {
  border-bottom: 2px solid var(--roi-teal);
}

.roi-summary-total .roi-assumption-key,
.roi-summary-total .roi-assumption-val {
  color: #0a5a46;
  font-weight: 600;
}

.roi-source-note {
  margin: 22px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--roi-border);
  border-radius: 12px;
  background: #f7fafb;
  color: #8c9ba1;
  font-size: 0.78rem;
  line-height: 1.6;
}

.roi-footer {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding-top: 20px;
  transform: translateY(28px);
  color: #8c9ba1;
  font-size: 0.78rem;
  text-align: center;
}

.roi-footer p {
  margin: 0;
}

@media (max-width: 980px) {
  .roi-hero-overlay {
    padding-bottom: 92px;
  }

  .roi-content {
    width: min(100%, 900px);
  }

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

  .roi-metric-card {
    padding: 18px;
  }

  .roi-metric-value {
    font-size: 1.55rem;
  }

  .roi-source-note {
    margin-top: 22px;
  }
}

@media (max-width: 760px) {
  .roi-nav {
    align-items: center;
    flex-direction: row;
  }

  .roi-hero-overlay {
    padding: 36px 20px 76px;
  }

  .roi-hero h1 {
    max-width: 420px;
    font-size: clamp(2.05rem, 10vw, 3rem);
  }

  .roi-hero p:last-child {
    font-size: 0.98rem;
  }

  .roi-input-grid,
  .roi-metrics-grid,
  .roi-assumptions-grid {
    grid-template-columns: 1fr;
  }

  .roi-card-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .roi-metric-card {
    min-height: 0;
  }

  .roi-bar-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .roi-bar-label {
    width: auto;
    text-align: left;
  }

  .roi-bar-track {
    height: 34px;
  }
}

@media (max-width: 520px) {
  .roi-hero-overlay {
    padding: 34px 18px 68px;
  }

  .roi-hero h1 {
    font-size: clamp(1.95rem, 10.5vw, 2.55rem);
  }

  .roi-content {
    padding-left: 16px;
    padding-right: 16px;
    transform: translateY(-40px);
  }

  .roi-card {
    border-radius: 14px;
    padding: 18px;
  }

  .roi-nav {
    min-height: 72px;
    padding: 10px 16px;
  }

  .roi-logo {
    width: 112px;
  }

  .roi-nav .roi-pill {
    min-height: 34px;
    padding: 0 14px;
    font-size: 0.76rem;
  }

  .roi-reset-btn {
    width: fit-content;
  }

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

  .roi-footer .roi-pill {
    width: 100%;
  }
}
