.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 {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: .5rem;
}

.msgd-token-menu {
  position: relative;
  min-width: 0;
}

.msgd-token-menu > summary {
  list-style: none;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 999px;
  padding: .38rem .72rem;
  font-size: .78rem;
  line-height: 1.1;
  cursor: pointer;
  transition: all .12s ease;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  user-select: none;
}

.msgd-token-menu > summary::-webkit-details-marker {
  display: none;
}

.msgd-token-menu[open] > summary,
.msgd-token-menu > summary:hover {
  border-color: #60a5fa;
  background: #eff6ff;
  color: #1d4ed8;
}

.msgd-token-menu__panel {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  z-index: 20;
  min-width: 260px;
  max-width: min(340px, 90vw);
  border: 1px solid #dbe4f0;
  border-radius: .95rem;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
  padding: .45rem;
  display: grid;
  gap: .25rem;
}

.msgd-token-menu__label {
  padding: .35rem .55rem .15rem;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
}

.msgd-token-option {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: .7rem;
  padding: .52rem .62rem;
  text-align: left;
  display: grid;
  gap: .1rem;
}

.msgd-token-option:hover {
  background: #f8fafc;
}

.msgd-token-option strong {
  font-size: .85rem;
  color: #0f172a;
}

.msgd-token-option span {
  font-size: .74rem;
  color: #64748b;
}

.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: #f6f4f0;
  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__details-title {
  padding: 0 .35rem .6rem;
  color: #26332d;
  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 img {
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto .25rem;
}

.msgd-email__detail + .msgd-email__detail {
  border-left: 1px solid rgba(38, 51, 45, .18);
}

.msgd-email__detail span {
  color: #526059;
  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;
  }
}

@media (max-width: 560px) {
  .msgd-token-menu,
  .msgd-token-menu > summary {
    width: 100%;
  }

  .msgd-token-menu > summary {
    justify-content: center;
    min-height: 44px;
  }

  .msgd-token-menu__panel {
    left: 0;
    right: 0;
    min-width: 0;
    max-width: calc(100vw - 2rem);
  }
}
