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

:root {
  --yellow: #ffdd2d;
  --yellow-hover: #f5d420;
  --bg-input: #f0f2f5;
  --text-primary: #1a1a1a;
  --text-secondary: #8a8f98;
  --text-link: #336fee;
  --radius: 12px;
  --radius-btn: 10px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6f8;
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px 60px;
}

.calculator {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  max-width: 960px;
  width: 100%;
  align-items: start;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 16px;
  padding: 36px 40px 40px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.calculator__form {
  min-width: 0;
}

/* Steps */
.step {
  display: none;
}

.step--active {
  display: block;
}

.step__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.step__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.step__badge {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Fields */
.field {
  margin-bottom: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.field__label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  cursor: pointer;
}

.field__control {
  position: relative;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 10px 16px 12px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.field__control--select {
  padding-right: 40px;
}

.field__control--with-badge {
  padding-right: 56px;
}

.field__input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  padding: 0;
  line-height: 1.4;
}

.field__input::placeholder {
  color: #b0b5be;
  font-weight: 400;
}

.field__input--money {
  font-size: 16px;
  font-weight: 500;
}

select.field__input {
  appearance: none;
  cursor: pointer;
  padding-right: 8px;
}

.field__chevron {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  pointer-events: none;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
}

.field__control--error {
  box-shadow: inset 0 0 0 1.5px #e64646;
}

.field__error {
  display: block;
  font-size: 12px;
  color: #e64646;
  margin-top: 4px;
  padding-left: 4px;
  min-height: 16px;
}

.field__control--date {
  cursor: pointer;
  padding-right: 44px;
}

.field__input--date {
  cursor: pointer;
}

.field__input--date[readonly] {
  background: transparent;
}

.field__date-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%238a8f98' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Air Datepicker */
.air-datepicker {
  --adp-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --adp-font-size: 14px;
  --adp-width: 280px;
  --adp-border-radius: 12px;
  --adp-border-color: #e2e5ea;
  --adp-border-color-inner: #eef0f3;
  --adp-accent-color: #ffdd2d;
  --adp-color: #1a1a1a;
  --adp-color-secondary: #8a8f98;
  --adp-day-name-color: #8a8f98;
  --adp-background-color-hover: #f0f2f5;
  --adp-background-color-active: #e8eaed;
  --adp-background-color-selected: #ffdd2d;
  --adp-color-selected: #1a1a1a;
  --adp-color-current-date: #1a1a1a;
  --adp-background-color-selected-other-month: #f5d420;
  --adp-btn-color: #336fee;
  --adp-btn-border-radius: 8px;
  --adp-btn-background-color-hover: #f0f2f5;
  --adp-nav-height: 40px;
  --adp-padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e5ea;
  z-index: 200;
}

.air-datepicker-nav--title {
  font-weight: 600;
  font-size: 14px;
}

.air-datepicker-cell {
  border-radius: 8px;
  font-weight: 500;
}

.air-datepicker-cell.-current- {
  font-weight: 700;
}

.air-datepicker-cell.-selected- {
  font-weight: 600;
}

.field__percent {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Slider */
.field--slider .field__control {
  padding-bottom: 8px;
}

.field__value-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--yellow) 0%,
    var(--yellow) var(--progress, 100%),
    #e0e3e8 var(--progress, 100%),
    #e0e3e8 100%
  );
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--yellow);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--yellow);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #e0e3e8;
}

/* Legal */
.legal {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 20px 0 28px;
  max-width: 520px;
}

.legal a {
  color: var(--text-link);
  text-decoration: none;
}

.legal a:hover {
  text-decoration: underline;
}

/* Actions */
.step__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
}

.step__actions--split {
  justify-content: space-between;
  align-items: center;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  padding: 14px 32px;
  transition: background 0.15s, opacity 0.15s;
}

.btn--primary {
  background: var(--yellow);
  color: var(--text-primary);
  min-width: 140px;
}

.btn--primary:hover {
  background: var(--yellow-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 14px 16px;
}

.btn--ghost:hover {
  color: var(--text-primary);
}

/* Summary sidebar */
.summary {
  padding-top: 8px;
}

.summary__item {
  margin-bottom: 28px;
}

.summary__item:last-child {
  margin-bottom: 0;
}

.summary__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.summary__value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.summary__value--range {
  font-size: 20px;
}

.summary__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--text-secondary);
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  padding: 0;
  line-height: 1;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
  z-index: 100;
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .page {
    padding: 24px 16px 40px;
  }

  .calculator {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 24px 20px 28px;
    border-radius: 12px;
  }

  .summary {
    order: -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
    padding: 20px;
    background: #fafbfc;
    border-radius: var(--radius);
  }

  .summary__item {
    margin-bottom: 0;
  }

  .summary__value {
    font-size: 18px;
  }

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

  .step__actions--split {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .step__actions--split .btn {
    width: 100%;
  }
}
