.formula-weight-calc {
  --wc-ink: #17344c;
  --wc-muted: #64798b;
  --wc-line: #d9e4ed;
  --wc-panel: #ffffff;
  --wc-soft: linear-gradient(180deg, #f7fbfe 0%, #edf5fb 100%);
  --wc-blue: #4e7ee8;
  --wc-blue-deep: #113f7d;
  --wc-blue-soft: #5aa8df;
  --wc-orange: #f6a31a;
  --wc-danger: #d63939;
}

.weight-calc-intro {
  padding: 28px 0 0;
}

.weight-calc-intro__card {
  padding: 28px 32px;
  border: 1px solid var(--wc-line);
  border-radius: 24px;
  background: var(--wc-soft);
}

.weight-calc-kicker {
  margin: 0 0 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--wc-blue-deep);
}

.weight-calc-intro__card h2,
.weight-calc-intro__card p {
  margin: 0;
}

.weight-calc-intro__card h2 {
  margin-bottom: 12px;
  color: var(--wc-ink);
}

.weight-calc-intro__card p {
  color: var(--wc-muted);
}

.weight-calc-main {
  padding: 24px 0 60px;
}

.weight-calc-nav {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 12px 0 12px;
  margin-bottom: 24px;
  border: 1px solid var(--wc-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.weight-calc-nav__item {
  flex: 0 0 112px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #d8e3eb;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}

.weight-calc-nav__item.is-active {
  border-color: var(--wc-blue);
  box-shadow: inset 0 0 0 1px rgba(78, 126, 232, 0.18);
  background: #f4f8ff;
}

.weight-calc-nav__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 72px;
  padding: 8px;
  border-radius: 12px;
  background: #f7fafc;
}

.weight-calc-nav__thumb img {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: contain;
}

.weight-calc-nav__fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #eaf1ff;
  color: var(--wc-blue-deep);
  font-weight: 700;
  text-align: center;
}

.weight-calc-nav__label {
  font-size: 12px !important;
  font-weight: 600;
  line-height: 1.35;
  color: var(--wc-ink);
  text-align: center;
}

.weight-calc-sections {
  display: grid;
  gap: 24px;
}

.weight-calc-block {
  scroll-margin-top: 132px;
  padding: 16px;
  border: 1px solid var(--wc-line);
  border-radius: 24px;
  background: var(--wc-panel);
  box-shadow: 0 18px 40px rgba(16, 53, 76, 0.06);
}

.weight-calc-block__title {
  margin-bottom: 18px;
  padding: 0 0 0 16px;
  border-left: 14px solid var(--wc-blue-deep);
  background: linear-gradient(90deg, var(--wc-blue) 0%, #5e90f2 100%);
  border-radius: 0 0 0 0;
}

.weight-calc-block__title h3 {
  margin: 0;
  padding: 8px 14px 8px 0;
  color: #fff;
}

.weight-calc-step {
  margin-bottom: 10px;
}

.weight-calc-step--full {
  margin-bottom: 14px;
}

.weight-calc-step__title {
  margin: 0 0 8px;
  color: var(--wc-ink);
  font-weight: 600;
}

.weight-calc-step__title span {
  color: var(--wc-danger);
  font-weight: 700;
}

.weight-calc-step__card {
  padding: 12px 14px;
  border-radius: 8px;
  background: #f1f1f1;
}

.weight-calc-step__card--material {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 12px;
  align-items: end;
}

.weight-calc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.weight-calc-inline-field,
.weight-calc-field,
.weight-calc-result__field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weight-calc-inline-field span,
.weight-calc-field span,
.weight-calc-result__field span {
  flex: 0 0 132px;
  font-weight: 600;
  color: var(--wc-ink);
}

.weight-calc-inline-field select,
.weight-calc-inline-field input,
.weight-calc-field input,
.weight-calc-result__field input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #bcc9d6;
  border-radius: 8px;
  background: #fff;
  color: var(--wc-ink);
}

.weight-calc-fields {
  display: grid;
  gap: 8px;
  max-width: 460px;
}

.weight-calc-fields--compact {
  max-width: 460px;
}

.weight-calc-actions {
  display: flex;
  gap: 10px;
  margin: 14px 0 12px;
}

.weight-calc-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #b8c7d5;
  border-radius: 8px;
  background: #fff;
  color: var(--wc-ink);
  cursor: pointer;
}

.weight-calc-btn--primary {
  background: var(--wc-blue);
  border-color: var(--wc-blue);
  color: #fff;
}

.weight-calc-btn--secondary {
  background: #f5f9fc;
}

.weight-calc-result {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f1f1f1;
}

.weight-calc-result__field {
  display: grid;
  grid-template-columns: 140px minmax(0, 210px);
  gap: 12px;
  align-items: center;
}

.weight-calc-result__field span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 10px;
  background: var(--wc-orange);
  border-radius: 8px;
  color: #1d1d1d;
  text-align: center;
}

.weight-calc-result__field input[readonly] {
  background: #fff;
}

.weight-calc-reverse__text {
  margin: 0 0 8px;
  color: var(--wc-muted);
}

.weight-calc-reverse__card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f1f1f1;
}

.weight-calc-field--reverse input[readonly] {
  background: #edf4f8;
}

.weight-calc-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--wc-danger);
}

.weight-calc-figure {
  margin: 40px 0 0;
  padding: 8px;
  background: #fff;
}

.weight-calc-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.weight-calc-figure__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 16px;
  border: 1px dashed #bfd0db;
  background: #f7fafc;
  color: var(--wc-muted);
  text-align: center;
}

@media (max-width: 991px) {
  .weight-calc-body,
  .weight-calc-reverse__card,
  .weight-calc-step__card--material,
  .weight-calc-result__field {
    grid-template-columns: 1fr;
  }

  .weight-calc-figure {
    margin-top: 0;
  }

  .weight-calc-inline-field,
  .weight-calc-field,
  .weight-calc-result__field {
    align-items: stretch;
  }

  .weight-calc-inline-field span,
  .weight-calc-field span,
  .weight-calc-result__field span {
    flex: none;
  }
}

@media (max-width: 767px) {
  .weight-calc-intro__card,
  .weight-calc-block,
  .weight-calc-step__card,
  .weight-calc-result,
  .weight-calc-reverse__card {
    padding: 14px;
  }

  .weight-calc-nav {
    top: 10px;
    padding: 10px;
  }

  .weight-calc-nav__item {
    flex-basis: 100px;
  }

  .weight-calc-block__title {
    padding-left: 12px;
    border-left-width: 10px;
  }

  .weight-calc-inline-field,
  .weight-calc-field {
    gap: 8px;
  }
}
