.newsletter-module {
  --newsletter-accent: var(--green);
}

.newsletter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 20px;
}

.newsletter-toolbar > div:first-child {
  max-width: 760px;
}

.newsletter-toolbar h1 {
  margin-bottom: 8px;
}

.newsletter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.newsletter-template-panel {
  display: grid;
  gap: 8px;
  margin: 18px 0 12px;
  padding: 16px;
  background: rgba(255, 255, 255, .85);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.newsletter-template-panel > strong {
  color: var(--ink-strong);
}

.newsletter-template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.newsletter-template-buttons button {
  border: 1px solid var(--line);
}

.newsletter-prototype-note {
  margin: 12px 0 16px;
  padding: 12px 14px;
  color: #725016;
  background: #fff5df;
  border: 1px solid #eed7a5;
  border-radius: 10px;
  font-size: .88rem;
  line-height: 1.5;
}

.newsletter-editor-host {
  min-height: 720px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.newsletter-editor-host .gjs-one-bg {
  background-color: var(--green-950);
}

.newsletter-editor-host .gjs-two-color {
  color: #eaf3ee;
}

.newsletter-editor-host .gjs-three-bg {
  background-color: var(--green-600);
}

.newsletter-editor-host .gjs-four-color,
.newsletter-editor-host .gjs-four-color-h:hover {
  color: #dff1e8;
}

.newsletter-preview-dialog {
  width: min(980px, 95%);
  max-width: 980px;
  padding: 0;
  overflow: hidden;
}

.newsletter-preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.newsletter-preview-frame {
  width: 100%;
  height: min(76vh, 820px);
  display: block;
  border: 0;
  background: #fff;
}

@media (max-width: 760px) {
  .newsletter-toolbar {
    flex-direction: column;
  }

  .newsletter-actions {
    width: 100%;
  }

  .newsletter-actions button {
    width: 100%;
  }

  .newsletter-editor-host {
    min-height: 620px;
  }
}


.newsletter-persistence-layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.newsletter-persistence-side {
  display: grid;
  gap: 12px;
}

.newsletter-persistence-main {
  min-width: 0;
}

.newsletter-details,
.newsletter-drafts-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.newsletter-field {
  display: grid;
  gap: 6px;
  margin: 0;
}

.newsletter-field-label {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 760;
}

.newsletter-save-state {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .8rem;
}

.newsletter-save-state.is-dirty {
  color: var(--amber-ink);
  font-weight: 700;
}

.newsletter-drafts-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.newsletter-small-button {
  padding: 7px 9px;
  border: 1px solid var(--line);
  font-size: .78rem;
}

.newsletter-drafts-list {
  display: grid;
  gap: 7px;
}

.newsletter-draft-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.newsletter-draft-row.is-current {
  border-color: #9ab9a8;
  box-shadow: inset 3px 0 0 var(--green-600);
}

.newsletter-draft-open {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.newsletter-draft-open:hover,
.newsletter-draft-open:focus-visible {
  background: #f5faf7;
}

.newsletter-draft-delete {
  align-self: stretch;
  padding: 8px 10px;
  color: #9b2c2c;
  background: #fff8f7;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  font-size: .72rem;
  font-weight: 800;
}

.newsletter-draft-delete:hover,
.newsletter-draft-delete:focus-visible {
  background: #fff0ed;
}

.newsletter-draft-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.newsletter-draft-copy strong,
.newsletter-draft-copy small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.newsletter-draft-copy small {
  color: var(--muted);
  font-size: .72rem;
}

.newsletter-draft-status {
  flex: 0 0 auto;
  padding: 4px 6px;
  color: #176c50;
  background: #dcf1e6;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 850;
}

@media (max-width: 1050px) {
  .newsletter-persistence-layout {
    grid-template-columns: 1fr;
  }

  .newsletter-persistence-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .newsletter-prototype-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .newsletter-persistence-side {
    grid-template-columns: 1fr;
  }

  /*
   * GrapesJS docks the Style/Block Manager in a wide right-hand panel.
   * On a phone that panel crushes the 600px email canvas. Mobile editing
   * prioritizes the canvas and inline component editing; the desktop/tablet
   * editor retains the full manager.
   */
  .newsletter-editor-host .gjs-pn-views,
  .newsletter-editor-host .gjs-pn-views-container {
    display: none !important;
  }

  .newsletter-editor-host .gjs-cv-canvas {
    width: 100% !important;
    right: 0 !important;
  }

  .newsletter-editor-host .gjs-pn-options {
    right: 0 !important;
  }

  .newsletter-editor-host .gjs-editor-cont,
  .newsletter-editor-host .gjs-cv-canvas,
  .newsletter-editor-host .gjs-frame-wrapper {
    max-width: 100% !important;
  }

  .newsletter-draft-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .newsletter-draft-delete {
    padding-inline: 12px;
  }
}


/* Private HTML imports and guarded delivery controls. */
.newsletter-field select,
.newsletter-field input,
.newsletter-details input[type="text"],
.newsletter-details input[type="file"] {
  width: 100%;
  max-width: 100%;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font: inherit;
}
.newsletter-send-panel {
  border: 1px solid #bfd8c7;
  background: #f5fbf7;
}
.newsletter-send-panel button {
  width: 100%;
}
.newsletter-send-panel .newsletter-danger-button {
  color: #fff;
  background: #9b2c2c;
  border-color: #7a2020;
}
.newsletter-send-panel .newsletter-danger-button:hover,
.newsletter-send-panel .newsletter-danger-button:focus-visible {
  background: #7a2020;
}
.newsletter-send-report {
  overflow-x: auto;
  margin: 4px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.newsletter-module [hidden] {
  display: none !important;
}
