/* "Use your own domain": a side panel that shows one step at a time under a thin progress bar
   (domain-sheet.js). The strip that opens it lives in channels.css (.ea-*). */
.dsb {
  --dsb-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --dsb-green: var(--green);
  --dsb-amber: #c48200;
  --dsb-amber-ink: #7d5200;
  --dsb-fill: color-mix(in srgb, var(--ink) 6%, transparent);
  --dsb-fill-hover: color-mix(in srgb, var(--ink) 10%, transparent);
}
html[data-theme="dark"] .dsb {
  --dsb-green: #6fcfa5;
  --dsb-amber: #f2b655;
  --dsb-amber-ink: #f2b655;
  --dsb-fill: color-mix(in srgb, var(--ink) 7%, transparent);
  --dsb-fill-hover: color-mix(in srgb, var(--ink) 12%, transparent);
}

/* ---------- Sheet ---------- */
.dsb-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #18243440;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
html[data-theme="dark"] .dsb-scrim {
  background: #00000090;
}
/* Above the page, below toasts (100) and the confirm dialog (top layer). One width for every step. */
.dsb-sheet {
  position: fixed;
  z-index: 81;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(580px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px #1922380f;
  transform: translateX(100%);
  transition: transform 0.42s var(--ease);
  color: var(--ink);
}
html[data-theme="dark"] .dsb-sheet {
  box-shadow: -30px 0 80px #00000080;
}
/* Toasts sit at the top centre of the window, which this panel now reaches: while it's open on a
   wide window they centre over what's left of the page, clear of the progress bar. */
@media (min-width: 1000px) {
  body:has(> .dsb[data-open]) .toasts {
    left: calc(50% - 290px);
  }
}
.dsb[data-open] .dsb-scrim {
  opacity: 1;
}
/* The step is drawn into this; the panel lays out its parts. */
.dsb-view {
  display: contents;
}
.dsb[data-open] .dsb-sheet {
  transform: none;
}
/* A step rises in when it arrives; the same step drawn again (a poll) stays still. */
.dsb[data-open]:not([data-still]) .dsb-body > * {
  animation: dsb-rise 0.5s var(--ease) both;
}
.dsb[data-open]:not([data-still]) .dsb-body > :nth-child(2) {
  animation-delay: 0.06s;
}
.dsb[data-open]:not([data-still]) .dsb-body > :nth-child(n + 3) {
  animation-delay: 0.12s;
}

.dsb-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.dsb-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.dsb-head h2:focus {
  outline: none;
}
.dsb-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  margin: -4px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.dsb-x:hover {
  background: var(--soft);
  color: var(--ink);
}
.dsb-x svg {
  width: 16px;
  height: 16px;
}

/* Progress: three parts, the other steps are only their names. */
.dsb-prog {
  display: grid;
  flex: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 12px 22px 14px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}
.dsb-prog li {
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.dsb-prog i {
  height: 3px;
  border-radius: 3px;
  background: var(--soft);
}
.dsb-prog li[aria-current] {
  font-weight: 500;
  color: var(--ink);
}
.dsb-prog li[aria-current] i {
  background: var(--blue);
}
.dsb-prog li.is-done i {
  background: var(--dsb-green);
}

.dsb-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px 22px 24px;
}
.dsb-body > * {
  flex: none;
}
.dsb-h {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.dsb-body > .dsb-h {
  margin-bottom: 20px;
}

/* Several domains (rare): pills above the step. */
.dsb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -12px 0 22px;
}
.dsb-tabs button {
  max-width: 100%;
  height: 28px;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.dsb-tabs button:hover {
  color: var(--ink);
}
.dsb-tabs button[aria-current="true"] {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  color: var(--ink);
}

/* ---------- Step 1: choose the domain ---------- */
.dsb-form {
  display: grid;
  gap: 14px;
  margin-top: -4px;
}
.dsb-form .dsb-h {
  margin-bottom: 6px;
}
.dsb-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.6fr);
  align-items: end;
  gap: 6px;
}
.dsb-inputs label {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}
.dsb-inputs input {
  width: 100%;
  height: 40px;
  font-size: var(--text-sm);
  font-weight: 400;
}
/* The app's dark field styles win over plain selectors; match their weight. */
html[data-theme="dark"] body:not(.widget-page) .dsb-inputs input {
  background: var(--surface);
}
/* A wrong field stays red while it has the focus, as in the light theme. */
html[data-theme="dark"] body:not(.widget-page) .dsb-inputs input[aria-invalid="true"]:focus {
  border-color: var(--danger);
}
.dsb-dot {
  padding-bottom: 10px;
  font-weight: 600;
  color: var(--muted);
}
.dsb-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 10px;
  background: var(--soft);
  font-family: var(--dsb-mono);
  font-size: var(--text-sm);
  color: var(--muted);
}
.dsb-preview svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.dsb-preview span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.dsb-preview b {
  font-weight: 500;
  color: var(--ink);
}
.dsb-preview b.is-example {
  color: inherit;
}
.dsb-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
.dsb-tipwrap {
  position: relative;
  display: inline-block;
}
.dsb-tiplink {
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 3px;
  cursor: help;
}
/* Why not the root domain. It opens below its words: the panel's scroll area clips anything above.
   Closed, it takes no room at all. */
