.service-agreement-launch {
  margin-top: 12px;
}

.service-agreement-dialog {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--border-medium);
  background: var(--surface);
  color: var(--text-main);
}

.service-agreement-dialog::backdrop {
  background: rgb(0 0 0 / 65%);
}

.agreement-dialog-shell {
  padding: 24px;
  overflow: auto;
  max-height: calc(100vh - 24px);
}

.agreement-dialog-shell > header,
.agreement-actions,
.agreement-boundary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.agreement-dialog-shell > header {
  justify-content: space-between;
  position: sticky;
  top: -24px;
  z-index: 2;
  padding: 18px 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-medium);
}

.agreement-dialog-shell h2,
.agreement-dialog-shell h3 {
  margin-top: 0;
}

.agreement-boundary {
  flex-direction: column;
  margin: 18px 0;
  padding: 14px;
  border-left: 4px solid var(--warning);
  background: var(--surface-soft);
}

.agreement-revision {
  display: flex;
  gap: 8px;
  align-items: center;
}

.agreement-summary dl,
.agreement-form {
  display: grid;
  gap: 12px;
}

.agreement-summary dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agreement-summary dl > div {
  padding: 12px;
  border: 1px solid var(--border-medium);
  background: var(--surface-soft);
}

.agreement-summary dt {
  font-weight: 700;
}

.agreement-summary dd {
  margin: 4px 0 0;
}

.agreement-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.agreement-form textarea {
  min-height: 82px;
  resize: vertical;
}

.agreement-form :read-only {
  opacity: 1;
  color: var(--text-main);
}

.field-help,
.optional-label,
.agreement-history li span,
.agreement-waiting {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.agreement-history {
  margin: 18px 0;
}

.agreement-history li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
}

.agreement-actions {
  position: sticky;
  bottom: -24px;
  flex-wrap: wrap;
  padding: 14px 0 18px;
  background: var(--surface);
  border-top: 1px solid var(--border-medium);
}

.agreement-active {
  font-weight: 700;
  color: var(--success);
}

@media (max-width: 680px) {
  .agreement-dialog-shell {
    padding: 16px;
  }

  .agreement-dialog-shell > header {
    top: -16px;
  }

  .agreement-summary dl {
    grid-template-columns: 1fr;
  }

  .agreement-actions {
    bottom: -16px;
  }
}
