.form-card {
  position: relative;
  padding: 32px;
}

.form-heading {
  display: block;
  min-height: 38px;
  margin: 0 0 22px;
  padding-right: 150px;
}

.form-heading h1 {
  margin: 0;
}

.back-to-journal {
  position: absolute;
  top: 30px;
  right: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  color: #526078;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.back-to-journal span {
  font-size: 19px;
  line-height: 1;
}

.back-to-journal:hover {
  color: #172b4d;
  border-bottom-color: #172b4d;
}

.delete-form {
  position: absolute;
  right: 32px;
  bottom: 32px;
}

.delete-button {
  border-color: #d9a6b5;
  color: #9d2449;
  background: #fff7f9;
}

.delete-button:hover {
  border-color: #b8345d;
  background: #fcecf1;
}

.tab-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  row-gap: 20px;
}

.tab-panel label {
  gap: 5px;
  margin-bottom: 10px;
}

.calculated-field {
  display: grid;
  align-content: start;
  gap: 5px;
  margin-bottom: 10px;
}

.calculated-field span {
  font-weight: 600;
}

.calculated-field strong {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #ded5e7;
  border-radius: 8px;
  background: #f7f2fa;
  color: #542681;
  font-weight: 600;
}

.tab-panel input,
.tab-panel select {
  min-height: 36px;
  height: 36px;
  padding: 6px 10px;
}

.tab-panel textarea {
  padding: 8px 10px;
}

.compact-number-field {
  justify-self: start;
  width: min(220px, 100%);
}

.rework-dates,
.arbitration-section {
  grid-column: 1 / -1;
  padding: 0;
  border: 1px solid #ded5e7;
  border-radius: 9px;
  background: #faf8fb;
}

.rework-dates summary,
.arbitration-section summary {
  padding: 11px 14px;
  color: #542681;
  font-weight: 600;
  cursor: pointer;
}

.rework-dates-grid,
.arbitration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
  padding: 6px 14px 14px;
}

.rework-dates-grid label,
.arbitration-grid label {
  margin: 0;
}

.field-title {
  position: relative;
  display: inline-flex;
  align-items: baseline;
}

.field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 50%;
  color: #fff;
  background: #8657b5;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.field-tooltip {
  position: absolute;
  z-index: 10;
  left: 0;
  bottom: calc(100% + 8px);
  display: none;
  width: max-content;
  max-width: 310px;
  padding: 9px 11px;
  border-radius: 7px;
  color: #fff;
  background: #32134f;
  box-shadow: 0 7px 20px rgba(50, 19, 79, 0.22);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}

.field-title:has(.field-help:hover) .field-tooltip,
.field-title:has(.field-help:focus-visible) .field-tooltip {
  display: block;
}

.required-mark {
  margin-left: 3px;
  color: #a42d58;
  font-weight: 700;
}

.tab-panel input[required],
.tab-panel select[required] {
  border-color: #c8a7d8;
  background: #fffbff;
}

.tab-panel input[required]:focus,
.tab-panel select[required]:focus {
  border-color: #8657b5;
  box-shadow: 0 0 0 3px rgba(134, 87, 181, 0.14);
}

.tab-panel .errorlist {
  margin: 1px 0 0;
  padding: 7px 10px;
  border-radius: 6px;
  color: #94254d;
  background: #fff1f5;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
}

.tabbed-form > .errorlist.nonfield {
  margin: 0 0 16px;
  padding: 12px 15px;
  border-left: 4px solid #b8345d;
  border-radius: 8px;
  color: #7f1f40;
  background: #fff1f5;
  list-style: none;
}

.form-tab.has-errors {
  color: #94254d;
  box-shadow: inset 0 -2px 0 #b8345d;
}

@media (max-width: 800px) {
  .form-card {
    padding: 24px 18px;
  }

  .form-heading {
    padding-right: 120px;
  }

  .back-to-journal {
    top: 22px;
    right: 18px;
  }

  .delete-form {
    right: 18px;
    bottom: 24px;
  }

  .tab-panel {
    grid-template-columns: 1fr;
  }

  .rework-dates-grid,
  .arbitration-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .form-heading {
    padding: 0;
  }

  .back-to-journal {
    position: static;
    margin-top: 10px;
  }

  .delete-form {
    position: static;
    margin-top: 16px;
  }
}
