.ec-wrapper {
  box-sizing: border-box;
}
.ec-wrapper *,
.ec-wrapper *::before,
.ec-wrapper *::after {
  box-sizing: inherit;
}

.ec-wrapper {
  --primary-text-color: rgb(19, 87, 128);
  --primary-bg-color: rgb(19, 87, 128);
  --primary-hover-color: rgb(131, 176, 204);
  --primary-border-color: rgb(68, 111, 137);

  --secondary-text-color: #fefefe;
  --secondary-bg-color: #fefefe;
  --secondary-border-color: #fefefe;

  --tertiary-bg-color: rgb(235, 242, 246);
}

.ec-wrapper .ec-container {
  margin: 0 auto;
  max-width: 1100px;
}

@media (max-width: 540px) {
  .ec-wrapper .ec-container {
    margin: 0 auto;
    max-width: 500px;
  }
}

.ec-wrapper .ec-service-calculator__title {
  color: var(--primary-text-color);
  font-size: 30px;
  text-align: center;
}

.ec-wrapper .ec-service-calculator__text {
  color: var(--primary-text-color);
}

@media (max-width: 540px) {
  .ec-wrapper .table {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .ec-wrapper .table {
    font-size: 11px;
  }
}

.ec-wrapper .ec-table__title,
.ec-wrapper .ec-table__footer {
  color: var(--secondary-text-color);
  border: 2px solid var(--primary-border-color);
  background-color: var(--primary-bg-color);
  margin: 5px 0px;
}

.ec-wrapper .ec-row,
.ec-wrapper .ec-table__title,
.ec-wrapper .ec-table__footer {
  display: flex;
  align-items: center;
  padding: 2px 10px;
  min-height: 40px;
  border-radius: 5px;
}

.ec-wrapper .ec-accordion-content .ec-row {
  color: var(--primary-text-color);
  transition: background-color 0.3s ease-out;
}

.ec-wrapper .ec-accordion-content .ec-row:nth-child(even) {
  background-color: var(--tertiary-bg-color);
}

.ec-wrapper .ec-accordion-content .ec-row:nth-child(odd) .ec-quantity .ec-input-quantity {
  background-color: var(--tertiary-bg-color);
}

@media (hover: hover) {
  .ec-wrapper .ec-accordion-content .ec-row:hover {
    background-color: var(--primary-hover-color);
  }
}

.ec-wrapper .ec-work-type,
.ec-wrapper .ec-work-type-title {
  max-width: 700px;
  min-width: 270px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ec-wrapper .ec-unit,
.ec-wrapper .ec-unit-title {
  max-width: 50px;
  min-width: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-wrapper .ec-cost,
.ec-wrapper .ec-cost-title {
  max-width: 70px;
  min-width: 60px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-wrapper .ec-quantity,
.ec-wrapper .ec-quantity-title {
  max-width: 180px;
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-wrapper .ec-result,
.ec-wrapper .ec-result-title {
  max-width: 80px;
  min-width: 45px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Mobile layout: 2-line rows ───────────────────────────── */
@media (max-width: 640px) {

  /* Row wraps: name on line 1, controls on line 2 */
  .ec-wrapper .ec-accordion-content .ec-row {
    flex-wrap: wrap;
    padding: 8px 8px;
    min-height: unset;
    gap: 0;
  }

  /* Line 1: name full-width */
  .ec-wrapper .ec-work-type {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.4;
    padding: 4px 0 6px;
    align-items: flex-start;
  }

  /* Line 2: ед + цена | controls | сумма */
  .ec-wrapper .ec-unit {
    min-width: 28px;
    max-width: 36px;
    font-size: 11px;
    color: #888;
    align-self: center;
  }

  .ec-wrapper .ec-cost {
    min-width: 46px;
    max-width: 60px;
    font-size: 13px;
    align-self: center;
  }

  /* Bigger touch targets */
  .ec-wrapper .ec-quantity {
    height: 44px;
    max-width: unset;
    flex: 1;
    min-width: 110px;
  }

  .ec-wrapper .ec-quantity > .ec-quantity-button {
    max-width: 44px;
    min-width: 40px;
    max-height: 44px;
    font-size: 20px;
    font-weight: 600;
    padding: 0;
  }

  .ec-wrapper .ec-quantity > .ec-input-quantity {
    font-size: 16px;
    min-width: 36px;
    max-height: 44px;
  }

  .ec-wrapper .ec-result {
    min-width: 48px;
    max-width: 64px;
    font-size: 13px;
    font-weight: 600;
    align-self: center;
  }

  /* Header: hide Ед/Цена/Кол/Сумма titles — show only Наименование */
  .ec-wrapper .ec-unit-title,
  .ec-wrapper .ec-cost-title,
  .ec-wrapper .ec-quantity-title,
  .ec-wrapper .ec-result-title {
    display: none;
  }

  .ec-wrapper .ec-work-type-title {
    min-width: 0;
    width: 100%;
  }

  .ec-wrapper .ec-table__title {
    padding: 6px 8px;
  }
}

.ec-wrapper label {
  cursor: pointer;
}

.ec-wrapper .ec-accordion-radio {
  -webkit-appearance: none;
  appearance: none;
  height: 0;
  width: 0;
  position: absolute;
}

.ec-wrapper .ec-head {
  color: var(--primary-text-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--primary-border-color);
  border-radius: 5px;
  padding: 1rem;
  background-color: var(--secondary-bg-color);
  transition:
    color 0.5s ease-out,
    background-color 0.5s ease-out;
}

@media (hover: hover) {
  .ec-wrapper .ec-head:hover {
    color: var(--secondary-text-color);
    background-color: var(--primary-bg-color);
  }
}

.ec-wrapper .ec-arrow {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 15px solid var(--primary-border-color);
  display: inline-block;
  opacity: 1;
  transition: all 0.5s ease-out;
}

.ec-wrapper .ec-accordion-radio:checked ~ .ec-accordion-title > .ec-head {
  border-radius: 5px 5px 0px 0px;
}

.ec-wrapper .ec-accordion-radio:checked ~ .ec-accordion-title > .ec-head > .ec-arrow {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 15px solid var(--secondary-border-color);
  border-top: 0px solid var(--secondary-border-color);
}

@media (hover: hover) {
  .ec-wrapper .ec-table__block:hover .ec-accordion-title > .ec-head > .ec-arrow {
    border-block-color: var(--secondary-border-color);
  }
}

.ec-wrapper .ec-accordion-radio:checked ~ .ec-accordion-title > .ec-head {
  color: var(--secondary-text-color);
  background-color: var(--primary-bg-color);
}

.ec-wrapper .ec-body {
  display: none;
}

.ec-wrapper .ec-accordion-radio:checked ~ .ec-body {
  display: block;
  border: 1px solid var(--primary-border-color);
  border-radius: 0px 0px 5px 5px;
}

.ec-wrapper .ec-quantity > .ec-input-quantity {
  display: inline-flex;
  justify-content: center;
  text-align: center;
  /* max-height: 26px; */
  height: 100%;
  width: 100%;
  min-width: 35px;
  padding: 0px;
  margin: 0px;
  color: var(--primary-text-color);
  border: 0px solid var(--primary-border-color);
  background-color: var(--secondary-bg-color);
}

.ec-wrapper .ec-quantity > .ec-quantity-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;

  height: 100%;
  width: 100%;
  max-width: 30px;
  /* max-height: 26px; */

  padding: 10px;

  color: var(--secondary-text-color);

  background-color: var(--primary-bg-color);
  border: 1px solid var(--primary-border-color);

  cursor: pointer;

  transition:
    color 0.5s ease-out,
    background-color 0.5s ease-out;
}

@media (hover: hover) {
  .ec-wrapper .ec-quantity > .ec-quantity-button:hover {
    background-color: var(--primary-hover-color);
  }
}

.ec-wrapper .ec-quantity > .ec-quantity-button:active {
  color: var(--primary-text-color);
  background-color: var(--secondary-bg-color);
}

.ec-wrapper .ec-quantity > .ec-quantity-down {
  border-radius: 5px 0px 0px 5px;
}

.ec-wrapper .ec-quantity > .ec-quantity-up {
  border-radius: 0px 5px 5px 0px;
}

@media (max-width: 450px) {
  .ec-wrapper .ec-quantity > .ec-input-quantity {
    min-width: 25px;
  }

  .ec-wrapper .ec-quantity > .ec-quantity-button {
    max-height: 30px;
    max-width: 20px;
    padding: 10px;
  }
}

@media (max-width: 450px) {
  .ec-wrapper .ec-quantity > .ec-input-quantity {
    min-width: 20px;
  }

  .ec-wrapper .ec-quantity > .ec-quantity-button {
    max-height: 30px;
    max-width: 18px;
    padding: 8px;
  }
}

.ec-wrapper .ec-block-all-summa {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
  margin: 0px 10px;
}

.ec-wrapper input[type='number']::-webkit-inner-spin-button,
.ec-wrapper input[type='number']::-webkit-outer-spin-button {
  opacity: 0;
  display: none;
}

.ec-wrapper .ec-table__buttons {
  padding: 10px 10px;
}

.ec-wrapper .ec-table__buttons > .ec-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 20px 20px;
  font-size: 17px;
  color: var(--secondary-text-color);
  background-color: var(--primary-bg-color);
  border: 2px solid var(--primary-border-color);
  border-radius: 10px;
  cursor: pointer;

  transition:
    color 0.5s ease-out,
    background-color 0.5s ease-out;
}

@media (hover: hover) {
  .ec-wrapper .ec-table__buttons > .ec-button:hover {
    color: var(--primary-text-color);
    background-color: var(--secondary-bg-color);
  }
}

.ec-wrapper .ec-additional-works {
  max-width: 800px;
}

.ec-wrapper .ec-additional-works__block {
  display: flex;
  flex-direction: column;
  color: var(--primary-text-color);
  border: 2px solid var(--primary-border-color);
  border-radius: 5px;
}
.ec-wrapper .ec-additional-works__title {
  font-size: 18px;
}

.ec-wrapper .ec-table__block {
  margin: 4px 0px 0px 0px;
}
.ec-wrapper .ec-button:disabled {
  background-color: #7c7c7c;
}
.ec-wrapper .ec-button:disabled:hover {
  cursor: not-allowed;

}

/* ── Sums block ─────────────────────────────────────────────── */
.ec-wrapper .ec-sums-block {
  padding: 12px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  border-radius: 0 0 6px 6px;
}

.ec-wrapper .ec-base-sum-row,
.ec-wrapper .ec-total-sum-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  padding: 3px 0;
}

.ec-wrapper .ec-base-sum-row {
  color: #888;
  font-size: 13px;
}

.ec-wrapper .ec-total-sum-row {
  font-weight: 700;
  font-size: 18px;
  color: #1d2327;
}

.ec-wrapper .ec-sums-block__label {
  color: #646970;
  font-weight: 400;
  font-size: 0.85em;
}

.ec-wrapper .ec-summa {
  color: #00a32a;
  font-variant-numeric: tabular-nums;
}

.ec-wrapper .ec-base-summa {
  font-variant-numeric: tabular-nums;
}

/* ── Minimum price warning ──────────────────────────────────── */
.ec-wrapper .ec-min-price-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e5;
  border: 1px solid #f0c040;
  border-left: 4px solid #f0a500;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0 16px;
  font-size: 14px;
  color: #5a3e00;
  line-height: 1.5;
  animation: ecMinWarnIn .25s ease;
}

@keyframes ecMinWarnIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ec-wrapper .ec-min-price-warning__icon {
  font-size: 20px;
  flex-shrink: 0;
}

.ec-wrapper .ec-min-price-warning__text {
  font-weight: 500;
}

/* ── Search ─────────────────────────────────────────────────── */
.ec-wrapper .ec-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}

.ec-wrapper .ec-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-text-color);
  opacity: .55;
  pointer-events: none;
  display: flex;
}

