.wa-template-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.85fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
}
.wa-template-editor .wa-template-fields {
  min-width: 0;
}
.wa-template-editor h3 {
  margin: 0;
  font-size: 14px;
}
.wa-template-editor .wa-template-variable-tools {
  display: flex;
  gap: 10px;
  align-items: end;
}
.wa-template-editor .wa-template-variable-tools > label {
  flex: 1;
  min-width: 0;
}
.wa-template-editor .wa-template-variable-tools > button {
  flex: none;
}
.wa-template-editor .wa-template-buttons {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.wa-template-editor .wa-template-buttons > .row > div {
  flex: 1;
  min-width: 0;
}
.wa-template-editor .wa-template-button {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.wa-template-editor .wa-template-button legend {
  padding: 0 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.wa-template-editor .wa-template-button-order {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.wa-template-editor .wa-template-button-order button {
  min-height: 30px;
  padding: 5px 7px;
}
.wa-template-editor .wa-template-button-order svg {
  width: 14px;
  height: 14px;
}
.wa-template-editor [data-wa-button-action='up'] svg {
  transform: rotate(-90deg);
}
.wa-template-editor [data-wa-button-action='down'] svg {
  transform: rotate(90deg);
}
.wa-template-editor .wa-template-preview {
  position: sticky;
  top: 76px;
  display: grid;
  justify-items: center;
  gap: 15px;
  min-width: 0;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.wa-template-editor .wa-template-preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
}
.wa-template-editor .wa-template-preview > .help {
  max-width: 37ch;
  margin: 0;
  text-align: center;
  line-height: 1.5;
}
.wa-template-editor .wa-template-preview-destinations {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.wa-template-editor .wa-template-preview-destinations:empty {
  display: none;
}
.wa-template-editor .wa-template-preview-destinations .help {
  margin: 0 0 6px;
}
.wa-template-editor .wa-iphone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(280px, 100%);
  height: 550px;
  overflow: hidden;
  border: 7px solid #242329;
  border-radius: 38px;
  background: #f6f6f6;
  color: #202b2b;
  box-shadow: 0 14px 26px #11131c24;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.wa-template-editor .wa-iphone-island {
  position: absolute;
  z-index: 1;
  top: 9px;
  left: 50%;
  width: 76px;
  height: 21px;
  border-radius: 16px;
  background: #16151a;
  transform: translateX(-50%);
}
.wa-template-editor .wa-iphone-system {
  display: flex;
  flex: none;
  justify-content: space-between;
  align-items: center;
  height: 45px;
  padding: 6px 16px 0;
  font-size: 11px;
  font-weight: 650;
}
.wa-template-editor .wa-iphone-system svg {
  width: 47px;
  height: 14px;
}
.wa-template-editor .wa-iphone-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 8px 10px;
  border-bottom: 1px solid #d6ded9;
  background: #f6f8f7;
  color: #135e50;
}
.wa-template-editor .wa-iphone-header > span:first-child svg {
  transform: rotate(180deg);
}
.wa-template-editor .wa-iphone-header svg {
  width: 16px;
  height: 16px;
}
.wa-template-editor .wa-iphone-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d4ddd7;
  border-radius: 50%;
  background: #e4ece6;
}
.wa-template-editor .wa-iphone-header > div {
  flex: 1;
  min-width: 0;
}
.wa-template-editor .wa-iphone-header strong,
.wa-template-editor .wa-iphone-header small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-template-editor .wa-iphone-header strong {
  color: #202b2b;
  font-size: 12px;
}
.wa-template-editor .wa-iphone-header small {
  margin-top: 3px;
  color: #53635c;
  font-size: 9px;
}
.wa-template-editor .wa-iphone-chat {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 11px 22px;
  background-color: #ebe6de;
  background-image: radial-gradient(#c4bbaa50 0.7px, transparent 0.7px);
  background-size: 13px 13px;
  scrollbar-width: thin;
  scrollbar-color: #ada99e transparent;
}
.wa-template-editor .wa-iphone-day {
  width: max-content;
  margin: 0 auto 16px;
  padding: 5px 8px;
  border-radius: 5px;
  background: #f7f7f1;
  color: #4f5953;
  font-size: 9px;
}
.wa-template-editor .wa-iphone-bubble {
  max-width: 100%;
  padding: 9px 0 0;
  overflow: hidden;
  border: 1px solid #dddcd5;
  border-radius: 0 9px 9px 9px;
  background: #fff;
  box-shadow: 0 2px 3px #2423290b;
}
.wa-template-editor [data-wa-preview-body] {
  margin: 0;
  padding: 0 10px;
  color: #202b2b;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}
.wa-template-editor .wa-iphone-message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 7px;
  color: #68756c;
  font-size: 9px;
}
.wa-template-editor .wa-iphone-message-meta svg {
  width: 13px;
  height: 13px;
  color: #3995c7;
}
.wa-template-editor .wa-iphone-action {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px;
  border-top: 1px solid #e8e8e8;
  color: #176d9a;
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 12px;
  line-height: 1.3;
}
.wa-template-editor .wa-iphone-action svg {
  width: 14px;
  height: 14px;
}
.wa-template-editor .wa-iphone-compose {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 6px 12px;
  background: #f6f8f7;
  color: #336754;
  font-size: 20px;
}
.wa-template-editor .wa-iphone-compose-field {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #d9dfda;
  border-radius: 18px;
  background: #fff;
  color: #68756c;
  font-size: 11px;
}
.wa-template-editor .wa-iphone-compose svg {
  width: 17px;
  height: 17px;
}
.wa-template-editor .wa-iphone-home {
  flex: none;
  width: 90px;
  height: 4px;
  margin: 7px auto;
  border-radius: 4px;
  background: #242329;
}
@media (max-width: 820px) {
  .wa-template-editor {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 0.8fr);
    gap: 14px;
  }
  .wa-template-editor .wa-template-preview {
    padding: 14px 8px;
  }
  .wa-template-editor .wa-iphone {
    height: 510px;
  }
}
@media (max-width: 640px) {
  .wa-template-editor {
    grid-template-columns: minmax(0, 1fr);
  }
  .wa-template-editor .wa-template-preview {
    position: static;
  }
  .wa-template-editor .wa-template-variable-tools {
    flex-wrap: wrap;
  }
  .wa-template-editor .wa-template-variable-tools > button {
    flex: 1 0 100%;
  }
  .wa-template-editor .wa-iphone {
    height: 530px;
  }
}
.wa-template-library .template-library-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.wa-template-library .template-library-row > .row {
  max-width: none;
  align-self: start;
}
@media (max-height: 800px) {
  .wa-template-editor .wa-template-preview {
    position: static;
  }
}
