.calculator-page {
  background: #f4f7fb;
  color: #182538;
}

.calculator-page .logo {
  text-decoration: none;
}

.calculator-main {
  margin-top: 5rem;
  display: flex;
  min-height: calc(100vh - 5rem);
  min-height: calc(100dvh - 5rem);
}

.savings-calculator {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  align-items: center;
  width: 100%;
  min-height: calc(100vh - 5rem);
  min-height: calc(100dvh - 5rem);
  padding: clamp(20px, 3vh, 40px) clamp(24px, 6.1vw, 116px);
  overflow: visible;
  background-color: #eef4fb;
  background-image: url("../assets/calculator-banner.webp");
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
}

.savings-calculator::before,
.savings-calculator::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.savings-calculator::before {
  inset: 0;
  height: 150px;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
  opacity: 0.9;
}

.savings-calculator::after {
  display: none;
}

.calculator-shell {
  position: relative;
  z-index: 30;
  width: 100%;
  max-width: 1648px;
  margin: 0 auto;
}

.calculator-hero {
  position: relative;
  width: auto;
  height: auto;
  margin-bottom: clamp(18px, 2.6vh, 26px);
  padding: 0;
  background: transparent;
  box-shadow: none;
  z-index: 1;
}

.calculator-hero h1 {
  max-width: 1180px;
  margin: 0;
  color: #2457a6;
  font-size: clamp(2.25rem, 3.05vw, 3.35rem);
  line-height: 1.02;
  font-weight: 900;
}

.calculator-hero h1 span {
  display: inline;
  color: rgb(0, 160, 66);
}

.calculator-hero p {
  max-width: 1120px;
  margin: 10px 0 0;
  color: #253449;
  font-size: 1rem;
  line-height: 1.35;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px;
  align-items: start;
  max-width: 1480px;
}

.savings-calculator .parameters-card,
.savings-calculator .result-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(223, 227, 233, 0.95);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(18, 34, 58, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.savings-calculator .parameters-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: clamp(16px, 2vh, 22px) 34px;
}

.savings-calculator .parameters-card h2,
.savings-calculator .result-card h2 {
  margin: 0;
  color: #1a365d;
  font-weight: 800;
}

.savings-calculator .parameters-card h2 {
  display: block;
  width: 100%;
  margin: 0 0 clamp(16px, 2.2vh, 20px);
  font-size: clamp(1.55rem, 2vw, 1.8rem);
  line-height: 1.2;
}

.savings-calculator .calculator-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(10px, 1.7vh, 16px);
  margin-bottom: clamp(8px, 1.35vh, 12px);
  width: 100%;
}

.savings-calculator .single-input-row {
  grid-template-columns: 1fr;
}

.savings-calculator .field {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.savings-calculator .field label {
  display: block;
  color: #26364a;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.savings-calculator .custom-select {
  position: relative;
  z-index: 10;
  width: 100%;
  min-width: 0;
}

.savings-calculator .custom-select.open {
  z-index: 50;
}

.savings-calculator .select-trigger,
.savings-calculator .spend-input-wrap,
.savings-calculator .number-input,
.savings-calculator .custom-industry-input {
  width: 100%;
  min-height: clamp(44px, 5.4vh, 52px);
  border-radius: 8px;
  background: #e8edf4;
  color: #172840;
  font-size: 1.08rem;
  font-weight: 600;
}

.savings-calculator .custom-industry-input {
  border: 1px solid #d2dbe7;
  padding: 0 16px;
  outline: none;
}

.savings-calculator .number-input {
  border: 1px solid #d2dbe7;
  padding: 0 16px;
  outline: none;
}

.savings-calculator .custom-industry-input:focus,
.savings-calculator .number-input:focus {
  border-color: #6b8fbd;
  background: #f7f9fc;
}

.savings-calculator .custom-industry-input::placeholder,
.savings-calculator .number-input::placeholder {
  color: #748092;
}

.input-choice {
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}

.input-choice legend {
  margin: 0 0 2px;
  color: #26364a;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
}

.input-choice label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #172840;
  font-size: 0.94rem;
  font-weight: 600;
}

.input-choice input {
  width: 16px;
  height: 16px;
  accent-color: #00a042;
}

.savings-calculator .select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d2dbe7;
  padding: 0 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.savings-calculator .select-trigger.placeholder {
  color: #748092;
}

