/* =====================================================================
 * CartCue v1.4+ build-feature styles.
 * Reuses the existing CartCue palette:
 *   - primary purple: #534AB7
 *   - mute lavender:  #FAF9FF / #E5E4F0 / #D9D5F5
 *   - body text:      #1A1830
 *   - success green:  #1FAA59 (tone)
 *   - warning amber:  #E8A33D
 *   - danger red:     #D14E4E
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * Pulse animation used by trigger recommendation + post-restore flash.
 * ------------------------------------------------------------------- */
@keyframes ap-pulse-once {
	0%   { box-shadow: 0 0 0 0 rgba(83, 74, 183, 0.55); }
	60%  { box-shadow: 0 0 0 14px rgba(83, 74, 183, 0); }
	100% { box-shadow: 0 0 0 0 rgba(83, 74, 183, 0); }
}
.ap-pulse-once {
	animation: ap-pulse-once 1.4s ease-out;
}

/* =====================================================================
 * FEATURE 1 — Live email preview (split-pane)
 * ===================================================================== */

.ap-action-card--split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
	gap: 20px;
	align-items: start;
}
.ap-action-card--split > .ap-action-card__body {
	grid-column: 1;
	min-width: 0;
}
.ap-action-card--split > .ap-live-preview {
	grid-column: 2;
	grid-row: 1;
	align-self: start;
}
.ap-action-card--split.ap-action-card--preview-collapsed {
	grid-template-columns: 1fr;
}
.ap-action-card--split.ap-action-card--preview-collapsed > .ap-action-card__body {
	grid-column: 1;
}
.ap-email-step__head {
	position: relative;
}
.ap-preview-panel-toggle {
	margin-left: auto;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	font-weight: 600;
	padding: 5px 10px;
	border-radius: 999px;
	border: 1px solid #d9d5f5;
	background: #fff;
	color: #534AB7;
	cursor: pointer;
	transition: background 120ms, border-color 120ms, color 120ms;
}
.ap-preview-panel-toggle:hover,
.ap-preview-panel-toggle.is-active {
	background: #534AB7;
	border-color: #534AB7;
	color: #fff;
}
.ap-preview-panel-toggle i {
	font-size: 13px;
}
@media (max-width: 1100px) {
	.ap-action-card--split:not(.ap-action-card--preview-collapsed) {
		grid-template-columns: 1fr;
	}
	.ap-action-card--split:not(.ap-action-card--preview-collapsed) > .ap-live-preview {
		grid-column: 1;
		grid-row: auto;
		position: static;
		max-height: 420px;
	}
}

