.unit-tool {
  background: #ffffff;

  border: 1px solid var(--math-line);
  border-radius: 18px;

  box-shadow: var(--math-shadow);

  overflow: hidden;
}


.unit-tool-head {
  display: flex;
  align-items: start;
  justify-content: space-between;

  gap: 20px;

  padding: 25px 28px 20px;

  border-bottom: 1px solid var(--math-line);
}


.unit-tool-head h1 {
  margin: 0 0 7px;

  font-size: 30px;
}


.unit-tool-head p {
  margin: 0;

  color: var(--math-text-soft);

  font-size: 13px;
  line-height: 1.7;
}


.unit-grade {
  flex: 0 0 auto;

  padding: 6px 9px;

  background: var(--math-elementary-soft);

  border-radius: 8px;

  color: #287a51;

  font-size: 11px;
  font-weight: 800;
}


.unit-tabs {
  display: grid;

  grid-template-columns:
    repeat(5, minmax(0, 1fr));

  background: #f6f8fb;

  border-bottom: 1px solid var(--math-line);
}


.unit-tab {
  min-height: 48px;

  padding: 8px;

  background: transparent;

  border: 0;
  border-right: 1px solid var(--math-line);

  color: var(--math-text-soft);

  font-size: 12px;
  font-weight: 800;

  cursor: pointer;
}


.unit-tab:last-child {
  border-right: 0;
}


.unit-tab.is-active {
  background: #ffffff;

  color: var(--math-primary);

  box-shadow:
    inset 0 -3px 0
    var(--math-primary);
}


.unit-workspace {
  display: grid;

  grid-template-columns:
    minmax(0, 1.3fr)
    minmax(320px, 0.8fr);
}


.unit-input-panel {
  min-width: 0;

  padding: 25px 28px;

  border-right: 1px solid var(--math-line);
}


.unit-input-panel h2 {
  margin: 0 0 18px;

  font-size: 16px;
}


.unit-field {
  display: grid;

  grid-template-columns:
    90px minmax(0, 1fr);

  align-items: center;

  gap: 12px;

  margin-bottom: 18px;
}


.unit-field label,
.unit-select-block label {
  color: var(--math-text-soft);

  font-size: 12px;
  font-weight: 800;
}


.unit-field input {
  width: 100%;
  height: 50px;

  padding: 0 13px;

  background: #ffffff;

  border: 1px solid var(--math-line);
  border-radius: 9px;

  color: var(--math-text);

  font-size: 18px;
  font-weight: 700;

  outline: none;
}


.unit-field input:focus,
.unit-select-block select:focus {
  border-color: var(--math-primary);

  box-shadow:
    0 0 0 3px
    rgba(47, 111, 237, 0.1);
}


.unit-conversion-row {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    48px
    minmax(0, 1fr);

  align-items: end;

  gap: 10px;
}


.unit-select-block {
  min-width: 0;
}


.unit-select-block label {
  display: block;

  margin-bottom: 7px;
}


.unit-select-block select {
  width: 100%;
  height: 48px;

  padding: 0 10px;

  background: #ffffff;

  border: 1px solid var(--math-line);
  border-radius: 9px;

  color: var(--math-text);

  font-size: 14px;
  font-weight: 700;

  outline: none;

  cursor: pointer;
}


.unit-swap {
  width: 48px;
  height: 48px;

  background: #eef3ff;

  border: 1px solid #ccd9f5;
  border-radius: 9px;

  color: var(--math-primary);

  font-size: 20px;
  font-weight: 900;

  cursor: pointer;
}


.unit-swap:hover {
  background: var(--math-primary-soft);
}


.unit-actions {
  display: flex;
  justify-content: center;

  gap: 8px;

  margin-top: 22px;
}


.unit-actions button {
  min-height: 44px;

  border: 0;
  border-radius: 9px;

  font-weight: 800;

  cursor: pointer;
}


.unit-calculate {
  min-width: 155px;

  background: var(--math-primary);

  color: #ffffff;
}


.unit-clear {
  min-width: 76px;

  background: #eef1f6;

  color: #566176;
}


.unit-error {
  margin: 14px 0 0;

  color: #c0392b;

  text-align: center;

  font-size: 12px;
  font-weight: 700;
}


.unit-result-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-height: 250px;

  padding: 24px;

  background: #f8faff;

  text-align: center;
}


.unit-result-label {
  margin-bottom: 8px;

  color: var(--math-text-soft);

  font-size: 12px;
  font-weight: 800;
}


.unit-result {
  color: var(--math-primary);

  font-size: 38px;
  font-weight: 900;

  word-break: break-word;
}


.unit-sub-result {
  margin-top: 10px;

  color: var(--math-text-soft);

  font-size: 13px;
  line-height: 1.6;
}


.unit-steps {
  padding: 22px 28px 27px;

  border-top: 1px solid var(--math-line);
}


.unit-steps-head h2 {
  margin: 0 0 12px;

  font-size: 16px;
}


.unit-steps-list {
  display: grid;

  gap: 7px;
}


.unit-step {
  display: flex;

  gap: 12px;

  padding: 10px 12px;

  background: #f7f9fc;

  border-radius: 9px;
}


.unit-step-number {
  flex: 0 0 auto;

  width: 24px;
  height: 24px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--math-primary-soft);

  border-radius: 50%;

  color: var(--math-primary);

  font-size: 11px;
  font-weight: 900;
}


.unit-step-text {
  color: #43506a;

  font-size: 13px;
  line-height: 1.7;
}


.unit-info-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 10px;

  margin-top: 20px;
}


.unit-info-card {
  padding: 18px;

  background: #ffffff;

  border: 1px solid var(--math-line);
  border-radius: 13px;
}


.unit-info-card h2 {
  margin: 0 0 8px;

  font-size: 15px;
}


.unit-info-card p {
  margin: 0;

  color: var(--math-text-soft);

  font-size: 12px;
  line-height: 1.7;
}


@media (max-width: 760px) {

  .unit-workspace {
    grid-template-columns: 1fr;
  }


  .unit-input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--math-line);
  }


  .unit-result-panel {
    min-height: 170px;
  }

}


@media (max-width: 520px) {

  .unit-tool-head {
    padding: 20px 18px;
  }


  .unit-tool-head h1 {
    font-size: 26px;
  }


  .unit-grade {
    display: none;
  }


  .unit-tabs {
    grid-template-columns:
      repeat(5, minmax(68px, 1fr));

    overflow-x: auto;
  }


  .unit-tab {
    white-space: nowrap;
  }


  .unit-input-panel {
    padding: 20px 14px;
  }


  .unit-field {
    grid-template-columns: 1fr;

    gap: 6px;
  }


  .unit-conversion-row {
    grid-template-columns:
      minmax(0, 1fr)
      42px
      minmax(0, 1fr);

    gap: 7px;
  }


  .unit-swap {
    width: 42px;
    height: 48px;
  }


  .unit-select-block select {
    font-size: 12px;
  }


  .unit-result {
    font-size: 31px;
  }


  .unit-info-grid {
    grid-template-columns: 1fr;
  }

}
