.drawer-body:has(> .deal-details) {
  padding-block: 0;
}

.drawer-body:has(> .deal-edit) {
  background: var(--canvas);
}

.deal-details {
  gap: 20px;
  padding-block: 23px;
}

.deal-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.75fr);
  gap: 18px 24px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--panel-shadow, 0 2px 8px #22223808);
}

.deal-summary-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

.deal-summary-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.deal-summary-date svg {
  color: var(--pine);
}

.deal-summary-party {
  align-self: center;
}

.deal-summary-label,
.deal-summary-terms dt {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.deal-summary-name {
  color: var(--ink);
  font-size: clamp(21px, 2.5vw, 29px);
  font-weight: 670;
  line-height: 1.16;
  overflow-wrap: anywhere;
  margin-top: 4px;
}

.deal-summary-subject {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.deal-summary-terms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 12px 16px;
  margin: 0;
  padding: 13px 16px;
  border: 1px solid #ebe9fa;
  border-radius: var(--radius);
  background: #f8f7ff;
}

.deal-summary-terms > :first-child {
  grid-column: 1 / -1;
}

.deal-summary-terms dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.deal-summary-terms > :first-child dd {
  color: var(--pine);
  font-size: clamp(22px, 2.8vw, 31px);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.deal-jumps {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.deal-jump {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 630;
}

.deal-jump > svg {
  color: var(--pine);
}

.deal-jump:hover,
.deal-jump:focus-visible {
  background: var(--wash);
}

.deal-details > .deal-section[tabindex] {
  scroll-margin-top: 62px;
}

.deal-details > .fee-section {
  border-radius: var(--panel-radius);
}

.deal-details .schedule-table th:last-child,
.deal-details .schedule-table td:last-child {
  font-variant-numeric: tabular-nums;
}

.deal-details .schedule-table tbody td:nth-child(2) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.deal-edit {
  align-items: start;
  gap: 16px;
}

.deal-edit-errors {
  grid-column: 1 / -1;
}

.deal-edit-fields,
.deal-edit-preview {
  display: grid;
  min-width: 0;
  gap: 14px;
}

.deal-edit-fields > .deal-section,
.deal-edit-preview {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--paper);
  box-shadow: var(--panel-shadow, 0 2px 8px #22223808);
}

.deal-edit-fields > .deal-section + .deal-section {
  padding-top: 16px;
}

.deal-section-heading {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  line-height: 1.3;
}

.deal-section-icon {
  display: grid;
  flex: 0 0 32px;
  place-items: center;
  height: 32px;
  border-radius: var(--radius);
  background: var(--wash);
  color: var(--pine);
}

.deal-edit-preview {
  background: #fcfbff;
}

.deal-edit-preview > .btn {
  justify-self: start;
  border-radius: 999px;
}

.deal-edit-preview .details > div {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.deal-edit-preview .details dd {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.deal-edit-preview .schedule-table {
  max-height: min(28vh, 260px);
  background: var(--paper);
}

.deal-preview-placeholder {
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (min-width: 860px) {
  .deal-edit {
    grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.75fr);
  }
}

@media (min-width: 860px) and (min-height: 700px) {
  .deal-edit-preview {
    position: sticky;
    top: 0;
  }
}

@media (max-width: 560px) {
  .deal-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .deal-summary-terms {
    padding: 12px;
  }

  .deal-jumps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deal-jumps:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .deal-jumps:has(> :nth-child(5)) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .deal-jumps:has(> :nth-child(5)) > .deal-jump {
    grid-column: span 2;
  }

  .deal-jumps:has(> :nth-child(5)) > .deal-jump:nth-child(n + 4) {
    grid-column: span 3;
  }

  .deal-jump {
    min-height: 42px;
    padding-inline: 5px;
    font-size: 12px;
  }

  .deal-jump > svg {
    display: none;
  }

  .deal-edit-fields > .deal-section,
  .deal-edit-preview {
    padding: 13px;
  }

  .deal-edit-fields > .deal-section + .deal-section {
    padding-top: 13px;
  }

  .deal-details > .deal-section[tabindex] {
    scroll-margin-top: 66px;
  }

  .deal-jumps:has(> :nth-child(4)) ~ .deal-section[tabindex] {
    scroll-margin-top: 110px;
  }
}
