:root {
  --yellow: #F7E216;
  --ink: #212529;
  --head: #333;
  --muted: #999;
  --line: #eee;
  --accent: #EF6400;
  --accent-light: #FF8D36;
  --price: #9F1E00;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Open Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.4px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
}

button { font: inherit; }

.calc {
  background: var(--yellow);
  padding: 40px 0;
  min-height: 600px;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.calc__title {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 500;
  margin: 0 0 24px;
  padding: 20px 0;
  color: var(--ink);
}

.calc__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: stretch;
}

.card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: 5px 5px 10px rgba(0, 0, 0, .1);
  padding: 16px;
}

.card__icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  opacity: .9;
}

.card__title {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--head);
  margin: 0 34px 8px 0;
}

.card__lead {
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* ---------- multiselect ---------- */

.ms { position: relative; }

.ms__control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 39px;
  padding: 2px 10px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 5px;
  cursor: text;
  transition: border-color .2s;
}

.ms__control:hover { border-color: #ccc; }
.ms--open .ms__control { border-color: var(--accent); }

.ms__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 6px 2px 8px;
  border-radius: 4px;
  background: #f2f2f2;
  font-size: 12px;
  color: #444;
}

.ms__chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms__chip button {
  border: 0;
  background: none;
  padding: 0;
  line-height: 1;
  font-size: 15px;
  color: #888;
  cursor: pointer;
}

.ms__chip button:hover { color: var(--accent); }

.ms__search {
  flex: 1 1 140px;
  min-width: 120px;
  padding: 6px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: #333;
}

.ms__search::placeholder { color: var(--muted); }

.ms__drop {
  position: absolute;
  z-index: 60;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  display: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .14);
}

.ms--open .ms__drop { display: block; }

.ms__group {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.ms__opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.ms__opt:hover { background: #fff7ef; }
.ms__opt.is-hidden { display: none; }
.ms__opt input { margin: 2px 0 0; flex: 0 0 auto; }
.ms__empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- поля, счётчики ---------- */

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.field-row--top { margin-top: 4px; }
.field-label { font-size: 14px; }

.stepper { display: flex; width: 100%; }

.stepper button {
  width: 35px;
  height: 35px;
  border: 0;
  background: #eee;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}

.stepper button:hover { background: #ccc; }
.stepper button:active { background: var(--accent); color: #fff; }
.stepper .minus { border-radius: 5px 0 0 5px; }
.stepper .plus { border-radius: 0 5px 5px 0; }

.stepper input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 3px 0;
  border: 2px solid var(--line);
  border-radius: 0;
  text-align: center;
  font-size: 14.4px;
  color: #000;
  background: #fff;
  outline: 0;
  transition: border-color .2s;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.stepper input:hover { border-color: #ccc; }
.stepper input:focus { border-color: var(--accent); }

/* ---------- периоды оплаты ---------- */

.periods {
  display: flex;
  gap: 4px;
  justify-content: space-between;
}

.periods input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.periods label {
  flex: 1 1 0;
  padding: 5px;
  border: 1px solid #fff;
  border-radius: 5px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background .2s, border-color .2s;
}

.periods label:hover { background: #eee; border-color: #eee; }
.periods input:checked + label { border-color: var(--accent); }
.periods input:focus-visible + label { box-shadow: 0 0 0 2px rgba(239, 100, 0, .35); }

/* ---------- итог ---------- */

.field-row--total { margin-top: 24px; }
.total-label { font-weight: 600; }
.total { font-weight: 600; color: var(--price); font-size: 14.4px; }
.total b { font-size: 24px; font-weight: 600; }

.btn-connect {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 10px 0;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 100%);
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: #fff;
  font-size: 14.4px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}

.btn-connect:hover { background: linear-gradient(180deg, #ff9e55 0%, var(--accent) 100%); }
.btn-connect:active { background: linear-gradient(180deg, #ffac6c 0%, #f07015 100%); }

.note {
  display: block;
  margin-top: 12px;
  font-size: 10px;
  font-style: italic;
  color: var(--muted);
}

/* ---------- пустое состояние ---------- */

.calc__empty {
  padding: 24px 0 0;
  text-align: center;
}

.calc__empty svg {
  width: 100%;
  max-width: 720px;
  height: auto;
}

/* ---------- блок результата ---------- */

.calc__result {
  width: calc(50% - 15px);
  margin-top: 24px;
}

/* ---------- модальное окно ---------- */

.mask {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, .8);
}

.modal {
  position: fixed;
  z-index: 9999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 30px);
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: linear-gradient(to right, #E5F0FE, #E2FEF8);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: #666;
  cursor: pointer;
}

.modal__close:hover { color: var(--accent); }

.modal__title { margin: 0 0 6px; font-size: 20px; color: var(--head); }
.modal__sub { margin: 0 0 16px; font-size: 13px; color: #5f6b73; }

.fld { display: block; margin-bottom: 12px; }
.fld span { display: block; margin-bottom: 4px; font-size: 13px; color: #445; }

.fld input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #dbe4ea;
  border-radius: 5px;
  background: #fff;
  font-size: 14px;
  outline: 0;
}

.fld input:focus { border-color: var(--accent); }
.fld input.is-error { border-color: #d33; }

.consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 4px 0 12px;
  font-size: 12px;
  color: #556;
  cursor: pointer;
}

.consent input { margin: 2px 0 0; }

.modal .btn-connect { margin-top: 4px; }
.modal__msg { min-height: 18px; margin: 10px 0 0; font-size: 13px; }
.modal__msg.is-ok { color: #1a7f37; }
.modal__msg.is-err { color: #c62828; }

/* ---------- адаптив ---------- */

@media (max-width: 991px) {
  .calc__grid { grid-template-columns: 1fr; }
  .calc__result { width: 100%; }
  .calc__title { font-size: 26px; padding: 8px 0; }
}

@media (max-width: 575px) {
  .calc { padding: 24px 0; }
  .calc__title { font-size: 21px; }
  .card__icon { width: 32px; height: 32px; }
  .card__title { font-size: 16px; margin-right: 40px; }
  .field-row { grid-template-columns: 1fr; gap: 6px; }
  .periods label { font-size: 13px; padding: 6px 2px; }
}