.dsb-tip {
  display: none;
  position: absolute;
  z-index: 6;
  left: -6px;
  top: calc(100% + 8px);
  gap: 12px;
  width: min(330px, 100vw - 32px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow:
    0 18px 44px #00000038,
    0 2px 6px #0000001a;
  text-align: left;
  cursor: default;
  animation: dsb-tip-in 0.16s var(--ease);
}
html[data-theme="dark"] .dsb-tip {
  background: #1b1d22;
  box-shadow: 0 22px 50px #000000a0;
}
/* Shown by a click (is-open), by hover or by keyboard focus; Escape shuts it (is-shut) until the
   pointer or the focus leaves. */
.dsb-tipwrap.is-open .dsb-tip,
.dsb-tipwrap:not(.is-shut):hover .dsb-tip,
.dsb-tipwrap:not(.is-shut) .dsb-tiplink:focus-visible + .dsb-tip {
  display: grid;
}
/* Hover waits a moment (unseen and out of the pointer's way), so a pointer crossing these words
   on its way to the button doesn't open it over the button. */
.dsb-tipwrap:not(.is-open):hover .dsb-tiplink:not(:focus-visible) + .dsb-tip {
  animation-delay: 0.3s;
  animation-fill-mode: backwards;
}
/* The pointer can cross the gap between the words and the card. */
.dsb-tip::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}
.dsb-tip::after {
  content: "";
  position: absolute;
  left: 24px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: inherit;
  transform: rotate(45deg);
}
.dsb-tip-head {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.dsb-tip-head code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--soft);
  font-family: var(--dsb-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.dsb-tip-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
}
.dsb-tip-row i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.dsb-tip-row i svg {
  width: 15px;
  height: 15px;
}
.dsb-tip-row i.is-blue {
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  color: var(--blue);
}
.dsb-tip-row i.is-green {
  background: color-mix(in srgb, var(--dsb-green) 14%, transparent);
  color: var(--dsb-green);
}
.dsb-tip-row > span {
  display: grid;
  gap: 2px;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.dsb-tip-row b {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
/* The root domain on purpose: what changes for the mail it already gets. */
.dsb-root-warn {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, #d99a12 35%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, #d99a12 9%, transparent);
  color: #8a5a00;
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  animation: dsb-warn-in 0.2s var(--ease);
}
html[data-theme="dark"] .dsb-root-warn {
  color: #e8b44a;
}
.dsb .form-error {
  margin: 0;
}
.dsb-connect {
  justify-self: start;
  margin-top: 4px;
}

/* ---------- The DNS table (step 2, and inside step 3): Type | Name | Value ---------- */
/* Name is as wide as the longest name, Value takes the rest. */
.dsb-table {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  column-gap: 10px;
}
.dsb-thead,
.dsb-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
}
.dsb-thead {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--muted);
}
.dsb-thead > span + span {
  padding-left: 11px;
}
.dsb-row {
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.dsb-row:last-child {
  border-bottom-color: var(--line);
}
.dsb-type {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-right: 2px;
  font-family: var(--dsb-mono);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
}
.dsb-tstack {
  display: grid;
  gap: 4px;
  line-height: 1;
}
.dsb-tstack small {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
}
.dsb-td {
  display: flex;
  min-width: 0;
}
/* A long name still leaves room for the longest host among the values. */
.dsb-row > :nth-child(2) {
  max-width: 198px;
}
/* Found rows step back so the ones still to add stand out. */
.dsb-row.is-found .dsb-type,
.dsb-row.is-found .dsb-cell code {
  color: var(--muted);
}

/* Status marks: a shape each, not only a colour. */
.dsb-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-style: normal;
}
.dsb-mark svg {
  width: 10px;
  height: 10px;
}
.dsb-mark.is-found {
  background: color-mix(in srgb, var(--dsb-green) 18%, transparent);
  color: var(--dsb-green);
}
.dsb-mark.is-waiting {
  color: var(--dsb-amber);
}
.dsb-mark.is-waiting svg {
  width: 16px;
  height: 16px;
  animation: dsb-spin 7s linear infinite;
}
.dsb-mark.is-failed {
  background: var(--danger);
  color: #fff;
}
html[data-theme="dark"] .dsb-mark.is-failed {
  color: #2a0d0b;
}
.dsb-mark.is-big {
  width: 22px;
  height: 22px;
}
.dsb-mark.is-big svg {
  width: 13px;
  height: 13px;
}

