/* Settings › Email: Domains (a list beside the selected domain) and the Customer emails section.
   Every selector starts with .ed */

.ed-page {
  display: grid;
  gap: 40px;
}
.ed {
  --ed-amber: #c47f0e;
  display: grid;
  gap: 14px;
}
html[data-theme="dark"] .ed {
  --ed-amber: #e0a23c;
}

/* Section head: title and note, its main action on the right. */
.ed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.ed-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.ed-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--text-md);
}
.ed-head .button {
  flex: none;
}

/* The card: domains on the left, the selected one (or the connect form) on the right. */
.ed-card {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 420px;
  padding: 0;
  overflow: clip;
}
.ed-card.is-empty {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}
.ed-list {
  padding: 10px;
  border-right: 1px solid var(--line);
}
.ed-list ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ed-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink);
  font-size: var(--text-md);
  text-decoration: none;
  transition: background-color 0.15s var(--ease);
}
.ed-item:hover {
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.ed-item[aria-current="true"] {
  background: var(--soft);
}
.ed-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.ed-item-name {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-item.is-add {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--blue);
  font-weight: 500;
}
.ed-item.is-add svg {
  width: 14px;
  height: 14px;
}

/* Status: a dot and a word. Waiting pulses gently. */
.ed-status,
.ed-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.ed-status i,
.ed-state i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.ed-status.is-pending,
.ed-state.is-waiting {
  color: var(--ed-amber);
}
.ed-status.is-pending i,
.ed-state.is-waiting i {
  animation: ed-pulse 1.6s ease-in-out infinite;
}
.ed-status.is-verified,
.ed-state.is-found {
  color: var(--green);
}
.ed-status.is-failed,
.ed-state.is-failed {
  color: var(--danger);
}
@keyframes ed-pulse {
  50% {
    opacity: 0.25;
  }
}

/* The selected domain. */
.ed-pane {
  display: grid;
  align-content: start;
  min-width: 0;
}
.ed-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.ed-detail-head p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--text-md);
}
.ed-detail-head .button {
  flex: none;
}
.ed-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ed-title:focus {
  outline: none;
}
.ed-title:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}
.ed-muted {
  color: var(--muted);
  font-size: var(--text-sm);
}
.ed-alert {
  margin: 16px 22px 0;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  font-size: var(--text-sm);
}