.ec-wrapper .ec-search-input {
  width: 100%;
  max-width: 420px;
  padding: 9px 38px 9px 38px;
  font-size: 14px;
  color: var(--primary-text-color);
  border: 2px solid var(--primary-border-color);
  border-radius: 8px;
  background: var(--secondary-bg-color);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.ec-wrapper .ec-search-input:focus {
  border-color: var(--primary-bg-color);
  box-shadow: 0 0 0 3px rgba(19,87,128,.15);
}

.ec-wrapper .ec-search-input::placeholder {
  color: #aab;
}

/* hide browser default clear button */
.ec-wrapper .ec-search-input::-webkit-search-cancel-button { display: none; }

.ec-wrapper .ec-search-clear {
  position: absolute;
  left: calc(420px - 32px);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #888;
  padding: 4px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.ec-wrapper .ec-search-clear:hover {
  color: #333;
  background: rgba(0,0,0,.07);
}

.ec-wrapper .ec-search-count {
  font-size: 13px;
  color: #888;
  white-space: nowrap;
  margin-left: 4px;
}

/* row hidden by search */
.ec-wrapper .ec-row--hidden {
  display: none !important;
}

/* section hidden because all rows are filtered out */
.ec-wrapper .ec-table__block--hidden {
  display: none !important;
}

/* highlight matched text */
.ec-wrapper .ec-search-match {
  background: #fff176;
  border-radius: 2px;
  padding: 0 1px;
}

@media (max-width: 540px) {
  .ec-wrapper .ec-search-input { max-width: 100%; }
  .ec-wrapper .ec-search-clear { left: calc(100% - 38px); }
}
