.sf-mail-panel {
  color: #3d3362;
  background: #fff;
  border: 1px solid #e5e1ed;
  border-radius: 16px;
  padding: 26px;
  margin-block: 24px;
  font: inherit;
  --p-color-bg-fill-brand: #3d3362;
  --p-color-bg-fill-brand-hover: #514478;
  --p-color-bg-fill-brand-active: #30264f;
  --p-color-border-brand: #3d3362;
}
.sf-mail-heading,
.sf-mail-editor-heading,
.sf-mail-summary,
.sf-mail-dns-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sf-mail-heading {
  margin-bottom: 22px;
}
.sf-mail-heading h3 {
  font-size: 20px !important;
  margin: 0 !important;
}
.sf-mail-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.sf-mail-choice {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #ded8e9;
  padding: 15px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
.sf-mail-choice:has(:checked) {
  border-color: #7866af;
  background: #f5f2fb;
}
.sf-mail-choice input {
  accent-color: #7866af;
}
.sf-mail-field {
  display: block;
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 500;
}
.sf-mail-field > input {
  margin-top: 9px;
  width: 100%;
  box-sizing: border-box;
}
.sf-mail-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid #d8d3e2;
  border-radius: 8px;
  padding: 10px;
  margin-top: 9px;
  min-height: 48px;
  background: white;
}
.sf-mail-chips > input {
  flex: 1;
  min-width: 160px;
  border: 0 !important;
  outline: none;
  background: transparent;
  height: 28px;
  font: inherit;
}
.sf-mail-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #fff1b8;
  color: #5b4716;
  border: 1px solid #ebd98c;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 13px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sf-mail-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 19px;
  cursor: pointer;
  padding: 0 2px;
}
.sf-mail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin-top: 26px;
  flex-wrap: wrap;
}
.sf-mail-actions small {
  font-size: 12px;
  color: #756c87;
}
.sf-mail-action {
  background: #3d3362 !important;
  color: #fff !important;
  border: 1px solid #3d3362 !important;
  border-radius: 9px !important;
  padding: 9px 14px !important;
  min-width: 0;
  width: auto !important;
  min-height: 38px;
  line-height: 1.2 !important;
  font-size: 13px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.sf-mail-action.sf-mail-secondary {
  background: #eee9f7 !important;
  border-color: #d3c8e8 !important;
  color: #3d3362 !important;
}
.sf-mail-panel button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sf-mail-editor-heading {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
}
.sf-mail-editor-heading button {
  border: 1px solid #d9d2e6;
  background: white;
  color: #655784;
  padding: 6px 13px;
  cursor: pointer;
}
.sf-mail-editor-heading button[aria-pressed="true"] {
  background: #ece6f7;
  color: #3d3362;
}
.sf-mail-editor .ql-toolbar {
  border-radius: 9px 9px 0 0;
  background: #faf9fc;
  border-color: #d8d3e2;
}
.sf-mail-editor .ql-container {
  border-radius: 0 0 9px 9px;
  border-color: #d8d3e2;
  font: inherit;
  min-height: 185px;
}
.sf-mail-editor .ql-editor {
  min-height: 185px;
  font-size: 15px;
  line-height: 1.7;
  color: #302b43;
}
.sf-mail-editor textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid #d8d3e2;
  border-radius: 8px;
  font: 13px/1.6 monospace;
}
.sf-mail-progress {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
}
.sf-mail-progress li {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #80788d;
  font-size: 12px;
}
.sf-mail-progress li span {
  display: grid;
  place-items: center;
  border: 1px solid #dcd6e7;
  border-radius: 50%;
  width: 27px;
  height: 27px;
  flex-shrink: 0;
}
.sf-mail-progress li[aria-current] {
  color: #3d3362;
  font-weight: 600;
}
.sf-mail-progress li[aria-current] span {
  background: #7866af;
  color: #fff;
  border-color: #7866af;
}
.sf-mail-instruction {
  display: flex;
  gap: 7px;
  flex-direction: column;
  padding: 14px 17px;
  background: #f5f2fa;
  border-inline-start: 3px solid #8974bd;
  border-radius: 8px;
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.6;
  color: #655978;
}
.sf-mail-instruction strong {
  color: #3d3362;
  font-size: 13px;
}
.sf-mail-dns {
  border: 1px solid #e2dcea;
  border-radius: 10px;
  padding: 15px;
  margin-top: 16px;
}
.sf-mail-dns-heading {
  font-size: 13px;
  margin-bottom: 14px;
}
.sf-mail-dns-heading small {
  color: #756b83;
  font-size: 11px;
}
.sf-mail-dns-value {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 12px;
  margin: 10px 0;
  align-items: center;
  font-size: 12px;
}
.sf-mail-dns-value code {
  overflow-wrap: anywhere;
  min-width: 0;
  font-size: 12px;
  user-select: all;
  color: #3d3362;
  background: #f5f2fa;
}
.sf-mail-dns-value button {
  border: 1px solid #d7cee7;
  border-radius: 6px;
  padding: 6px 10px;
  background: #eee8f7;
  color: #3d3362;
}
.sf-mail-summary {
  margin-bottom: 22px;
  font-size: 13px;
}
.sf-mail-active {
  font-size: 12px;
  background: #e8f3e3;
  color: #38652a;
  padding: 5px 12px;
  border-radius: 20px;
}
.sf-mail-error {
  color: #9d3619;
  background: #faf9fc;
  padding: 10px 13px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.sf-mail-modal {
  padding: 0;
  border: 0;
  border-radius: 16px;
  width: min(760px, 94vw);
  max-width: 94vw;
  color: #3d3362;
  box-shadow: 0 20px 70px #21182d4d;
}
.sf-mail-modal::backdrop {
  background: #21182d88;
}
.sf-mail-modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid #e9e5f0;
}
.sf-mail-modal-heading button {
  border: 0;
  background: #eee9f7;
  color: #3d3362;
  border-radius: 50%;
  font-size: 25px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}
