.calendar-workflow-email-test {
  display: grid;
  gap: 0.55rem;
}

.calendar-workflow-email-test-actions,
.calendar-workflow-email-test-send {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.calendar-workflow-email-test-actions button,
.calendar-workflow-email-test-send button,
.calendar-workflow-email-preview-actions button {
  appearance: none;
  border: 1px solid var(--line, rgba(15, 23, 42, 0.14));
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-strong, #fff) 94%, var(--brand, #2563eb) 6%);
  color: var(--ink, #0f172a);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 34px;
  padding: 0.35rem 0.78rem;
}

.calendar-workflow-email-test-actions button:hover,
.calendar-workflow-email-test-actions button:focus-visible,
.calendar-workflow-email-test-send button:hover,
.calendar-workflow-email-test-send button:focus-visible,
.calendar-workflow-email-preview-actions button:hover,
.calendar-workflow-email-preview-actions button:focus-visible,
.calendar-workflow-email-preview-actions button.is-active {
  border-color: color-mix(in srgb, var(--brand, #2563eb) 54%, transparent);
  background: color-mix(in srgb, var(--card-strong, #fff) 84%, var(--brand, #2563eb) 16%);
  outline: none;
}

.calendar-workflow-email-test-send input {
  flex: 1 1 280px;
  min-width: 0;
}

.calendar-workflow-email-test-status {
  margin: 0;
  min-height: 1.15rem;
  color: var(--muted, #64748b);
  font-size: 0.82rem;
}

.calendar-workflow-email-test-status[data-tone="success"] {
  color: #166534;
}

.calendar-workflow-email-test-status[data-tone="warning"] {
  color: #a16207;
}

.calendar-workflow-email-test-status[data-tone="error"] {
  color: #b91c1c;
}

.calendar-workflow-email-preview-open {
  overflow: hidden;
}

.calendar-workflow-email-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.calendar-workflow-email-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
}

.calendar-workflow-email-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(96vw, 980px);
  height: min(92vh, 980px);
  margin: 4vh auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 10px;
  background: var(--card-strong, #fff);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.calendar-workflow-email-preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--line, rgba(15, 23, 42, 0.14));
  padding: 0.7rem 0.85rem;
}

.calendar-workflow-email-preview-head strong,
.calendar-workflow-email-preview-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-workflow-email-preview-head span {
  color: var(--muted, #64748b);
  font-size: 0.82rem;
}

.calendar-workflow-email-preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.42rem;
}

.calendar-workflow-email-preview-viewport {
  min-height: 0;
  overflow: auto;
  background: #e2e8f0;
  padding: 18px;
}

.calendar-workflow-email-preview-viewport iframe {
  display: block;
  width: min(100%, 760px);
  height: 100%;
  min-height: 640px;
  margin: 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 36px rgba(15, 23, 42, 0.14);
}

.calendar-workflow-email-preview-modal[data-preview-device="mobile"] .calendar-workflow-email-preview-viewport iframe {
  width: min(100%, 390px);
}

body.theme-dark .calendar-workflow-email-test-actions button,
body.theme-dark .calendar-workflow-email-test-send button,
body.theme-dark .calendar-workflow-email-preview-actions button,
body.theme-dark .calendar-workflow-email-preview-dialog {
  border-color: rgba(148, 163, 184, 0.3);
  color: rgba(241, 245, 249, 0.94);
  background: rgba(15, 23, 42, 0.96);
}

body.theme-dark .calendar-workflow-email-preview-viewport {
  background: rgba(2, 6, 23, 0.9);
}

@media (max-width: 680px) {
  .calendar-workflow-email-preview-dialog {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .calendar-workflow-email-preview-head {
    grid-template-columns: 1fr;
  }

  .calendar-workflow-email-preview-actions {
    justify-content: flex-start;
  }
}