.ap-live-preview {
	position: sticky;
	top: 56px;
	background: #faf9ff;
	border: 1px solid #e5e4f0;
	border-radius: 12px;
	padding: 12px 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-height: calc(100vh - 80px);
	overflow: hidden;
}
.ap-live-preview__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
}
.ap-live-preview__head .ap-live-preview__title {
	flex: 1 1 auto;
	min-width: 0;
}
.ap-live-preview__head .ap-live-preview__status {
	flex: 1 1 100%;
	order: 3;
	margin-top: -2px;
}
.ap-live-preview__title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #534AB7;
}
.ap-live-preview__status {
	font-size: 11px;
	color: #6f699f;
}
.ap-live-preview__status[data-kind="loading"] { color: #6f699f; }
.ap-live-preview__status[data-kind="ok"]      { color: #1FAA59; }
.ap-live-preview__status[data-kind="err"]     { color: #D14E4E; }

.ap-live-preview__subject-row {
	display: flex;
	gap: 8px;
	background: #fff;
	border: 1px solid #ece9fb;
	border-radius: 8px;
	padding: 6px 10px;
	font-size: 13px;
}
.ap-live-preview__subject-label {
	color: #6f699f;
	font-weight: 600;
	flex: 0 0 auto;
}
.ap-live-preview__subject {
	color: #1a1830;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
	flex: 1;
}

.ap-live-preview__iframe-wrap {
	position: relative;
	flex: 1;
	background: #fff;
	border: 1px solid #ece9fb;
	border-radius: 8px;
	min-height: 280px;
	overflow: hidden;
}
.ap-live-preview__iframe {
	width: 100%;
	height: 100%;
	min-height: 280px;
	border: 0;
	display: block;
}
.ap-live-preview__empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	text-align: center;
	color: #9f9bc5;
	font-size: 13px;
	background: #faf9ff;
}
.ap-live-preview__iframe-wrap .ap-live-preview__refresh {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid #d9d5f5;
	background: #fff;
	color: #534AB7;
	font-size: 16px;
	cursor: pointer;
	z-index: 2;
	transition: background 120ms, transform 200ms;
}
.ap-live-preview__iframe-wrap .ap-live-preview__refresh:hover {
	background: #534AB7;
	color: #fff;
	transform: rotate(180deg);
}

.ap-live-preview__test-bar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto auto;
	gap: 6px 8px;
	padding-top: 4px;
	border-top: 1px solid #ece9fb;
}
.ap-live-preview__test-label {
	grid-column: 1 / -1;
	font-size: 11px;
	font-weight: 600;
	color: #6f699f;
}
.ap-live-preview__test-bar .ap-test-to-input {
	grid-column: 1;
	width: 100%;
	max-width: none;
	font-size: 13px;
	padding: 7px 10px;
}
.ap-live-preview__test-bar .ap-btn-test {
	grid-column: 2;
	align-self: end;
	white-space: nowrap;
}
.ap-live-preview__vp-group {
	display: inline-flex;
	gap: 3px;
	background: #fff;
	border: 1px solid #ece9fb;
	border-radius: 999px;
	padding: 2px;
}
.ap-live-preview__vp-btn {
	font-size: 10px;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 999px;
	border: none;
	background: transparent;
	color: #6f699f;
	cursor: pointer;
	transition: background 120ms, color 120ms;
}
.ap-live-preview__vp-btn.is-active {
	background: #534AB7;
	color: #fff;
}
.ap-live-preview__iframe-wrap[data-viewport="mobile"] .ap-live-preview__iframe {
	max-width: 375px;
	margin: 0 auto;
	display: block;
}
.ap-live-preview__iframe-wrap[data-viewport="mobile"] {
	display: flex;
	justify-content: center;
	background: #eceaf5;
}

@media (min-width: 1200px) {
	.ap-action-card--split {
		grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
		gap: 24px;
	}
}

/* Email action — stepped workflow (setup → content → options) */
.ap-email-workflow {
	display: flex;
	flex-direction: column;
	gap: 18px;
}
.ap-email-step {
	background: #fff;
	border: 1px solid #ece9fb;
	border-radius: 10px;
	padding: 12px 14px 14px;
}
.ap-email-step__head {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 1px solid #ece9fb;
}
.ap-email-step__badge {
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: #534AB7;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 24px;
	text-align: center;
}
.ap-email-step__titles {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.ap-email-step__title {
	font-size: 13px;
	font-weight: 700;
	color: #1a1830;
}
.ap-email-step__desc {
	font-size: 12px;
	color: #9f9bc5;
	line-height: 1.35;
}
.ap-email-compose__fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 14px;
}
.ap-email-compose__sender {
	display: contents;
}
.ap-email-compose__fields > .ap-field-row,
.ap-email-compose__sender > .ap-field-row {
	margin-bottom: 12px;
}
.ap-email-compose__fields > .ap-field-row:has([name*="[email_preset]"]),
.ap-email-compose__fields > .ap-field-row:has([name*="[subject]"]),
.ap-email-compose__fields > .ap-field-row:has(input[type="hidden"]) {
	grid-column: 1 / -1;
}
.ap-email-compose__sender > .ap-field-row:has([name*="[from_name]"]) {
	grid-column: 1;
}
.ap-email-compose__sender > .ap-field-row:has([name*="[from_email]"]) {
	grid-column: 2;
}
.ap-email-compose__fields .ap-input,
.ap-email-compose__fields .ap-select {
	max-width: none;
}
.ap-field-row--subject {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto auto auto;
	gap: 4px 8px;
	align-items: center;
}
.ap-field-row--subject > .ap-field-label {
	grid-column: 1 / -1;
}
.ap-field-row--subject > .ap-input {
	grid-column: 1;
	max-width: none;
}
.ap-field-row--subject > .ap-tags-btn {
	grid-column: 2;
	margin: 0;
	align-self: center;
}
.ap-field-row--subject > .ap-tags-popover {
	grid-column: 1 / -1;
}
.ap-field-row--subject > .ap-field-hint {
	grid-column: 1 / -1;
	margin-top: 0;
}
@media (max-width: 720px) {
	.ap-email-compose__fields {
		grid-template-columns: 1fr;
	}
	.ap-email-compose__sender > .ap-field-row:has([name*="[from_name]"]),
	.ap-email-compose__sender > .ap-field-row:has([name*="[from_email]"]) {
		grid-column: 1 / -1;
	}
}

.ap-email-body {
	margin-top: 0;
}
.ap-email-body > .ap-field-row > .ap-field-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.ap-uni-actions .ap-action-card--split .ap-action-fields {
	background: transparent;
	padding: 0;
}
.ap-uni-actions .ap-action-card--split .ap-action-card__header,
.ap-uni-actions .ap-action-card--email .ap-action-card__header {
	margin-bottom: 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid #ece9fb;
}
.ap-action-card__header-main {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
}
.ap-action-card__header-main .ap-action-type-label {
	flex: 1;
	min-width: 0;
}
.ap-action-card--email .ap-action-card__header {
	background: transparent;
	border-bottom: 1px solid #ece9fb;
	padding: 0 0 10px;
	margin-bottom: 12px;
}
.ap-email-workflow .ap-email-advanced {
	margin-top: 0;
	border: 1px solid #ece9fb;
	border-radius: 10px;
	background: #faf9ff;
}
.ap-email-advanced summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 12px;
	padding: 10px 14px;
}
.ap-email-advanced__label {
	font-size: 12px;
	font-weight: 600;
	color: #534AB7;
}
.ap-email-advanced__hint {
	font-size: 11px;
	color: #9f9bc5;
	font-weight: 400;
}
.ap-email-advanced__body {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 14px;
	padding: 0 14px 12px;
}
.ap-email-advanced__body > .ap-field-row:has([name*="[to]"]),
.ap-email-advanced__body > .ap-field-row:has([name*="[content_format]"]) {
	grid-column: 1 / -1;
}
@media (max-width: 720px) {
	.ap-email-advanced__body {
		grid-template-columns: 1fr;
	}
}