.sf-mail-preview-subject {
  padding: 15px 24px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.sf-mail-modal iframe {
  display: block;
  width: 100%;
  height: 65vh;
  border: 0;
  background: #f5f5f7;
}
.sf-mail-page-save {
  display: flex;
  justify-content: flex-end;
  padding: 22px 0;
  margin-top: 12px;
  border-top: 1px solid #e5dfed;
}
@media (max-width: 600px) {
  .sf-mail-panel {
    padding: 18px;
  }
  .sf-mail-choices {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .sf-mail-progress {
    gap: 7px;
  }
  .sf-mail-progress li {
    flex-direction: column;
    text-align: center;
    font-size: 11px;
  }
  .sf-mail-actions {
    gap: 14px;
  }
  .sf-mail-dns-value {
    grid-template-columns: 1fr auto;
  }
  .sf-mail-dns-value > span {
    grid-column: 1/-1;
  }
  .sf-mail-modal-heading {
    padding: 16px;
  }
  .sf-mail-modal iframe {
    height: 65vh;
  }
}
.sf-mail-panel .sf-mail-field > input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 9px;
  border: 1px solid #d8d3e2;
  border-radius: 8px;
}
.sf-mail-panel .wp-editor-wrap {
  margin-top: 10px;
}
.sf-mail-panel .wp-editor-container {
  border: 1px solid #d8d3e2;
  border-radius: 8px;
  overflow: hidden;
}
.sf-mail-panel .sf-mail-action {
  height: auto;
  line-height: 1.5;
}
.sf-mail-panel .wp-switch-editor {
  margin-inline-start: 8px;
  background: #eee9f7;
  color: #3d3362;
}

/* Keep navigation on one row; saved progress has its own line. */
.sf-mail-panel .sf-mail-actions { position: relative; flex-wrap: nowrap; gap: 10px; }
.sf-mail-actions > small { position: absolute; inset-block-start: 100%; inset-inline: 0; text-align: center; padding-top: 6px; }
.sf-mail-panel .sf-mail-test-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 600px) {
  .sf-mail-panel .sf-mail-actions > button { padding: 8px 10px !important; font-size: 12px; white-space: nowrap; }
  .sf-mail-panel .sf-mail-actions { margin-top: 20px; gap: 8px; }
}

.sf-mail-panel .sf-mail-summary { display: grid; gap: 14px; }
.sf-mail-panel .sf-mail-summary > button { justify-self: end; }
.sf-mail-panel .sf-mail-summary input:disabled { background: #f2f2f5; color: #65616d; opacity: 1; }
.sf-mail-panel .sf-mail-placeholders { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 12px 0 18px; font-size: 11px; color: #65616d; }
.sf-mail-panel .sf-mail-placeholders > small { flex-basis: 100%; font-size: 11px; }
.sf-mail-panel .sf-mail-placeholders code { color: #6450a3 !important; background: #f5f3fa; font-size: 11px; overflow-wrap: anywhere; }

/* Email chip labels must fill the card, including legacy invoice-settings form styles. */
.sf-mail-panel .sf-mail-field,
.sf-mail-panel .sf-mail-field > label,
.sf-mail-panel .sf-mail-chips {
  display: block;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.sf-mail-panel .sf-mail-chips { display: flex; }
.sf-mail-panel .sf-mail-chips > input { width: auto; max-width: 100%; min-width: min(160px, 100%); }

#sf-invoice-email-sender h3 { font-size: 14px !important; font-weight: 600 !important; line-height: 1.5 !important; font-family: inherit !important; }
