.sm-calculator {
  --sm-ink: #26283f;
  --sm-line: #dedee5;
  --sm-soft: #f6f6f8;
  --sm-accent: #292b46;
  display: grid;
  grid-template-columns: minmax(320px, 560px) minmax(280px, 1fr);
  gap: clamp(32px, 7vw, 120px);
  align-items: start;
  color: var(--sm-ink);
  font-family: Montserrat, Arial, sans-serif;
  max-width: 1080px;
  margin: 56px auto;
  padding: 0 24px;
}

.sm-calculator__controls {
  display: grid;
  gap: 16px;
}

.sm-row,
.sm-dimension-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--sm-line);
  min-height: 40px;
}

.sm-row:last-of-type {
  border-bottom: 1px solid var(--sm-line);
}

.sm-row label,
.sm-dimension-row label {
  font-weight: 600;
}

.sm-row strong {
  justify-self: end;
}

.sm-swatch-row {
  align-items: start;
  padding: 10px 0;
}

.sm-swatch-row label {
  display: grid;
  gap: 5px;
}

.sm-swatch-row label strong {
  justify-self: start;
  font-size: 13px;
  font-weight: 500;
  color: #56596d;
}

.sm-swatch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.sm-swatch {
  width: 78px;
  height: 58px;
  border: 1px solid #d6d7dd;
  border-radius: 0;
  background: #fff;
  padding: 0;
  cursor: pointer;
}

.sm-swatch + .sm-swatch {
  margin-left: -1px;
}

.sm-swatch.is-active {
  border-color: var(--sm-accent);
  box-shadow: 0 0 0 2px rgba(41, 43, 70, 0.14);
  position: relative;
  z-index: 1;
}

.sm-swatch__sample {
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.sm-dimensions {
  display: grid;
  gap: 14px;
  padding: 14px 0;
}

.sm-dimension-row {
  grid-template-columns: 160px minmax(110px, 140px) minmax(110px, 150px);
  border-top: 0;
  min-height: 44px;
}

.sm-number-pair {
  display: grid;
  gap: 4px;
}

.sm-number-pair span {
  font-size: 12px;
}

.sm-calculator select,
.sm-calculator input {
  width: 100%;
  min-height: 30px;
  border: 1px solid #cfd1d8;
  border-radius: 4px;
  background: #fff;
  color: var(--sm-ink);
  font: inherit;
  padding: 4px 8px;
}

.sm-row--muted {
  background: linear-gradient(180deg, #fff, #fbfbfc);
}

.sm-calculator [hidden],
.sm-row--hidden {
  display: none !important;
}

.sm-code {
  display: block;
  background: var(--sm-soft);
  min-height: 34px;
  padding: 9px 12px;
  border: 1px solid #ebebef;
  font: 14px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.sm-code--description {
  font-family: inherit;
}

.sm-status {
  color: #a2392d;
  min-height: 20px;
  font-weight: 600;
}

.sm-add {
  width: max-content;
  min-width: 132px;
  border: 0;
  border-radius: 8px;
  background: var(--sm-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 11px 22px;
  cursor: pointer;
}

.sm-add:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sm-add--contact-required {
  display: none;
}

.sm-calculator__media {
  display: grid;
  justify-items: center;
  gap: 30px;
  padding-top: 80px;
}

.sm-calculator__media > img {
  width: min(360px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
}

.sm-thumb {
  width: 66px;
  height: 66px;
  border: 2px solid #111;
  display: grid;
  place-items: center;
}

.sm-thumb img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.sm-gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 360px;
}

.sm-gallery__button {
  width: 48px;
  height: 48px;
  border: 1px solid #d5d6db;
  border-radius: 4px;
  background: #fff;
  padding: 4px;
  cursor: pointer;
}

.sm-gallery__button.is-active {
  border-color: var(--sm-accent);
  box-shadow: 0 0 0 2px rgba(41, 43, 70, 0.12);
}

.sm-gallery__button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sm-docs {
  display: grid;
  gap: 18px;
  justify-items: center;
  margin-top: 24px;
}

.sm-docs a {
  min-width: 160px;
  text-align: center;
  color: var(--sm-ink);
  text-decoration: none;
  border: 1px solid #d1d1d1;
  border-radius: 8px;
  background: #efeee9;
  padding: 9px 14px;
}

.sm-contact {
  grid-column: 1 / -1;
  margin-top: 20px;
  border-radius: 16px;
  background: #efede7;
  padding: clamp(24px, 3vw, 34px);
}

.sm-contact h3 {
  margin: 0 0 24px;
  color: var(--sm-ink);
  font-size: clamp(22px, 2.1vw, 32px);
  line-height: 1.2;
  font-weight: 700;
}

.sm-contact__form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px clamp(28px, 6vw, 96px);
}

.sm-contact label {
  display: grid;
  gap: 6px;
  font-weight: 500;
}

.sm-contact input,
.sm-contact select,
.sm-contact textarea {
  min-height: 42px;
  border: 1px solid #c9c8c2;
  border-radius: 4px;
  background: #fff;
}

.sm-contact textarea {
  resize: vertical;
}

.sm-contact__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.sm-contact__comments,
.sm-contact__status {
  grid-column: 1 / -1;
}

.sm-contact__status {
  min-height: 20px;
  color: var(--sm-ink);
  font-weight: 600;
}

.sm-request {
  justify-self: end;
  min-width: 150px;
  border: 0;
  border-radius: 8px;
  background: var(--sm-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
}

.sm-request:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media (max-width: 760px) {
  .sm-calculator {
    grid-template-columns: 1fr;
    gap: 28px;
    margin: 28px auto;
  }

  .sm-calculator__media {
    padding-top: 0;
  }

  .sm-row,
  .sm-dimension-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 0;
  }

  .sm-row strong {
    justify-self: start;
  }

  .sm-swatch-row label strong {
    max-width: 100%;
  }

  .sm-contact__form,
  .sm-contact__split {
    grid-template-columns: 1fr;
  }

  .sm-request {
    justify-self: stretch;
  }
}