/* A step: numbered until all its records are found, then a green check. */
.ed-step {
  display: grid;
  gap: 10px;
  padding: 18px 22px;
}
.ed-step + .ed-step {
  border-top: 1px solid var(--line);
}
.ed-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.ed-step-head h4 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
}
.ed-step-head > span:last-child:not(.ed-num) {
  color: var(--muted);
  font-size: var(--text-sm);
}
.ed-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.ed-num.is-done {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.ed-num .ed-check {
  width: 13px;
  height: 13px;
}
/* A step that just finished: the circle pops and the check draws itself. */
.ed-num.is-fresh {
  animation: ed-pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.4);
}
.ed-num.is-fresh .ed-check path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: ed-draw 0.35s 0.12s var(--ease) forwards;
}
@keyframes ed-pop {
  from {
    transform: scale(0.6);
  }
}
@keyframes ed-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* A record: type, name and value (each copyable), and whether it's found. */
.ed-records {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ed-record {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1.6fr) 76px;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ed-type {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ed-field {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ed-label {
  color: var(--muted);
  font-size: 11.5px;
}
.ed-value {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.ed-value code,
.ed-addr,
.ed-note code,
.ed-addresses code,
.ed-preview b {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
.ed-addr {
  white-space: nowrap;
}
.ed-value code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed-record .ed-state {
  justify-self: end;
}

/* Copy: a small icon button; copied, the icon turns into a green check. */
.ed-copy {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.ed-copy svg {
  width: 14px;
  height: 14px;
}
.ed-copy:hover {
  background: var(--soft);
  color: var(--ink);
}
.ed-copy:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.ed-copy[data-copied] {
  color: var(--green);
  cursor: default;
}
.ed-copy[data-copied] svg {
  animation: ed-pop 0.28s cubic-bezier(0.2, 0.8, 0.2, 1.4);
}

/* Under the steps: the free-address note and the domain's own actions. */
.ed-foot {
  display: grid;
  gap: 14px;
  padding: 18px 22px 20px;
  border-top: 1px solid var(--line);
}
.ed-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: var(--text-sm);
}
.ed-note code {
  color: var(--ink);
}
.ed-foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.ed-remove.button {
  min-height: 34px;
  padding-inline: 12px;
}

/* Connected: the addresses using it; the records stay behind a disclosure. */
.ed-addresses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ed-addresses li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 2px 2px 10px;
  border-radius: 8px;
  background: var(--soft);
}
.ed-step p.ed-muted {
  margin: 0;
}
.ed-disclosure {
  border-top: 1px solid var(--line);
}
.ed-disclosure summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  color: var(--blue);
  font-size: var(--text-sm);
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.ed-disclosure summary::-webkit-details-marker {
  display: none;
}
.ed-disclosure summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-1px) rotate(-45deg);
  transition: transform 0.2s var(--ease);
}
.ed-disclosure[open] summary::before {
  transform: translateY(-2px) rotate(45deg);
}
.ed-disclosure summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.ed-disclosure:not([open]) .ed-when-open,
.ed-disclosure[open] .ed-when-closed {
  display: none;
}
.ed-disclosure-body {
  border-top: 1px solid var(--line);
}

/* Connect: subdomain + "." + main domain, a live example address, then Connect. */
.ed-connect {
  display: grid;
  gap: 14px;
  max-width: 600px;
  margin: 0;
  padding: 24px 22px 26px;
}
.is-empty .ed-connect {
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 16px;
  max-width: 720px;
  padding: 28px;
}
.is-empty .ed-connect > :not(.ed-icon) {
  grid-column: 2;
}
.ed-icon {
  display: grid;
  place-items: center;
  grid-row: 1;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}
.ed-icon svg {
  width: 20px;
  height: 20px;
}
.ed-connect-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--text-md);
  line-height: 1.5;
}
.ed-inputs {
  display: grid;
  grid-template-columns: minmax(90px, 150px) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}
.ed-inputs .field {
  margin: 0;
}
.ed-prefix input {
  text-align: right;
}
.ed-dot {
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
}
.ed-preview,
.ed-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.ed-preview b {
  color: var(--ink);
  font-weight: 500;
}
.ed-preview b.is-example {
  color: var(--muted);
}
.ed-connect .form-error {
  margin: 0;
}
.ed-actions {
  display: flex;
  gap: 8px;
}

/* Recent emails dialog. */
.ed-log {
  max-height: 60vh;
  overflow: auto;
  margin: 0 -4px;
}
.ed-log table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.ed-log th {
  position: sticky;
  top: 0;
  padding: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}
.ed-log td {
  max-width: 240px;
  padding: 9px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.ed-log tr:is(.is-rejected, .is-failed) td:nth-child(4) {
  color: var(--danger);
}
.ed-log tr:is(.is-ignored, .is-held) td:nth-child(4) {
  color: var(--muted);
}
.ed-dir {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
}
.ed-dir.is-out {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}
#modal:has(.ed-log) {
  width: min(880px, calc(100vw - 32px));
}

@media (max-width: 1180px) {
  .ed-record {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    row-gap: 8px;
  }
  .ed-record .ed-field:nth-of-type(2) {
    grid-column: 2;
  }
  .ed-record .ed-state {
    grid-row: 1;
    grid-column: 3;
  }
}
@media (max-width: 860px) {
  .ed-card {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .ed-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .ed-head,
  .ed-detail-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}
@media (max-width: 560px) {
  .ed-inputs {
    grid-template-columns: minmax(70px, 110px) auto minmax(0, 1fr);
  }
  .is-empty .ed-connect {
    grid-template-columns: minmax(0, 1fr);
    padding: 22px;
  }
  .is-empty .ed-connect > :not(.ed-icon) {
    grid-column: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ed-status i,
  .ed-state i,
  .ed-num.is-fresh,
  .ed-copy[data-copied] svg {
    animation: none;
  }
  .ed-num.is-fresh .ed-check path {
    animation: none;
    stroke-dashoffset: 0;
  }
  .ed-item,
  .ed-copy,
  .ed-disclosure summary::before {
    transition: none;
  }
}
