.msgd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 360px);
  gap: 1rem;
  align-items: start;
  min-width: 0;
}

.msgd-card {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #fff;
  padding: 1rem;
  display: grid;
  gap: 1rem;
  box-shadow: 0 18px 44px rgba(17, 24, 39, .05);
  min-width: 0;
}

.msgd-card--sticky {
  position: sticky;
  top: 1rem;
}

.msgd-editor-shell {
  border: 1px solid #d1d5db;
  border-radius: .7rem;
  background: #fff;
  padding: .5rem;
  display: grid;
  gap: .5rem;
  min-width: 0;
}

.msgd-editor-tools {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: .5rem;
}

.msgd-insert { min-width: 0; width: 100%; }

.msgd-insert__trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .7rem;
  border: 1px solid #cbd5e1;
  border-radius: .55rem;
  background: #f8fafc;
  color: #334155;
  font-size: .82rem;
  cursor: pointer;
}

.msgd-insert__trigger:hover,
.msgd-insert__trigger.is-open {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.msgd-insert__trigger .bi-chevron-down { font-size: .65rem; }

.msgd-insert__panel {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  z-index: 30;
  width: min(620px, 100%);
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: .9rem;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
  color: #0f172a;
}

.msgd-insert__header { display: flex; align-items: center; justify-content: space-between; padding: .35rem .75rem 0; }
.msgd-insert__tabs { display: flex; gap: .5rem; }
.msgd-insert__tabs button {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem .5rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #475569;
  font-size: .84rem;
  cursor: pointer;
}
.msgd-insert__tabs button[aria-selected="true"] { color: #1d4ed8; border-bottom-color: #2563eb; }
.msgd-insert__close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: .5rem; background: transparent; color: #64748b; cursor: pointer; }
.msgd-insert__close:hover { background: #f1f5f9; }
.msgd-insert__search { display: flex; align-items: center; gap: .6rem; margin: .8rem; padding: .55rem .7rem; border: 1px solid #cbd5e1; border-radius: .6rem; color: #64748b; }
.msgd-insert__search:focus-within { border-color: #60a5fa; box-shadow: 0 0 0 3px #eff6ff; }
.msgd-insert__search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: #0f172a; font-size: .84rem; }
.msgd-insert__search input::placeholder { color: #64748b; }
.msgd-insert__content { display: grid; grid-template-columns: 155px minmax(0, 1fr); height: min(310px, 45dvh); border-top: 1px solid #f1f5f9; }
.msgd-insert__content.is-blocks { grid-template-columns: minmax(0, 1fr); }
.msgd-insert__categories { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .5rem; overflow-y: auto; border-right: 1px solid #edf2f7; }
.msgd-insert__eyebrow { margin: .1rem .45rem .4rem; color: #64748b; font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.msgd-insert__categories button { display: flex; align-items: center; gap: .55rem; padding: .6rem .5rem; border: 0; border-radius: .55rem; background: transparent; color: #334155; text-align: left; font-size: .78rem; cursor: pointer; }
.msgd-insert__categories button:hover { background: #f8fafc; }
.msgd-insert__categories button[aria-pressed="true"] { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.msgd-insert__results { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: .8rem .6rem .6rem; }
.msgd-insert__heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: 0 .25rem .6rem; font-size: .8rem; }
.msgd-insert__heading > span { color: #64748b; font-size: .7rem; white-space: nowrap; }
.msgd-insert__list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.msgd-insert__option { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .65rem .5rem; border: 0; border-radius: .55rem; background: transparent; color: #334155; text-align: left; cursor: pointer; }
.msgd-insert__option + .msgd-insert__option { border-top: 1px solid #f1f5f9; }
.msgd-insert__option:hover, .msgd-insert__option:focus-visible { background: #eff6ff; color: #1d4ed8; }
.msgd-insert__option-copy { display: grid; gap: .15rem; flex: 1; min-width: 0; }
.msgd-insert__option-copy strong { color: #0f172a; font-size: .8rem; font-weight: 600; }
.msgd-insert__option-copy > span { overflow: hidden; color: #64748b; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.msgd-insert__plus { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: #eff6ff; color: #2563eb; font-size: .75rem; }
.msgd-insert__option:hover .msgd-insert__plus { background: #2563eb; color: #fff; }
.msgd-insert__empty { display: grid; justify-items: center; gap: .5rem; padding: 2rem .5rem; color: #64748b; text-align: center; font-size: .78rem; }
.msgd-insert__empty > i { font-size: 1.3rem; }
.msgd-insert__footer { display: flex; align-items: center; gap: .5rem; padding: .7rem .85rem; border-top: 1px solid #edf2f7; color: #64748b; font-size: .72rem; }
.msgd-insert button:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }

@media (max-width: 560px) {
  .msgd-insert__content { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: min(360px, 50dvh); }
  .msgd-insert__content.is-blocks { grid-template-rows: minmax(0, 1fr); }
  .msgd-insert__categories { flex-direction: row; overflow-x: auto; padding: .4rem .6rem; border-right: 0; border-bottom: 1px solid #edf2f7; }
  .msgd-insert__eyebrow { display: none; }
  .msgd-insert__categories button { flex-shrink: 0; min-height: 40px; }
  .msgd-insert__option { min-height: 52px; }
  .msgd-insert__tabs button { min-height: 44px; }
}

.msgd-editor {
  min-height: 68px;
  outline: none;
  border: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: .92rem;
  color: #111827;
  overflow-wrap: anywhere;
}

.msgd-editor.is-body {
  min-height: 220px;
}

.msgd-token {
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: .08rem .45rem;
  margin: .04rem .12rem .04rem 0;
  font-size: .75rem;
  line-height: 1.25;
  vertical-align: baseline;
  user-select: none;
}

.msgd-hidden-value {
  display: none !important;
}

.msgd-preview {
  display: grid;
  gap: .45rem;
  min-width: 0;
}

.msgd-preview__label {
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .72rem;
  font-weight: 800;
}

.msgd-preview__subject {
  border: 1px solid #e2e8f0;
  border-radius: .6rem;
  background: #f8fafc;
  padding: .6rem .7rem;
  font-weight: 800;
  color: #111827;
  overflow-wrap: anywhere;
}

.msgd-email-canvas {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: .8rem;
  background: transparent;
  padding: .65rem;
}

.msgd-email {
  overflow: hidden;
  border-top: 4px solid #f3f1eb;
  border-radius: .55rem;
  background: #fff;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .08);
}

.msgd-email__header {
  padding: 1.4rem 1.2rem .8rem;
  text-align: center;
}

.msgd-email__logo {
  display: block;
  width: auto;
  max-width: 150px;
  max-height: 72px;
  margin: 0 auto;
  object-fit: contain;
}

.msgd-email__restaurant {
  overflow-wrap: anywhere;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: .09em;
  line-height: 1.3;
  text-transform: uppercase;
}

.msgd-email__rule {
  width: 40px;
  height: 2px;
  margin: .85rem auto 0;
}

.msgd-email__body {
  padding: .8rem 1.2rem 1.35rem;
  color: #26332d;
  font-size: .84rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.msgd-email__body p {
  margin: 0 0 .8rem;
  white-space: pre-line;
}

.msgd-email__details {
  margin-top: 1.1rem;
  border-radius: .55rem;
  padding: .85rem .65rem .75rem;
}

.msgd-email__button-wrap {
  margin: 1rem 0 1.5rem;
  text-align: center;
}

.msgd-email__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 14px 22px;
  border-radius: 8px;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: default;
}

.msgd-custom-button {
  display: grid;
  gap: .65rem;
  padding: .85rem;
  border-bottom: 1px solid #dce2df;
  background: #f7f8f7;
}

.msgd-custom-button label {
  display: grid;
  gap: .25rem;
  font-size: .85rem;
}

.msgd-email__details-title {
  padding: 0 .35rem .6rem;
  color: inherit;
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.msgd-email__details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.msgd-email__detail {
  display: grid;
  gap: .35rem;
  min-width: 0;
  padding: 0 .4rem;
  text-align: center;
}

.msgd-email__detail .msgd-email__detail-icon {
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto .25rem;
  background-color: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.msgd-email__detail + .msgd-email__detail {
  border-left: 1px solid currentColor;
}

.msgd-email__detail span {
  color: inherit;
  font-size: .56rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.msgd-email__detail strong {
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.3;
}

.msgd-email__detail small {
  font-size: .64rem;
  font-weight: 500;
}

.msgd-back {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  text-decoration: none;
}

@media (max-width: 1100px) {
  .msgd-layout {
    grid-template-columns: 1fr;
  }

  .msgd-card--sticky {
    position: static;
  }
}
.msgd-recommendations { border: 1px solid #e2e8f0; border-radius: .65rem; overflow: hidden; font-size: .8rem; }
.msgd-recommendations h3 { margin: 0; padding: .75rem .85rem; background: #f8fafc; font-size: .85rem; font-weight: 600; }
.msgd-recommendation { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem .85rem; border-top: 1px solid #e2e8f0; }
.msgd-recommendation.is-missing { background: #fffcf5; }
.msgd-recommendation__heading { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; }
.msgd-recommendation__heading strong { font-weight: 600; }
.msgd-recommendation__heading span { color: #a16207; font-size: .7rem; }
.msgd-recommendation.is-present .msgd-recommendation__heading span { color: #367347; }
.msgd-recommendation p { margin: .3rem 0 0; color: #64748b; font: inherit; line-height: 1.5; }
.msgd-recommendation .btn { flex-shrink: 0; font-size: .75rem; }
.msgd-insert__recommended { display: inline-block; margin-left: .5rem; color: #367347; font-size: .65rem; font-weight: 500; }
.msgd-confirm { width: min(560px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 1.4rem; border: 1px solid #e2e8f0; border-radius: .85rem; color: #26332d; box-shadow: 0 18px 60px #0003; }
.msgd-confirm::backdrop { background: #0f172a66; }
.msgd-confirm h2 { margin: 0 0 .75rem; font-size: 1.05rem; }
.msgd-confirm p, .msgd-confirm li { font-family: inherit; font-size: .85rem; line-height: 1.6; }
.msgd-confirm ul { padding-left: 1.1rem; margin: 1rem 0 1.4rem; }
.msgd-confirm li + li { margin-top: .65rem; }
.msgd-confirm__actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; }
@media (max-width: 600px) {
  .msgd-recommendation { align-items: stretch; flex-direction: column; }
  .msgd-recommendation .btn { align-self: flex-start; }
  .msgd-confirm__actions { flex-direction: column; }
}