.savings-calculator .select-trigger.open {
  border-color: #6b8fbd;
  background: #f7f9fc;
  box-shadow: none;
}

.savings-calculator .select-trigger i {
  color: #1f7bb7;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.savings-calculator .select-trigger.open i {
  transform: rotate(180deg);
}

.savings-calculator .options-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-height: 290px;
  overflow-y: auto;
  display: none;
  overflow-y: auto;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  border: 1px solid #9fb5d1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 32px rgba(12, 24, 44, 0.13);
  z-index: 1000;
  scrollbar-color: #8b8f97 #ffffff;
  scrollbar-width: auto;
}

.savings-calculator .options-list::-webkit-scrollbar {
  width: 12px;
}

.savings-calculator .options-list::-webkit-scrollbar-track {
  background: #ffffff;
}

.savings-calculator .options-list::-webkit-scrollbar-thumb {
  background: #8b8f97;
  border: 3px solid #ffffff;
  border-radius: 999px;
}

.savings-calculator .custom-select.open .options-list {
  display: block;
}

.savings-calculator .option-search {
  position: sticky;
  top: -8px;
  z-index: 2;
  padding: 8px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e6edf5;
}

.savings-calculator .option-search-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d2dbe7;
  border-radius: 7px;
  padding: 0 12px;
  background: #f7f9fc;
  color: #172840;
  font: inherit;
  font-size: 0.98rem;
  outline: none;
}

.savings-calculator .option-search-input:focus {
  border-color: #6b8fbd;
  background: #ffffff;
}

.savings-calculator .option-item {
  padding: 9px 20px;
  border-radius: 0;
  color: #172840;
  font-size: 1.08rem;
  line-height: 1.65;
  font-weight: 500;
  cursor: pointer;
}

.savings-calculator .option-item:hover,
.savings-calculator .option-item:focus {
  background: #eef4fb;
}

.savings-calculator .spend-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0 16px;
}

.savings-calculator .spend-input-wrap span {
  color: #556172;
  font-weight: 800;
  flex: 0 0 auto;
}

.savings-calculator .spend-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #4d596b;
  font: inherit;
  font-weight: 800;
}

.savings-calculator .spend-input-wrap em {
  color: #748092;
  font-size: 0.86rem;
  font-style: italic;
  font-weight: 600;
  white-space: nowrap;
}

.savings-calculator .spend-input-wrap input::placeholder {
  color: #6d7787;
}