/* The copy cell: filled, no border, mono; the whole cell copies what it shows. */
.dsb-cell {
  appearance: none;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 10px 0 11px;
  border: 0;
  border-radius: 9px;
  background: var(--dsb-fill);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}
.dsb-cell:hover {
  background: var(--dsb-fill-hover);
}
.dsb-cell:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.dsb-cell code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--dsb-mono);
  font-size: 11.5px;
  line-height: 36px;
  color: var(--ink);
}
.dsb-cell svg {
  width: 12px;
  height: 12px;
  color: var(--muted);
  opacity: 0.85;
}
.dsb-cell:hover svg {
  color: var(--ink);
  opacity: 1;
}
/* Copied (the cell's content is in .copy-label, and core.js confirmCopied lays .copy-confirm over
   it): the same cell at the same size, green, with a check and the word. */
.dsb-cell > .copy-label {
  display: flex;
  flex: 1;
  min-width: 0;
}
.dsb-cell .copy-confirm {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding-left: 11px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
}
.dsb-cell .copy-confirm::after {
  content: "Copied";
}
.dsb-cell .copy-confirm svg {
  width: 13px;
  height: 13px;
  color: inherit;
  opacity: 1;
}
/* app.css paints copied buttons with an id's weight; :not(#_) matches it. */
.dsb .dsb-cell[data-copied]:not(#_) {
  background: color-mix(in srgb, var(--dsb-green) 13%, transparent);
  color: var(--dsb-green);
  opacity: 1;
  text-align: left;
  cursor: default;
}