/* =====================================================================
 * FEATURE 2 — Audience reach chip
 * ===================================================================== */

#cartcue-audience-count {
	margin-top: 10px;
}
.ap-audience-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	background: #fff;
	border: 1px solid #e5e4f0;
	border-radius: 999px;
	font-size: 13px;
	color: #1a1830;
	transition: background 160ms, border-color 160ms;
}
.ap-audience-chip[data-tone="zero"] {
	background: #fff5f5;
	border-color: #f3cfcf;
}
.ap-audience-chip[data-tone="small"] {
	background: #fff8ee;
	border-color: #f0d6a4;
}
.ap-audience-chip[data-tone="healthy"] {
	background: #effaf3;
	border-color: #b3e5c8;
}
.ap-audience-chip__icon {
	font-size: 14px;
}
.ap-audience-chip__count {
	font-weight: 700;
	color: #534AB7;
	font-variant-numeric: tabular-nums;
}
.ap-audience-chip[data-tone="healthy"] .ap-audience-chip__count { color: #1FAA59; }
.ap-audience-chip[data-tone="zero"]    .ap-audience-chip__count { color: #D14E4E; }
.ap-audience-chip__hint {
	color: #6f699f;
	font-size: 12px;
}

/* =====================================================================
 * FEATURE 3 — Confetti celebrate modal
 * ===================================================================== */

.ap-celebrate-wrap {
	position: fixed;
	inset: 0;
	z-index: 999998;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	opacity: 0;
	transition: opacity 240ms ease;
}
.ap-celebrate-wrap.is-open {
	opacity: 1;
	pointer-events: auto;
}
.ap-celebrate-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 18, 50, 0.55);
	backdrop-filter: blur(2px);
}
.ap-celebrate-modal {
	position: relative;
	background: #fff;
	border-radius: 18px;
	padding: 36px 36px 28px;
	max-width: 460px;
	width: calc(100% - 32px);
	text-align: center;
	box-shadow: 0 24px 60px rgba(20, 18, 50, 0.32);
	transform: translateY(12px) scale(0.96);
	transition: transform 320ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.ap-celebrate-wrap.is-open .ap-celebrate-modal {
	transform: translateY(0) scale(1);
}
.ap-celebrate-modal__icon {
	font-size: 48px;
	line-height: 1;
	margin-bottom: 8px;
}
.ap-celebrate-modal__title {
	margin: 0 0 6px;
	font-size: 22px;
	font-weight: 700;
	color: #1a1830;
	letter-spacing: -0.01em;
}
.ap-celebrate-modal__sub {
	margin: 0 0 18px;
	color: #5b557e;
	font-size: 14px;
}
.ap-celebrate-modal__sub strong {
	color: #534AB7;
}
.ap-celebrate-modal__forecast {
	background: linear-gradient(180deg, #f5f3ff 0%, #ece8ff 100%);
	border-radius: 12px;
	padding: 16px 12px;
	margin: 0 0 14px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	border: 1px solid rgba(83, 74, 183, 0.12);
}
.ap-celebrate-modal__forecast-num {
	font-size: 28px;
	font-weight: 800;
	color: #534AB7;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}
.ap-celebrate-modal__forecast-period {
	font-size: 12px;
	color: #6f699f;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}
.ap-celebrate-modal__note {
	margin: 0 0 8px;
	color: #5b557e;
	font-size: 13px;
	line-height: 1.5;
}
.ap-celebrate-modal__truth {
	margin: 0 0 22px;
	color: #9f9bc5;
	font-size: 11px;
	font-style: italic;
}
.ap-celebrate-modal__cta {
	background: #534AB7;
	color: #fff;
	border: 0;
	border-radius: 10px;
	padding: 12px 22px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 140ms, transform 140ms;
}
.ap-celebrate-modal__cta:hover {
	background: #43399f;
	transform: translateY(-1px);
}

/* =====================================================================
 * FEATURE 4 — Health pill (drops into the existing .ap-play-card)
 * ===================================================================== */

.ap-health-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.01em;
	white-space: nowrap;
	border: 1px solid transparent;
	cursor: default;
}
.ap-health-pill__dot { font-size: 8px; line-height: 1; }
.ap-health-pill--green {
	background: #effaf3;
	border-color: #b3e5c8;
	color: #14773d;
}
.ap-health-pill--yellow {
	background: #fff8ee;
	border-color: #f0d6a4;
	color: #8c5a13;
}
.ap-health-pill--red {
	background: #fff5f5;
	border-color: #f3cfcf;
	color: #9a2828;
}
.ap-health-pill--paused {
	background: #f2f1f7;
	border-color: #d9d5e8;
	color: #5b557e;
}

/* =====================================================================
 * FEATURE 5 — Trigger recommendation banner
 * ===================================================================== */

.ap-trigger-recommend {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	background: linear-gradient(180deg, #faf9ff 0%, #f3f1ff 100%);
	border: 1px solid rgba(83, 74, 183, 0.18);
	border-left: 3px solid #534AB7;
	border-radius: 10px;
	margin-bottom: 16px;
	position: relative;
}
.ap-trigger-recommend__icon {
	font-size: 24px;
	flex: 0 0 auto;
}
.ap-trigger-recommend__body {
	flex: 1;
	min-width: 0;
}
.ap-trigger-recommend__title {
	display: block;
	font-size: 13px;
	color: #1a1830;
	font-weight: 700;
}
.ap-trigger-recommend__desc {
	margin: 2px 0 0;
	font-size: 13px;
	color: #5b557e;
	line-height: 1.45;
}
.ap-trigger-recommend__cta {
	flex: 0 0 auto;
}
.ap-trigger-recommend__dismiss {
	position: absolute;
	top: 4px;
	right: 6px;
	width: 22px;
	height: 22px;
	border: 0;
	background: transparent;
	color: #9f9bc5;
	cursor: pointer;
	border-radius: 50%;
	font-size: 16px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ap-trigger-recommend__dismiss:hover {
	background: rgba(83, 74, 183, 0.08);
	color: #534AB7;
}

/* =====================================================================
 * FEATURE 6 — Undo bar (toast) + restore flash
 * ===================================================================== */

.ap-undo-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(100%);
	background: #1a1830;
	color: #fff;
	padding: 12px 14px 0;
	border-radius: 12px;
	box-shadow: 0 18px 40px rgba(20, 18, 50, 0.35);
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 280px;
	max-width: 420px;
	font-size: 13px;
	z-index: 999999;
	opacity: 0;
	transition: transform 220ms cubic-bezier(0.2,0.9,0.3,1.2), opacity 200ms;
}
.ap-undo-toast.is-open {
	transform: translateX(-50%) translateY(0);
	opacity: 1;
}
.ap-undo-toast.is-leaving {
	transform: translateX(-50%) translateY(20%);
	opacity: 0;
}
.ap-undo-toast__msg {
	flex: 1;
}
.ap-undo-toast__btn {
	background: transparent;
	color: #b3a7ff;
	border: 0;
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
	padding: 6px 10px;
	border-radius: 6px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.ap-undo-toast__btn:hover {
	background: rgba(255,255,255,0.08);
	color: #fff;
}
.ap-undo-toast__close {
	background: transparent;
	border: 0;
	color: #8d87b6;
	cursor: pointer;
	font-size: 18px;
	padding: 0 4px;
	line-height: 1;
}
.ap-undo-toast__close:hover { color: #fff; }
.ap-undo-toast__bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: rgba(255,255,255,0.06);
	border-bottom-left-radius: 12px;
	border-bottom-right-radius: 12px;
	overflow: hidden;
}
.ap-undo-toast__bar-fill {
	display: block;
	height: 100%;
	background: #534AB7;
}
.ap-undo-toast {
	padding-bottom: 3px; /* leave room for the bar */
}

.ap-undo-flash {
	position: fixed;
	bottom: 80px;
	left: 50%;
	transform: translateX(-50%) translateY(8px);
	background: #1a1830;
	color: #fff;
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 13px;
	opacity: 0;
	transition: opacity 200ms, transform 220ms;
	z-index: 999999;
}
.ap-undo-flash.is-open {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}
.ap-undo-flash[data-kind="ok"]  { background: #1FAA59; }
.ap-undo-flash[data-kind="err"] { background: #D14E4E; }

/* =====================================================================
 * GUTENBERG MOUNT — wraps a real block editor inside the action card.
 * ===================================================================== */

.cartcue-block-editor-mount {
	background: #fff;
	border: 1px solid #e5e4f0;
	border-radius: 10px;
	padding: 0;
	min-height: 320px;
	margin-top: 8px;
}
.cartcue-block-editor-mount .block-editor__container {
	padding: 16px;
}
.cartcue-block-toolbar {
	display: flex;
	gap: 8px;
	padding: 8px 12px;
	border-bottom: 1px solid #ece9fb;
	background: #faf9ff;
}
.cartcue-magic-tags__menu {
	min-width: 260px;
}

/* =====================================================================
 * CartCue — Unified builder (v1.5) styles.
 * Single-page builder: WHEN · AND · WAIT · THEN, then advanced accordion,
 * sticky save bar at the bottom.
 * ===================================================================== */

.ap-wrap--unified {
	max-width: 1100px;
	margin: 0 auto;
	padding-bottom: 120px; /* room for sticky save bar */
}

/* ---------------------------------------------------------------------
 * Header (inline name + status pill + test send)
 * ------------------------------------------------------------------- */
.ap-uni-header {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 0 22px;
	border-bottom: 1px solid #e5e4f0;
	flex-wrap: wrap;
}
.ap-uni-name-inline {
	flex: 1;
	min-width: 220px;
	background: transparent;
	border: 0;
	font-size: 24px;
	font-weight: 700;
	color: #1a1830;
	letter-spacing: -0.01em;
	padding: 6px 0;
	outline: none;
}
.ap-uni-name-inline:focus {
	border-bottom: 2px solid #534AB7;
}
.ap-uni-name-inline::placeholder {
	color: #b3afd5;
	font-weight: 600;
}
.ap-uni-status-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 12px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	background: #f2f1f7;
	color: #5b557e;
}
.ap-uni-header__actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

/* ---------------------------------------------------------------------
 * The sentence — WHEN / AND / WAIT / THEN blocks
 * ------------------------------------------------------------------- */
.ap-uni-sentence {
	display: flex;
	flex-direction: column;
	gap: 0;
}
.ap-uni-block {
	position: relative;
	padding: 26px 0;
	border-bottom: 1px dashed #ece9fb;
}
.ap-uni-block:last-child { border-bottom: 0; }

.ap-uni-block__keyword {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 14px;
}
.ap-uni-keyword {
	font-size: 32px;
	font-weight: 800;
	color: #534AB7;
	letter-spacing: -0.02em;
	font-family: ui-serif, Georgia, 'Times New Roman', serif;
	font-style: italic;
}
.ap-uni-keyword--conjunction {
	color: #9f9bc5;
	font-size: 16px;
	text-transform: lowercase;
}
.ap-uni-keyword-sub {
	color: #6f699f;
	font-size: 13px;
	font-weight: 400;
}

.ap-card-header,
.ap-card-body{
    padding: 12px 18px;
}

/* ---------------------------------------------------------------------
 * WHEN: trigger picker grouped by Gestalt common-region
 * ------------------------------------------------------------------- */
.ap-uni-trigger-picker {
	display: flex;
	flex-direction: column;
	gap: 18px;
}
.ap-uni-trigger-group__label {
	margin: 0 0 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #9f9bc5;
}
.ap-uni-trigger-group__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 10px;
}

/* Lean on existing .ap-trigger-card styles from admin.css, but tighter. */
.ap-uni-trigger-group .ap-trigger-card {
	padding: 12px 14px;
	cursor: pointer;
	border: 1px solid #e5e4f0;
	border-radius: 10px;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 4px;
	transition: border-color 160ms, box-shadow 160ms, transform 120ms;
}
.ap-uni-trigger-group .ap-trigger-card:hover {
	border-color: #534AB7;
	transform: translateY(-1px);
}
.ap-uni-trigger-group .ap-trigger-card.is-selected {
	border-color: #534AB7;
	box-shadow: 0 0 0 2px rgba(83, 74, 183, 0.15);
}
.ap-uni-trigger-group .ap-trigger-radio {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.ap-uni-trigger-group .ap-trigger-label {
	font-weight: 600;
	color: #1a1830;
	font-size: 14px;
}
.ap-uni-trigger-group .ap-trigger-desc {
	color: #6f699f;
	font-size: 12px;
	line-height: 1.4;
}
.ap-uni-trigger-group .ap-trigger-card.is-pro .ap-pro-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	font-size: 9px;
	padding: 1px 6px;
	background: #534AB7;
	color: #fff;
	border-radius: 999px;
	font-weight: 700;
	letter-spacing: 0.04em;
}

/* Trigger settings panel — only the active trigger's settings are visible */
.ap-tsettings-group { display: none; padding-top: 14px; }
.ap-tsettings-group.is-visible { display: block; }

/* ---------------------------------------------------------------------
 * AND: audience filters (rules)
 * ------------------------------------------------------------------- */
.ap-uni-rules-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 1rem;
}
.ap-uni-rules-list .ap-rule-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	background: #faf9ff;
	border: 1px solid #ece9fb;
	border-radius: 10px;
	padding: 8px 10px;
}
.ap-uni-rules-list .ap-rules-empty {
	margin: 0;
	color: #6f699f;
	font-size: 13px;
	font-style: italic;
	background: transparent;
	border: 1px dashed #d9d5f5;
	border-radius: 10px;
	padding: 12px 14px;
}

/* ---------------------------------------------------------------------
 * WAIT: timing pills
 * ------------------------------------------------------------------- */
.ap-uni-timing-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.ap-uni-timing-pills .ap-timing-pill {
	background: #fff;
	border: 1px solid #d9d5f5;
	color: #1a1830;
	padding: 8px 14px;
	border-radius: 999px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	transition: background 140ms, border-color 140ms, color 140ms;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.ap-uni-timing-pills .ap-timing-pill:hover {
	border-color: #534AB7;
}
.ap-uni-timing-pills .ap-timing-pill.is-selected {
	background: #534AB7;
	border-color: #534AB7;
	color: #fff;
}
.ap-uni-timing-pills .ap-timing-pill.is-recommended {
	box-shadow: 0 0 0 2px rgba(83, 74, 183, 0.15);
}
.ap-uni-timing-pills .ap-timing-pill.is-recommended:not(.is-selected) {
	border-color: #534AB7;
}
.ap-timing-recommended {
	background: rgba(255,255,255,0.18);
	color: inherit;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 2px 6px;
	border-radius: 999px;
}
.ap-uni-timing-pills .ap-timing-pill:not(.is-selected) .ap-timing-recommended {
	background: rgba(83, 74, 183, 0.12);
	color: #534AB7;
}

.ap-timing-custom-panel {
	display: none;
	margin-top: 12px;
	background: #faf9ff;
	border: 1px solid #ece9fb;
	border-radius: 10px;
	padding: 12px;
	align-items: center;
	gap: 8px;
}
.ap-timing-custom-panel.is-open {
	display: inline-flex;
}

/* ---------------------------------------------------------------------
 * THEN: action cards
 * ------------------------------------------------------------------- */
.ap-uni-actions {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.ap-uni-actions .ap-action-card {
	background: #fff;
	border: 1px solid #e5e4f0;
	border-radius: 12px;
	padding: 14px 16px;
	min-width: 0;
}
.ap-uni-actions .ap-action-fields,
.ap-action-card__body {
	min-width: 0;
}
.ap-action-fields .cartcue-builder {
	width: 100%;
	max-width: none;
	box-sizing: border-box;
}
.ap-action-type-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 8px;
}
.ap-action-type-grid[hidden],
body.is-ap-action-inserter-open .ap-action-type-grid {
	display: none !important;
}
.ap-action-type-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 16px 12px;
	background: #faf9ff;
	border: 1px solid #ece9fb;
	border-radius: 10px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 500;
	color: #1a1830;
	transition: background 140ms, border-color 140ms, transform 120ms;
}
.ap-action-type-card:hover {
	background: #fff;
	border-color: #534AB7;
	transform: translateY(-1px);
}
.ap-action-type-card i {
	font-size: 20px;
	color: #534AB7;
}

.ap-action-card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 12px;
}
.ap-action-type-label {
	font-weight: 600;
	color: #534AB7;
}

/* ---------------------------------------------------------------------
 * Inline error (validation)
 * ------------------------------------------------------------------- */
.ap-uni-error {
	background: #fff5f5;
	border: 1px solid #f3cfcf;
	border-left: 3px solid #D14E4E;
	color: #9a2828;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 13px;
	margin: 0 0 12px;
	animation: ap-uni-error-shake 320ms ease;
}
@keyframes ap-uni-error-shake {
	0%, 100% { transform: translateX(0); }
	25%      { transform: translateX(-6px); }
	75%      { transform: translateX(6px); }
}

/* ---------------------------------------------------------------------
 * Advanced accordion — one place for power-user settings
 * ------------------------------------------------------------------- */
.ap-uni-advanced {
	margin-top: 24px;
	background: #faf9ff;
	border: 1px solid #ece9fb;
	border-radius: 12px;
}
.ap-uni-advanced > summary {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	padding: 14px 16px;
	font-size: 14px;
	font-weight: 600;
	color: #1a1830;
	list-style: none;
}
.ap-uni-advanced > summary::-webkit-details-marker { display: none; }
.ap-uni-advanced > summary::before {
	content: '▸';
	display: inline-block;
	color: #6f699f;
	transition: transform 180ms;
	font-size: 12px;
}
.ap-uni-advanced[open] > summary::before {
	transform: rotate(90deg);
}
.ap-uni-advanced__icon {
	color: #534AB7;
}
.ap-uni-advanced__hint {
	color: #9f9bc5;
	font-weight: 400;
	font-size: 12px;
}
.ap-uni-advanced__body {
	padding: 0 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.ap-uni-advanced__row-label {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #6f699f;
	margin-bottom: 8px;
}

/* Freq pills inherit existing styles, just add a "default" hint */
.ap-freq-pill__hint {
	background: rgba(255,255,255,0.2);
	color: #534AB7;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 2px 6px;
	border-radius: 999px;
	margin-left: 4px;
}
.ap-freq-pill.is-selected .ap-freq-pill__hint {
	background: rgba(255,255,255,0.25);
	color: #fff;
}

/* ---------------------------------------------------------------------
 * Sticky save bar
 * ------------------------------------------------------------------- */
.ap-uni-save-bar {
	position: fixed;
	bottom: 16px;
	background: #fff;
	border: 1px solid #e5e4f0;
	border-radius: 14px;
	box-shadow: 0 12px 36px rgba(20, 18, 50, 0.12);
	padding: 14px 20px;
	z-index: 50;
}
@media (max-width: 960px) {
	.ap-uni-save-bar { left: 16px; right: 16px; }
}
/* WP folded admin sidebar */
.folded .ap-uni-save-bar { left: 56px; }

.ap-uni-save-bar__inner {
	display: flex;
	gap: 12px;
	justify-content: flex-end;
	align-items: center;
}
.ap-uni-save-bar__limit {
	margin: 8px 0 0;
	text-align: right;
	font-size: 12px;
	color: #6f699f;
}

/* ---------------------------------------------------------------------
 * Responsive small-screen tweaks
 * ------------------------------------------------------------------- */
@media (max-width: 720px) {
	.ap-uni-header {
		gap: 8px;
	}
	.ap-uni-name-inline {
		font-size: 20px;
		min-width: 100%;
	}
	.ap-uni-keyword {
		font-size: 18px;
	}
	.ap-uni-trigger-group__grid {
		grid-template-columns: 1fr;
	}
}

/* List: post-activate banner + card highlight */
.ap-activate-banner {
	background: linear-gradient(180deg, #f5f3ff 0%, #ece8ff 100%);
	border: 1px solid rgba(83, 74, 183, 0.2);
	border-radius: 12px;
	padding: 16px 20px;
	margin-bottom: 20px;
}
.ap-activate-banner__text {
	margin: 0;
	font-size: 15px;
	color: #1a1830;
}
.ap-activate-banner__cta {
	margin: 10px 0 0;
	font-size: 13px;
	color: #5b557e;
}
.ap-play-card--highlight {
	box-shadow: 0 0 0 2px rgba(83, 74, 183, 0.35);
}
.ap-uni-revenue-badge {
	font-size: 13px;
	font-weight: 700;
	color: #1FAA59;
}
.ap-uni-test-inline {
	display: none;
}

/* Templates page */
.ap-template-mode {
	display: inline-flex;
	gap: 4px;
	padding: 4px;
	background: #f2f1f7;
	border-radius: 10px;
	margin-bottom: 24px;
}
.ap-template-mode__btn {
	padding: 8px 16px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: #5b557e;
	text-decoration: none;
}
.ap-template-mode__btn.is-active {
	background: #fff;
	color: #534AB7;
	box-shadow: 0 1px 4px rgba(20, 18, 50, 0.08);
}
.ap-template-group--popular {
	margin-bottom: 28px;
}
.ap-template-group--collapsible {
	border: 1px solid #ece9fb;
	border-radius: 12px;
	margin-bottom: 12px;
	background: #fff;
}
.ap-template-group--collapsible > summary {
	list-style: none;
	cursor: pointer;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.ap-template-group--collapsible > summary::-webkit-details-marker {
	display: none;
}
.ap-template-group--collapsible[open] > summary {
	border-bottom: 1px solid #ece9fb;
}
.ap-template-group--collapsible .ap-recipe-grid {
	padding: 16px;
}
.ap-template-scratch-link {
	text-align: center;
	margin: 28px 0 8px;
	font-size: 14px;
}
.ap-recipe-card {
	position: relative;
}
.ap-recipe-card__hover-preview {
	display: none;
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 52px;
	background: #fff;
	border: 1px solid #e5e4f0;
	border-radius: 8px;
	padding: 10px 12px;
	text-align: left;
	box-shadow: 0 8px 24px rgba(20, 18, 50, 0.12);
	z-index: 2;
	font-size: 12px;
}
.ap-recipe-card__hover-preview strong {
	display: block;
	margin-bottom: 4px;
	color: #1a1830;
}
.ap-recipe-card__hover-preview p {
	margin: 0;
	color: #6f699f;
	line-height: 1.4;
}
.ap-recipe-card:hover .ap-recipe-card__hover-preview {
	display: block;
}
