.templatical-composer {
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.templatical-composer .builder-head {
  position: relative;
  z-index: 4;
}

.templatical-toolbar-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted, #68766d);
  font-size: 12px;
}

.templatical-toolbar-note::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #1e684e;
  box-shadow: 0 0 0 3px rgba(30, 104, 78, .12);
}

/* Always-visible recipient browser-view toggle. */
.templatical-composer .builder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 20px;
  row-gap: 12px;
}
.builder-toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  min-width: 0;
}
.browser-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 6px 10px 6px 13px;
  border: 1px solid #cddbd1;
  border-radius: 12px;
  background: #fffefa;
  color: #1d4f3c;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.browser-view-insert {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #9fb9a8;
  border-radius: 12px;
  background: #fffefa;
  color: #1e6049;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.browser-view-insert:hover { background: #eaf5ee; border-color: #1e6049; }
.browser-view-insert:focus-visible { outline: 3px solid #91bda8; outline-offset: 2px; }
@media (max-width: 620px) {
  .builder-toolbar-controls { gap: 8px; }
  .browser-view-toggle { flex: 0 0 auto; }
  .browser-view-insert { flex: 1 1 auto; }
}

.browser-view-toggle:hover { background: #f1f7f2; border-color: #92b29d; }
.browser-view-toggle:focus-visible { outline: 3px solid #91bda8; outline-offset: 2px; }
.browser-view-toggle-text { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.browser-view-toggle-text small { font-size: 11px; font-weight: 600; color: #68766d; }
.browser-view-toggle-track {
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 22px;
  padding: 3px;
  border-radius: 999px;
  background: #c7cec8;
  transition: background .15s ease;
}
.browser-view-toggle-thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.17);
  transition: transform .15s ease;
}
.browser-view-toggle[aria-checked="true"] { background: #eaf5ee; border-color: #8cbaa1; }
.browser-view-toggle[aria-checked="true"] .browser-view-toggle-track { background: #1e6049; }
.browser-view-toggle[aria-checked="true"] .browser-view-toggle-thumb { transform: translateX(16px); }
@media (max-width: 760px) {
  .templatical-composer .builder-toolbar { align-items: flex-start; }
  .builder-toolbar-controls { width: 100%; justify-content: space-between; }
}
@media (max-width: 480px) {
  .templatical-toolbar-note { display: none; }
  .builder-toolbar-controls { justify-content: flex-start; }
}


.templatical-editor-shell {
  min-height: 0;
  height: auto;
  overflow: hidden;
  border: 1px solid rgba(23, 35, 28, .12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(23, 35, 28, .08);
}

#templatical-editor {
  width: 100%;
  height: 100%;
  min-height: 0;
  --tpl-user-font-family: "DM Sans", system-ui, sans-serif;
}

.templatical-loading,
.templatical-error {
  height: 100%;
  min-height: 520px;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 32px;
  text-align: center;
  color: #68766d;
}

.templatical-error strong { color: #8f2f2f; }

.templatical-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 430px;
  overflow: auto;
}

.templatical-media-card {
  border: 1px solid rgba(23, 35, 28, .12);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.templatical-media-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.templatical-media-card strong,
.templatical-media-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.templatical-preflight-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.templatical-preflight-stats > div {
  padding: 14px;
  border-radius: 12px;
  background: #f6f4ef;
}

.templatical-preflight-stats strong,
.templatical-preflight-stats span { display: block; }

@media (max-width: 900px) {
  .templatical-composer { min-height: calc(100vh - 24px); grid-template-rows: auto auto minmax(560px, 1fr); }
  .templatical-editor-shell { min-height: 560px; height: auto; border-radius: 10px; }
  .templatical-preflight-stats { grid-template-columns: 1fr; }
}


.arrange-sections-list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 620px);
  overflow: auto;
  padding: 4px;
}

.arrange-section-row {
  display: grid;
  grid-template-columns: auto 34px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(23, 35, 28, .14);
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, opacity .15s ease;
}

.arrange-section-row.dragging { opacity: .55; }
.arrange-section-row.drag-over { border-color: #1e684e; background: #f1f8f3; }
.arrange-drag-handle { color: #68766d; cursor: grab; font-size: 18px; letter-spacing: -5px; }
.arrange-section-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #edf4ef;
  color: #1e684e;
  font-weight: 800;
}
.arrange-section-copy { min-width: 0; }
.arrange-section-copy strong,
.arrange-section-copy small { display: block; }
.arrange-section-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: #68766d;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arrange-section-actions { display: flex; align-items: end; gap: 7px; }
.arrange-section-actions label { display: grid; gap: 3px; color: #68766d; font-size: 11px; }
.arrange-section-actions select {
  min-width: 72px;
  height: 34px;
  border: 1px solid rgba(23, 35, 28, .18);
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
}
.arrange-empty { display: grid; gap: 4px; padding: 30px; text-align: center; color: #68766d; }

@media (max-width: 760px) {
  .arrange-section-row { grid-template-columns: auto 30px minmax(0, 1fr); }
  .arrange-section-actions { grid-column: 2 / -1; flex-wrap: wrap; }
}


.dynamic-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.dynamic-choice-card {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 9px;
  font: inherit;
}

.dynamic-choice-card:hover,
.dynamic-choice-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
  outline: none;
}

.dynamic-choice-card > span {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.dynamic-choice-card strong {
  font-size: 15px;
}

.dynamic-choice-card small {
  color: var(--muted);
  line-height: 1.5;
}

.dynamic-section-guide {
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 18px 20px;
}

.dynamic-section-guide ol {
  margin: 12px 0;
  padding-left: 22px;
}

.dynamic-section-guide li,
.dynamic-section-guide p {
  color: var(--muted);
  line-height: 1.55;
}

.variant-creative-note > span:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 900px) {
  .dynamic-choice-grid {
    grid-template-columns: 1fr;
  }
}


/* Focused command bar: campaign context on the left, three clear actions on the right. */
.templatical-composer .builder-head {
  z-index: 60;
  min-height: 76px;
  padding: 13px 15px;
  flex-wrap: nowrap;
  gap: 20px;
}
.templatical-composer .builder-title { flex: 1 1 auto; max-width: none; gap: 12px; }
.templatical-composer .builder-campaign-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
}
.templatical-composer .builder-campaign-copy > small { grid-column: 1 / -1; }
.templatical-composer .builder-campaign-copy > strong { min-width: 0; max-width: min(420px, 38vw); }
.templatical-composer .builder-title-meta { min-width: 0; display: inline-flex; align-items: center; gap: 10px; }
.templatical-composer .builder-title-meta .text-link { flex: 0 0 auto; }
.templatical-composer .builder-save-status {
  min-width: 0;
  max-width: 190px;
  padding: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.templatical-composer .builder-head-actions { flex: 0 0 auto; gap: 8px; }
.templatical-composer .builder-head-actions > .button,
.templatical-composer .builder-command-menu > summary { min-height: 44px; border-radius: 11px; }
.templatical-composer .builder-head-actions > .button { padding-inline: 16px; font-size: 12px; }
.templatical-composer .builder-review-button { min-width: 126px; }
.templatical-composer .builder-command-menu { position: relative; }
.templatical-composer .builder-command-menu > summary {
  min-width: 92px;
  padding: 0 13px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.templatical-composer .builder-command-menu > summary::-webkit-details-marker { display: none; }
.templatical-composer .builder-command-menu > summary:hover { border-color: #9fb2a6; background: #f8faf8; }
.templatical-composer .builder-command-menu[open] > summary {
  border-color: var(--green);
  background: #f1f7f3;
  box-shadow: 0 0 0 3px rgba(30, 96, 73, .09);
}
.builder-command-trigger-icon {
  width: 21px;
  height: 21px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #e7f1eb;
  color: var(--green);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}
.builder-command-chevron { color: var(--muted); font-size: 11px; transition: transform .16s ease; }
.builder-command-menu[open] .builder-command-chevron { transform: rotate(180deg); }
.templatical-composer .builder-head:has(.builder-command-menu[open]) .context-tooltip::before,
.templatical-composer .builder-head:has(.builder-command-menu[open]) .context-tooltip::after { display: none !important; }
.templatical-composer .builder-command-panel {
  z-index: 1000;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 40px));
  max-height: min(430px, calc(100dvh - 120px));
  padding: 10px;
  border: 1px solid rgba(23, 35, 28, .14);
  border-radius: 16px;
  gap: 8px;
  overflow-y: auto;
  background: #fffdfa;
  box-shadow: 0 24px 60px rgba(20, 34, 26, .22);
}
.builder-command-heading {
  min-height: 48px;
  padding: 5px 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.builder-command-heading > span { display: grid; gap: 2px; }
.builder-command-heading strong { color: var(--ink); font-size: 13px; }
.builder-command-heading small { color: var(--muted); font-size: 10px; }
.builder-command-heading kbd {
  margin-top: 2px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f4ee;
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
}
.builder-command-feature,
.builder-command-option {
  min-width: 0;
  border: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.builder-command-feature:hover,
.builder-command-option:hover,
.builder-command-feature:focus-visible,
.builder-command-option:focus-visible { outline: none; background: #edf5f0; }
.builder-command-feature:focus-visible,
.builder-command-option:focus-visible { box-shadow: inset 0 0 0 2px rgba(30, 96, 73, .25); }
.builder-command-feature {
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  background: #f4f0ff;
}
.builder-command-feature:hover,
.builder-command-feature:focus-visible { background: #ece6ff; }
.builder-command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.builder-command-option {
  min-height: 66px;
  padding: 9px 10px;
  border-radius: 11px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  background: transparent;
}
.builder-command-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #eef2ed;
  color: var(--green-dark);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -.02em;
}
.builder-command-feature .builder-command-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #e2d8ff;
  color: #5d43ad;
  font-size: 10px;
}
.builder-command-feature > span:last-child,
.builder-command-option > span:last-child { min-width: 0; display: grid; gap: 2px; }
.builder-command-feature strong,
.builder-command-option strong {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.builder-command-feature small,
.builder-command-option small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.templatical-composer .builder-toolbar,
.templatical-composer .templatical-editor-shell { position: relative; z-index: 1; }
@media (max-width: 1100px) {
  .templatical-composer .builder-head { flex-wrap: wrap; }
  .templatical-composer .builder-title { flex-basis: 100%; }
  .templatical-composer .builder-campaign-copy > strong { max-width: min(560px, 58vw); }
  .templatical-composer .builder-head-actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 620px) {
  .templatical-composer .builder-head-actions { display: grid; grid-template-columns: auto 1fr 1.2fr; }
  .templatical-composer .builder-head-actions > .button { min-width: 0; padding-inline: 10px; white-space: normal; }
  .templatical-composer .builder-command-panel {
    position: fixed;
    inset: auto 10px 10px;
    width: auto;
    max-height: min(70dvh, 520px);
  }
  .builder-command-grid { grid-template-columns: 1fr; }
}

/* Check & test needs room for readable checks, links, and test-send controls. */
.modal.wide.preflight-modal {
  width: min(1120px, calc(100vw - 40px));
  max-width: 1120px;
  max-height: calc(100dvh - 32px);
  padding: 34px 38px;
}

.preflight-modal .modal-head {
  margin-bottom: 28px;
}

.preflight-modal .templatical-preflight-stats {
  gap: 16px;
  margin: 20px 0 28px;
}

.preflight-modal .templatical-preflight-stats > div {
  min-height: 104px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.preflight-modal section + section {
  margin-top: 26px;
}

.preflight-modal .link-inventory {
  max-height: 360px;
}

.preflight-modal .preflight-section-note {
  max-width: 760px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.preflight-modal .link-inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, .44fr);
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
}

.preflight-modal .link-inventory-row > span:first-child {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(150px, .38fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.link-reporting-field {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.link-reporting-field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(23, 35, 28, .18);
  border-radius: 9px;
  background: var(--surface, #fff);
  color: var(--ink, #17231c);
  padding: 0 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.link-reporting-field input:focus {
  outline: 3px solid rgba(30, 104, 78, .14);
  border-color: #1e684e;
}

.link-reporting-system {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.preflight-modal .link-inventory-row strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
}

.preflight-modal .link-inventory-row code {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preflight-modal .test-send-panel {
  margin-top: 30px;
  padding: 24px;
  grid-template-columns: minmax(220px, .6fr) minmax(0, 1.4fr);
  gap: 28px;
}

.preflight-modal .test-send-panel h3 {
  font-size: 19px;
}

.preflight-modal .test-send-panel p {
  font-size: 12px;
}

.preflight-modal .test-send-fields {
  grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) auto;
  gap: 10px;
}

@media (max-width: 1100px) {
  .templatical-composer .builder-head {
    flex-wrap: wrap;
  }

  .templatical-composer .builder-title {
    flex-basis: 100%;
    max-width: none;
  }

  .templatical-composer .builder-head-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .modal.wide.preflight-modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 24px 20px;
  }

  .preflight-modal .link-inventory-row,
  .preflight-modal .link-inventory-row > span:first-child,
  .preflight-modal .test-send-panel,
  .preflight-modal .test-send-fields {
    grid-template-columns: 1fr;
  }

  .link-reporting-system { text-align: left; }

  .preflight-modal .link-inventory-row code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}


/* In-editor templates and focused AI editing. */
.templatical-composer .builder-templates-button {
  min-width: 94px;
  border-color: #b9c8bf;
  background: #f8faf8;
  color: var(--green-dark);
  font-weight: 800;
}
.templatical-composer .builder-templates-button:hover,
.templatical-composer .builder-templates-button:focus-visible {
  border-color: var(--green);
  background: #eef5f0;
}

.modal.wide.builder-templates-modal,
.modal.wide.ai-part-modal {
  width: min(1040px, calc(100vw - 40px));
  max-width: 1040px;
  max-height: calc(100dvh - 32px);
}

.builder-template-grid {
  margin: 22px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  overflow-y: auto;
  max-height: min(560px, calc(100dvh - 260px));
  padding: 3px;
}

.builder-template-card {
  min-height: 158px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.builder-template-card:hover,
.builder-template-card:focus-visible {
  border-color: var(--green);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(23, 35, 28, .1);
}
.builder-template-preview { display: block; position: relative; width: 100%; height: 240px; overflow: hidden; background: #ecefe9; border-bottom: 1px solid var(--line); pointer-events: none; }
.builder-template-preview iframe { display: block; position: absolute; left: 0; top: 0; width: 600px; height: 1600px; border: 0; transform-origin: top left; opacity: 0; pointer-events: none; }
.builder-template-preview.is-ready iframe { opacity: 1; }
.builder-template-preview-status { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 12px; }
.builder-template-preview.is-ready .builder-template-preview-status { display: none; }
.builder-template-copy { display: flex; flex: 1; width: 100%; flex-direction: column; gap: 8px; padding: 16px; }
.builder-template-use { color: var(--green); font-size: 12px; font-weight: 800; margin-top: 8px; }
.builder-template-card strong { font-size: 17px; line-height: 1.25; }
.builder-template-card small { flex: 1; color: var(--muted); line-height: 1.45; }

.builder-template-category {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.template-restore,
.ai-part-promise {
  margin: 18px 0;
  padding: 15px 17px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface-soft);
}
.template-restore > span,
.ai-part-promise { line-height: 1.45; }
.template-restore > span { display: grid; gap: 3px; }
.template-restore small,
.ai-part-promise span { color: var(--muted); font-size: 12px; }
.ai-part-modal .field { margin-top: 18px; }
.ai-part-modal textarea { min-height: 150px; }
.ai-part-promise { align-items: flex-start; justify-content: flex-start; flex-direction: column; gap: 4px; }

@media (max-width: 820px) {
  .builder-template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .templatical-composer .builder-head-actions {
    grid-template-columns: auto auto 1fr 1.2fr;
  }
  .templatical-composer .builder-templates-button { min-width: 0; }
  .builder-template-grid { grid-template-columns: 1fr; }
  .template-restore { align-items: stretch; flex-direction: column; }
  .modal.wide.builder-templates-modal,
  .modal.wide.ai-part-modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 24px 20px;
  }
}



/* Pexels search is part of the media picker, not a second asset workflow. */
.templatical-pexels-panel{margin:24px 0 22px;padding:18px;border:1px solid #d9e5dc;border-radius:16px;background:#f7fbf8}
.templatical-pexels-heading{display:flex;align-items:baseline;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:12px}
.templatical-pexels-heading h3{margin:0;font-size:17px;color:#193d2e}
.templatical-pexels-heading a{font-size:12px;font-weight:700;color:#1c674b}
.templatical-pexels-search{display:flex;gap:8px;align-items:center}
.templatical-pexels-search input{flex:1;min-width:0;min-height:45px;padding:10px 13px;border:1px solid #c6d8cc;border-radius:10px;background:#fff;font:inherit}
.templatical-pexels-search button{min-height:45px}
.templatical-pexels-status{font-size:12px;line-height:1.5;color:#60766a;margin:10px 0}
.templatical-pexels-results{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;max-height:355px;overflow:auto}
.templatical-pexels-card{min-width:0;border:1px solid #e0e8e0;background:#fff;border-radius:12px;overflow:hidden}
.templatical-pexels-card button{display:block;width:100%;padding:0;border:0;background:#fff;text-align:left;cursor:pointer;color:#155b41}
.templatical-pexels-card button img{display:block;width:100%;height:124px;object-fit:cover;background:#e7efe8}
.templatical-pexels-card button span{display:block;padding:8px 10px;font-size:12px;font-weight:800}
.templatical-pexels-card button:hover span,.templatical-pexels-card button:focus-visible span{background:#ddf2e6}
.templatical-pexels-card button:focus-visible{outline:3px solid #2b8261;outline-offset:-3px}
.templatical-pexels-card button:disabled{opacity:.55;cursor:progress}
.templatical-pexels-card small{display:block;padding:0 10px 10px;color:#60766a;font-size:10px;line-height:1.4}
.templatical-pexels-card small a{color:#145e44;text-decoration:underline}
@media(max-width:700px){.templatical-pexels-results{grid-template-columns:repeat(2,minmax(0,1fr))}.templatical-pexels-search{flex-wrap:wrap}.templatical-pexels-search input{flex-basis:100%}.templatical-pexels-search button{width:100%}}
@media(max-width:390px){.templatical-pexels-results{grid-template-columns:1fr}.templatical-pexels-card button img{height:175px}}

/* Make the photo-library action obvious beside Templates. */
.templatical-composer .builder-stock-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:42px;padding:9px 14px;border:1px solid #287954;border-radius:11px;background:#e4f4eb;color:#185c42;font-size:13px;font-weight:750;white-space:nowrap}
.templatical-composer .builder-stock-button:hover,.templatical-composer .builder-stock-button:focus-visible{background:#d3ecdd;border-color:#176044}
@media(max-width:620px){.templatical-composer .builder-stock-button{min-width:0;min-height:44px;padding:8px 9px;font-size:12px;white-space:normal;text-align:center}}

/* Personalize studio: focused rules, clear variants and a live email-safe preview. */
.modal.wide.sp-personalize-modal{width:min(1080px,calc(100vw - 32px));max-width:1080px;max-height:calc(100dvh - 28px);padding:30px 34px;overflow:auto}
.sp-personalize-modal .modal-head{margin-bottom:20px;align-items:flex-start}
.sp-personalize-modal .modal-head h2{font-family:var(--font-display,Newsreader,Georgia,serif);font-size:clamp(25px,2.5vw,34px);line-height:1.12;letter-spacing:-.025em;margin:8px 0}
.sp-personalize-modal .modal-head p{max-width:560px;line-height:1.5}
.sp-personalize-eyebrow{display:inline-block;font-size:10px;font-weight:850;letter-spacing:.12em;color:#246b4a}
.sp-personalize-layout{display:grid;grid-template-columns:minmax(0,1.12fr) minmax(0,.88fr);column-gap:24px;row-gap:20px;align-items:start}
.sp-personalize-fields{display:grid;gap:14px;min-width:0}
.sp-personalize-panel{padding:20px;border:1px solid #dde7df;background:#fff;border-radius:16px;display:grid;gap:12px;min-width:0}
.sp-panel-heading{display:flex;align-items:start;gap:12px;margin-bottom:2px}
.sp-panel-heading h3{font-size:17px;font-weight:800;margin:0;color:#193a2a}
.sp-panel-heading p{font-size:12px;color:#68786c;margin:5px 0 0;line-height:1.4}
.sp-step{flex:none;display:grid;place-items:center;width:29px;height:29px;border-radius:10px;background:#e1f1e6;color:#17563c;font-size:14px;font-weight:800}
.sp-rule-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.sp-personalize-modal .field{display:grid;gap:6px;margin:0;min-width:0}
.sp-personalize-modal .field span{font-size:12px;font-weight:750;color:#3c5748}
.sp-personalize-modal .field input,.sp-personalize-modal .field select,.sp-personalize-modal .field textarea{box-sizing:border-box;width:100%;min-height:41px;padding:10px 12px;border:1px solid #cfdcd2;border-radius:10px;background:#fff;color:#203d2d;font:inherit;font-size:13px;line-height:1.4}
.sp-personalize-modal .field textarea{min-height:74px;resize:vertical}
.sp-personalize-modal .field :is(input,select,textarea):focus-visible{border-color:#278059;outline:3px solid rgba(39,128,89,.16)}
.sp-variant-label{display:flex;align-items:center;gap:8px;padding-top:5px;font-size:12px;color:#264534}
.sp-variant-label small{margin-left:auto;font-size:10px;color:#677a6c}
.sp-variant-dot{width:8px;height:8px;border-radius:50%;background:#9daea2}
.sp-variant-dot.matched{background:#288759}
.sp-personalize-preview{align-self:stretch;display:flex;flex-direction:column;min-width:0;padding:22px;border-radius:18px;background:linear-gradient(158deg,#e7f0e7,#f7faf5 60%,#eaf2ed);border:1px solid #d0e2d5}
.sp-preview-header{display:flex;justify-content:space-between;align-items:center;gap:12px}
.sp-preview-header h3{margin:5px 0 0;font-size:18px;color:#193a2a}
.sp-preview-indicator{font-size:10px;color:#297453;white-space:nowrap}
.sp-preview-switch{display:flex;width:fit-content;gap:3px;padding:4px;margin:20px 0 14px;background:#d8e9dc;border-radius:11px}
.sp-preview-switch button{border:0;border-radius:8px;padding:9px 16px;background:transparent;font:inherit;font-size:12px;font-weight:750;color:#587060;cursor:pointer}
.sp-preview-switch button[aria-pressed=true]{background:#fff;color:#1f6746;box-shadow:0 1px 5px rgba(23,56,39,.12)}
.sp-email-paper{background:#fff;border-radius:13px;box-shadow:0 16px 32px rgba(25,65,38,.12);overflow:hidden;border:1px solid #dfe7de;min-height:250px}
.sp-email-browser{height:36px;display:flex;align-items:center;gap:5px;background:#f9faf9;border-bottom:1px solid #e8ede8;padding:0 14px}
.sp-email-browser span{width:6px;height:6px;border-radius:50%;background:#d3dfd6}
.sp-email-browser strong{margin-left:auto;font-size:9px;letter-spacing:.12em;color:#829389}
.sp-email-content{padding:34px 26px}
.sp-email-kicker{font-size:10px;letter-spacing:.1em;text-transform:uppercase;font-weight:750;color:#448963}
.sp-email-content h3{font-family:Georgia,serif;letter-spacing:-.018em;font-size:27px;color:#193a2a;margin:13px 0}
.sp-email-content p{font-size:14px;color:#5e7063;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere}
.sp-preview-note{display:flex;align-items:flex-start;gap:9px;color:#526f5c;font-size:12px;line-height:1.5;margin-top:20px}
.sp-preview-note span{flex:none;display:grid;place-items:center;border-radius:50%;background:#d5e8d9;color:#1d704a;width:21px;height:21px;font-weight:800}
.sp-preview-note p{margin:0}
.sp-personalize-actions{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:14px;padding-top:12px;border-top:1px solid #e1e9e2;color:#718076;font-size:12px}
.sp-personalize-actions>div{display:flex;gap:10px}
.sp-recipient-preview-modal{width:min(960px,calc(100vw - 28px));max-width:960px;max-height:calc(100dvh - 24px);overflow:auto}
.sp-recipient-preview-modal #sp-preview-contact{max-width:100%;min-height:45px;border-radius:10px}
.sp-recipient-preview-modal #sp-personalized-frame{box-sizing:border-box}
@media(max-width:810px){.modal.wide.sp-personalize-modal{padding:22px 20px}.sp-personalize-layout{grid-template-columns:1fr}.sp-personalize-preview{grid-row:2}.sp-personalize-actions{grid-row:3}}
@media(max-width:480px){.modal.wide.sp-personalize-modal{width:calc(100vw - 16px);padding:19px 14px}.sp-personalize-panel,.sp-personalize-preview{padding:15px}.sp-rule-grid{grid-template-columns:1fr}.sp-personalize-actions{flex-direction:column;align-items:stretch}.sp-personalize-actions>div{display:grid;grid-template-columns:1fr 1fr}.sp-personalize-actions button{min-height:44px}.sp-email-content{padding:24px 17px}}
@media(prefers-reduced-motion:reduce){.sp-personalize-modal *{scroll-behavior:auto!important}}

/* Personalize: one clear entry, a featured creation action, three compact tools. */
.modal.wide.personalize-hub{width:min(820px,calc(100vw - 28px));max-width:820px;max-height:calc(100dvh - 28px);overflow:auto;padding:28px 30px}
.personalize-hub .modal-head{margin-bottom:20px}
.personalize-hub .modal-head h2{font-family:var(--font-display,Georgia,serif);font-size:30px;line-height:1.2;letter-spacing:-.025em;margin:6px 0}
.personalize-hub .modal-head p{font-size:14px;line-height:1.45}
.personalize-hub-options{display:grid;gap:12px}
.personalize-hub-feature{display:flex;align-items:flex-start;gap:18px;padding:23px;border:1px solid #cce5d4;border-radius:17px;background:linear-gradient(120deg,#ecf7ed,#f6faf6);text-align:left;font:inherit;color:#193a2b;cursor:pointer;transition:border-color .16s,box-shadow .16s;min-width:0}
.personalize-hub-feature:hover,.personalize-hub-feature:focus-visible{border-color:#288156;box-shadow:0 8px 22px rgba(24,72,42,.1)}
.personalize-hub-feature>span:last-child{display:grid;gap:8px;min-width:0}
.personalize-hub-feature strong{font-size:19px;line-height:1.2}
.personalize-hub-feature small{font-size:13px;line-height:1.5;color:#536c5c;max-width:520px}
.personalize-hub-feature em{font-size:12px;font-style:normal;font-weight:800;color:#1b6c46;margin-top:5px}
.personalize-hub-icon{display:grid;place-items:center;flex:none;width:48px;height:48px;border-radius:13px;background:#d4ebd9;color:#205f40;font-size:15px;font-weight:800}
.personalize-hub-secondary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.personalize-hub-secondary button{display:flex;flex-direction:column;align-items:flex-start;gap:10px;text-align:left;padding:16px;border:1px solid #dfe7df;border-radius:14px;background:#fff;font:inherit;cursor:pointer;color:#21372b;min-width:0}
.personalize-hub-secondary button:hover,.personalize-hub-secondary button:focus-visible{border-color:#288156;background:#f6faf7}
.personalize-hub-secondary .personalize-hub-icon{width:37px;height:37px;border-radius:11px;font-size:12px;background:#edf3ed}
.personalize-hub-secondary button>span:last-child{display:grid;gap:5px}
.personalize-hub-secondary strong{font-size:13px;line-height:1.25}
.personalize-hub-secondary small{font-size:11px;line-height:1.4;color:#66796b}
.personalize-hub-guide{padding:17px 20px;border:1px solid #dce8df;border-radius:13px;background:#f7faf7;font-size:13px;line-height:1.5}
.personalize-hub-guide strong{font-size:14px}
.personalize-hub-guide p{color:#526a59}
.personalize-hub-guide button{min-height:38px}
@media(max-width:650px){.modal.wide.personalize-hub{width:calc(100vw - 16px);padding:20px 15px}.personalize-hub .modal-head h2{font-size:25px}.personalize-hub-feature{padding:17px;gap:12px}.personalize-hub-feature strong{font-size:17px}.personalize-hub-secondary{grid-template-columns:1fr}.personalize-hub-secondary button{flex-direction:row;align-items:center;padding:12px}.personalize-hub-secondary .personalize-hub-icon{flex:none}.personalize-hub-secondary strong{font-size:13px}.personalize-hub-secondary small{font-size:11px}}

/* HTML is a first-class content format in Personalize. */
.sp-content-mode{display:flex;width:fit-content;gap:4px;padding:4px;border-radius:11px;background:#e9f1eb}
.sp-content-mode button{border:0;border-radius:8px;min-width:90px;padding:9px 16px;background:transparent;color:#587260;font:inherit;font-size:12px;font-weight:750;cursor:pointer}
.sp-content-mode button[aria-pressed=true]{background:#fff;color:#1b6844;box-shadow:0 1px 5px rgba(24,65,35,.12)}
.sp-content-mode button:focus-visible{outline:3px solid rgba(39,128,89,.35)}
#sp-personalize-text-fields,#sp-personalize-html-fields{display:grid;gap:12px}
#sp-personalize-text-fields[hidden],#sp-personalize-html-fields[hidden],#sp-html-preview[hidden],#sp-text-preview[hidden]{display:none!important}
.sp-html-help{font-size:12px;line-height:1.5;color:#506e5a;margin:4px 0 2px}
.sp-personalize-modal .sp-html-code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:1.5;min-height:140px;resize:vertical;white-space:pre;tab-size:2}
.sp-html-hint{font-size:11px;color:#657c69;line-height:1.45}
#sp-html-preview{display:block;box-sizing:border-box;width:100%;height:300px;border:0;background:white}
@media(max-width:480px){.sp-content-mode{width:100%}.sp-content-mode button{flex:1}}


.sp-qr-create{display:grid;grid-template-columns:minmax(0,1fr) 240px;gap:28px;align-items:center}.sp-qr-preview{text-align:center;border:1px solid #dce7df;border-radius:16px;background:#f4f8f5;padding:20px}.sp-qr-preview img{display:block;max-width:100%;height:auto;margin:auto}.sp-qr-preview small{display:block;color:#64756b;line-height:1.5;margin-top:12px}.sp-qr-placeholder{font-size:100px;color:#216346;line-height:1}.sp-qr-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:20px 0}.sp-qr-metrics div{background:#f1f7f3;border-radius:12px;padding:16px}.sp-qr-metrics strong{font-size:28px;color:#1e6049;display:block}.sp-qr-metrics span{font-size:12px;color:#576e60}.sp-qr-report>small{display:block;margin-top:16px;line-height:1.5}.sp-qr-report details{margin-top:16px}.sp-qr-table{overflow-x:auto}.sp-qr-table table{width:100%;border-collapse:collapse;text-align:left;font-size:13px}.sp-qr-table th,.sp-qr-table td{padding:12px;border-bottom:1px solid #e0e8e2}.sp-qr-table td small{display:block;max-width:360px;overflow-wrap:anywhere;color:#64756b;margin-top:4px}#qr-error{color:#a92929}@media(max-width:640px){.sp-qr-create{grid-template-columns:1fr}.sp-qr-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