/* ---------- Step 2: the message over the table, the count and the check under it ---------- */
/* Something to fix: red. */
.dsb-alert {
  margin: -4px 0 18px;
  padding: 10px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: var(--text-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
/* Nothing to fix, only a wait: the amber of the waiting ring, and a spinner beside the first line. */
.dsb-alert.is-wait {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: color-mix(in srgb, var(--dsb-amber) 12%, transparent);
  color: var(--dsb-amber-ink);
}
.dsb-spin {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: calc((1.45em - 14px) / 2);
  animation: dsb-spin 0.9s linear infinite;
}
.dsb-act {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}
.dsb-act .button {
  flex: none;
}
.dsb-live {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink);
}
/* Remove: quiet, always at the bottom, plainly a link. */
.dsb-end {
  margin-top: auto;
  padding-top: 28px;
}
.dsb-remove {
  appearance: none;
  padding: 3px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: underline dotted color-mix(in srgb, var(--muted) 70%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  transition:
    color 0.15s var(--ease),
    text-decoration-color 0.15s var(--ease);
}
.dsb-remove:hover {
  color: var(--danger);
  text-decoration-color: var(--danger);
}

/* ---------- Step 3: connected ---------- */
.dsb-status {
  display: flex;
  align-items: center;
  gap: 9px;
}
.dsb-when {
  margin-left: 1px;
  padding-top: 3px;
  font-size: var(--text-sm);
  line-height: 19px;
  color: var(--muted);
}
.dsb-label {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.dsb-sec {
  margin-top: 28px;
}
.dsb-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.dsb-list li {
  display: flex;
  min-width: 0;
}
.dsb-empty {
  margin: 12px 0 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--muted);
}
.dsb-empty b {
  font-weight: 500;
  color: var(--ink);
}
/* An address cell: the address leads, the email's name is the small label before the copy mark. */
.dsb-addr code {
  font-size: 12.5px;
  color: var(--muted);
}
.dsb-addr code b {
  font-weight: 500;
  color: var(--ink);
}
/* The address keeps its width; a long name is the one that's cut. */
.dsb-addr code:has(+ small) {
  flex: 0 1 auto;
}
.dsb-addr small {
  flex: 1 1 0;
  min-width: 0;
  margin-right: 4px;
  text-align: right;
  padding: 3px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}
/* DNS records: one row that opens the table in place. */
.dsb-dns {
  margin-top: 15px;
}
.dsb-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1;
  text-align: left;
  cursor: pointer;
}
.dsb-toggle:focus-visible {
  outline-offset: 2px;
  border-radius: 6px;
}
.dsb-toggle-text {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.dsb-toggle-text span {
  color: var(--muted);
}
/* The chevron sits on the same x as the copy marks. */
.dsb-toggle svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  color: var(--muted);
  transition:
    transform 0.25s var(--ease),
    color 0.15s var(--ease);
}
.dsb-toggle:hover svg {
  color: var(--ink);
}
.dsb-dns.is-open .dsb-toggle svg {
  transform: rotate(180deg);
}
.dsb-dns.is-open .dsb-toggle {
  border-bottom-color: transparent;
}
.dsb-dns .dsb-table {
  margin-top: 6px;
}

/* Narrow screens: the panel is the whole width, and the Name column gives way too. */
@media (max-width: 520px) {
  .dsb-table {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.3fr);
    column-gap: 8px;
  }
  .dsb-row > :nth-child(2) {
    max-width: none;
  }
  .dsb-table .dsb-cell {
    gap: 6px;
    padding: 0 8px 0 9px;
  }
  .dsb-table .copy-confirm,
  .dsb-thead > span + span {
    padding-left: 9px;
  }
}

@keyframes dsb-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes dsb-tip-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
  }
}
@keyframes dsb-tip-wait {
  from {
    opacity: 0;
    pointer-events: none;
  }
}
@keyframes dsb-warn-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}
@keyframes dsb-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dsb-sheet,
  .dsb-scrim {
    transition-duration: 0.01s;
  }
  .dsb * {
    animation: none !important;
  }
  /* The tooltip still waits before it opens under the pointer; it just doesn't move. */
  .dsb-tipwrap:not(.is-open):hover .dsb-tiplink:not(:focus-visible) + .dsb-tip {
    animation: dsb-tip-wait 0.01s 0.3s backwards !important;
  }
  .dsb-cell,
  .dsb-toggle svg {
    transition: none;
  }
}