.savings-calculator .calculate-btn {
  width: 100%;
  min-height: clamp(48px, 5.8vh, 56px);
  margin-top: clamp(10px, 2.1vh, 18px);
  border: 0;
  border-radius: 14px;
  background: #2457a6;
  color: #ffffff;
  font-size: 1.12rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(36, 87, 166, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.savings-calculator .calculate-btn:hover {
  transform: translateY(-2px);
  background: #20509b;
  box-shadow: 0 14px 28px rgba(36, 87, 166, 0.3);
}

.fill-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 25;
  display: none;
  padding: 5px 10px;
  border-top: 3px solid #d22f2f;
  border-radius: 6px;
  background: #fff1f1;
  color: #b42323;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.fill-hint.show {
  display: block;
}

.hint-vibrate {
  animation: hintShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.error-shake {
  border-color: #d33b3b !important;
  animation: shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.result-card {
  position: relative;
  min-height: 330px;
  height: auto;
  align-self: start;
  overflow: hidden;
  padding: clamp(16px, 2.2vh, 22px) 30px clamp(12px, 1.8vh, 18px);
}

.result-card.flip {
  transform-style: preserve-3d;
  animation: flipIn 0.8s ease both;
}

.result-card-content {
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.result-card-content.locked {
  filter: none;
  opacity: 1;
}

.result-card h2 {
  color: #313d4d;
  font-size: 1.08rem;
  line-height: 1.3;
}

.amount-row {
  display: none;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
}

.amount {
  color: #2457a6;
  font-size: clamp(2rem, 3.4vw, 3.15rem);
  font-weight: 900;
  line-height: 1;
}

.savings-chart-wrap {
  display: grid;
  grid-template-columns: minmax(240px, 0.95fr) minmax(260px, 1.05fr);
  gap: clamp(18px, 3vw, 28px);
  align-items: center;
  margin-top: clamp(10px, 1.7vh, 16px);
}

.savings-donut {
  --savings-share: 0;
  --software-share: 0;
  position: relative;
  width: min(100%, 270px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d5dbe3;
  box-shadow: none;
  overflow: visible;
}

.savings-donut::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    conic-gradient(
      rgb(0, 160, 66) 0 calc(var(--savings-share) * 1%),
      transparent calc(var(--savings-share) * 1%) 100%
    );
  transform: scaleX(-1);
}

.savings-badge {
  position: absolute;
  top: 15%;
  right: -8px;
  z-index: 2;
  width: clamp(58px, 6vw, 72px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 6px solid rgb(36, 86, 166);
  border-radius: 50%;
  background: #ffffff;
  color: #06204a;
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(16, 31, 56, 0.16);
}

.savings-donut::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: #ffffff;
}

.savings-donut-center {
  position: relative;
  z-index: 1;
  width: 54%;
  aspect-ratio: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  border-radius: 50%;
  background: transparent;
  color: #06204a;
  text-align: center;
}

.savings-donut-center span {
  max-width: 96%;
  font-size: clamp(1.3rem, 2.5vw, 2.15rem);
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
  overflow-wrap: normal;
}

.savings-donut-center small {
  max-width: 132px;
  margin-bottom: 7px;
  color: #556172;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.15;
}

.savings-legend {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.legend-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  width: 100%;
  border: 1px solid rgba(210, 219, 231, 0.9);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.74);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.legend-item:hover,
.legend-item:focus-visible,
.legend-item.active {
  background: rgba(85, 188, 182, 0.12);
  transform: translateX(2px);
  outline: none;
}

.legend-item em {
  align-self: center;
  color: #06204a;
  font-size: 0.92rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.legend-dot {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.revenue-dot {
  background: #2457a6;
}

.it-dot {
  background: #2f8db8;
}

.software-dot {
  background: #4fb15a;
}

.savings-dot {
  background: rgb(0, 160, 66);
}

.manage-dot {
  background: #9bd11f;
}

.legend-item strong,
.legend-item span {
  display: block;
}

.legend-item strong {
  color: #06204a;
  font-size: 0.94rem;
  line-height: 1.2;
}

.legend-item div > span {
  margin-top: 3px;
  color: #445366;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
}

.formula-popover {
  display: none;
  gap: 7px;
  max-width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid #00a042;
  border-radius: 8px;
  background: #eef8f7;
  color: #06204a;
  box-shadow: 0 10px 22px rgba(16, 31, 56, 0.08);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.savings-chart-wrap:hover + .formula-popover,
.savings-chart-wrap:focus-within + .formula-popover {
  opacity: 1;
  transform: translateY(0);
}

.formula-popover strong {
  font-size: 0.96rem;
  line-height: 1.15;
}

.formula-popover span {
  color: #445366;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
}

.formula-popover b {
  color: #2457a6;
  font-size: 1.2rem;
  line-height: 1;
}

.cta-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  padding-top: clamp(6px, 1vh, 10px);
  border-top: 1px solid #e2e7ed;
  text-align: center;
}

.cta-panel h3 {
  margin: 0 0 8px;
  color: #2457a6;
  font-size: clamp(1.18rem, 1.8vw, 1.38rem);
  line-height: 1.2;
}

.cta-panel p {
  max-width: 420px;
  margin: 0;
  color: #445366;
  font-size: 0.9rem;
  line-height: 1.35;
}

.connect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(42px, 5vh, 48px);
  margin-top: clamp(8px, 1.2vh, 12px);
  border-radius: 10px;
  background: #2457a6;
  color: #ffffff;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 900;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.connect-btn:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

.calculator-lead-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.96);
  color: #172840;
}

.calculator-lead-panel.open {
  display: block;
}

.calculator-lead-inner {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 26px 34px;
  border-radius: inherit;
  overflow: visible;
}

.calculator-lead-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #526071;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.calculator-lead-panel h3 {
  margin: 0 30px 8px 0;
  color: #1a365d;
  font-size: 1.45rem;
  line-height: 1.2;
}

.calculator-lead-panel p {
  margin: 0 0 18px;
  color: #4b596c;
  line-height: 1.45;
}

.calculator-lead-form {
  display: grid;
  gap: 12px;
  max-width: 100%;
  padding: 0;
  grid-template-columns: 1fr;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.calculator-lead-form label,
.calculator-lead-form input {
  width: 100%;
  min-width: 0;
}

.calculator-lead-form label {
  display: grid;
  gap: 7px;
  color: #26364a;
  font-weight: 800;
}

.calculator-lead-form input {
  min-height: 48px;
  border: 1px solid #ccd6e4;
  border-radius: 8px;
  padding: 0 14px;
  color: #172840;
  font: inherit;
  font-weight: 600;
  outline: none;
}

.calculator-lead-form input:focus {
  border-color: #6b8fbd;
  box-shadow: 0 0 0 3px rgba(36, 87, 166, 0.1);
}

.calculator-lead-error {
  min-height: 0;
  color: #b42323;
  font-size: 0.9rem;
  font-weight: 700;
}

.calculator-lead-thanks {
  min-height: 0;
  color: #087f3f;
  font-size: 0.9rem;
  font-weight: 800;
}

.calculator-lead-error:not(:empty),
.calculator-lead-thanks:not(:empty) {
  min-height: 18px;
}

.calculator-lead-form button {
  min-height: 48px;
  margin-top: 2px;
  border: 0;
  border-radius: 10px;
  background: #2457a6;
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.calculator-lead-form button:disabled {
  opacity: 0.72;
  cursor: progress;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  cursor: pointer;
}

.lock-overlay.hidden {
  display: none;
}

.lock-badge {
  position: relative;
  z-index: 1;
  width: 68px;
  height: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(38, 49, 70, 0.86);
  color: #ffffff;
  font-size: 1.45rem;
  box-shadow: 0 16px 32px rgba(16, 31, 56, 0.24);
}

.calculator-section-footer {
  position: relative;
  z-index: 2;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background-color: #f4f7fb;
}

.calculator-section-footer .calculator-footer-top-rule {
  opacity: 0.2;
  margin-right: 150px;
}

/* Keep the embedded footer below the first screen while the banner continues. */
@media (min-width: 769px) {
  #calculator.savings-calculator {
    justify-content: flex-start;
    min-height: calc(100vh - 100px);
    min-height: calc(100dvh - 100px);
    padding-top: 0;
    padding-bottom: 0;
  }

  #calculator > .calculator-shell {
    min-height: calc(100vh - 100px);
    min-height: calc(100dvh - 100px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: clamp(18px, 3vh, 48px);
    padding-bottom: clamp(18px, 3vh, 48px);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-4px);
  }

  40%,
  80% {
    transform: translateX(4px);
  }
}

@keyframes hintShake {
  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-5px);
  }

  40%,
  80% {
    transform: translateX(5px);
  }
}

@keyframes flipIn {
  from {
    transform: perspective(900px) rotateY(-85deg);
    opacity: 0.8;
  }

  to {
    transform: perspective(900px) rotateY(0deg);
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .savings-calculator {
    padding-right: 20px;
    padding-left: 20px;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 768px) {
  .calculator-main {
    margin-top: 72px;
    display: block;
    min-height: 0;
  }

  .savings-calculator {
    min-height: 0;
    align-items: stretch;
    padding: 24px 14px 0;
  }

  .calculator-hero {
    margin-bottom: 28px;
  }

  .calculator-hero p {
    font-size: 1rem;
  }

  .savings-calculator .parameters-card {
    padding: 18px 14px 16px;
  }

  .parameters-card h2 {
    font-size: 1.55rem;
  }

  .savings-calculator .calculator-row {
    grid-template-columns: 1fr;
    gap: 11px;
    margin-bottom: 11px;
  }

  .savings-calculator .single-input-row {
    grid-template-columns: 1fr;
  }

  .select-trigger,
  .spend-input-wrap,
  .savings-calculator .number-input {
    min-height: 46px;
    font-size: 1rem;
  }

  .calculate-btn {
    min-height: 48px;
    font-size: 1.05rem;
  }

  .result-card {
    min-height: 0;
    padding: 22px 14px 18px;
  }

  .calculator-lead-inner {
    padding: 24px 18px 18px;
  }

  .result-card h2 {
    font-size: 1.2rem;
  }

  .amount {
    font-size: 2.05rem;
  }

  .savings-chart-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 18px;
  }

  .savings-donut {
    width: min(220px, 78vw);
  }

  .cta-panel h3 {
    font-size: 1.32rem;
  }

  .cta-panel p {
    font-size: 0.94rem;
  }

  .lock-badge {
    width: 58px;
    height: 58px;
    font-size: 1.15rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
