.vd-aff-prompt {
	box-sizing: border-box;
	width: min(460px, calc(100% - 32px));
	max-width: none;
	max-height: calc(100dvh - 24px);
	margin: auto;
	padding: 0;
	border: 1px solid #e4ddd1;
	border-radius: 22px;
	background: #fdfbf7;
	color: #323332;
	box-shadow: 0 16px 44px rgba(28, 43, 30, 0.12);
	font-family: "Noto Sans Thai", "Noto Sans", system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
	overflow: auto;
}

.vd-aff-prompt *,
.vd-aff-prompt *::before,
.vd-aff-prompt *::after { box-sizing: border-box; }

.vd-aff-prompt::backdrop {
	background: rgba(9, 24, 16, 0.58);
	backdrop-filter: blur(3px);
}

.vd-aff-prompt__panel {
	position: relative;
	padding: 32px;
}

.vd-aff-prompt [hidden] { display: none !important; }

.vd-aff-prompt__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.vd-aff-prompt__close {
	position: absolute;
	z-index: 6;
	top: 20px;
	right: 20px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: #343934;
	font: inherit;
	cursor: pointer;
}

.vd-aff-prompt__close svg {
	display: block;
	width: 28px;
	height: 28px;
}

.vd-aff-prompt__eyebrow {
	margin: 0 44px 4px 0;
	color: #007a43;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.vd-aff-prompt h2 {
	margin: 0 44px 8px 0;
	font-size: 26px;
	line-height: 1.35;
	font-weight: 600;
	letter-spacing: -0.01em;
}

/* The intro title starts beneath the close button; reserving its column here
   made a short desktop title wrap despite usable space in the dialog. */
.vd-aff-prompt [data-vd-aff-intro] > h2 { margin-right: 0; }

.vd-aff-prompt__lead {
	margin: 0 0 20px;
	color: #5d6a61;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.7;
}

/* Storefront styles add a bottom margin to forms; the dialog owns this spacing. */
.vd-aff-prompt form { margin: 0; }

.vd-aff-prompt__field {
	display: flex;
	align-items: center;
	height: 52px;
	padding: 0 6px 0 14px;
	border: 1px solid #d8d0c1;
	border-radius: 14px;
	background: #fff;
	gap: 8px;
}

.vd-aff-prompt input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: 100%;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: #171916;
	font: inherit;
	font-size: 16px;
	text-transform: uppercase;
}

/* A discount code is easier to confirm when it reads as a single, centred token. */
.vd-aff-prompt__field input[name="code"] { text-align: left; font-weight: 800; }

.vd-aff-prompt button[type="submit"],
.vd-aff-prompt__hospital {
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
}

.vd-aff-prompt button[type="submit"] {
	flex: 0 0 auto;
	width: auto;
	min-height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 10px;
	white-space: nowrap;
	background: #006837;
	color: #fff;
}

.vd-aff-prompt button[type="submit"]:disabled {
	background: transparent;
	color: #a49d91;
	cursor: default;
	opacity: 1;
}

.vd-aff-prompt__status {
	min-height: 24px;
	margin: 8px 0 0;
	font-size: 14px;
}

.vd-aff-prompt__status:empty {
	min-height: 0;
	margin-top: 0;
}

.vd-aff-prompt__status[data-state="error"] { color: #a33232; }
.vd-aff-prompt__status[data-state="success"] { color: #006837; }

.vd-aff-prompt__divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 10px 0;
	color: #747a74;
	font-size: 15px;
	line-height: 1.4;
}

.vd-aff-prompt__divider::before,
.vd-aff-prompt__divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: #e0e4df;
}

.vd-aff-prompt__hospital {
	width: 100%;
	min-height: 52px;
	padding: 0 20px;
	border: 1px solid #c9c0af;
	border-radius: 14px;
	background: #fff;
	color: #006837;
	line-height: 1.5;
}

.vd-aff-prompt__foot {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 18px;
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid #ede6da;
	color: #6b706b;
	font-size: 15px;
	line-height: 1.5;
}

.vd-aff-prompt__later {
	flex: 0 0 auto;
	padding: 2px 0;
	border: 0;
	background: transparent;
	color: #616761;
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.vd-aff-prompt[data-vd-aff-success-mode="true"] {
	border: 0;
	--vd-ticket-seam: 180px;
	overflow: visible;
	background: transparent;
	box-shadow: none;
}
.vd-aff-prompt[data-vd-aff-success-mode="true"] .vd-aff-prompt__close { display: none; }

/* The applied state is one ticket, not a dialog around a second card. */
.vd-aff-prompt__success {
	position: relative;
	margin: -32px;
	padding: 0 0 28px;
	overflow: hidden;
	border-radius: 22px;
	background: #fffdf8;
	box-shadow: 0 16px 44px rgba(28, 43, 30, 0.12);
	-webkit-mask-image: radial-gradient(circle 16px at 0 var(--vd-ticket-seam), transparent 0 14px, #000 15px), radial-gradient(circle 16px at 100% var(--vd-ticket-seam), transparent 0 14px, #000 15px);
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-size: 100% 100%;
	-webkit-mask-composite: source-in;
	mask-image: radial-gradient(circle 16px at 0 var(--vd-ticket-seam), transparent 0 14px, #000 15px), radial-gradient(circle 16px at 100% var(--vd-ticket-seam), transparent 0 14px, #000 15px);
	mask-repeat: no-repeat;
	mask-size: 100% 100%;
	mask-composite: intersect;
}

.vd-aff-prompt__success::before {
	content: "";
	display: block;
	height: 180px;
	background: url('vide-affiliate-code-ticket-bg-v1.jpg') left center / cover no-repeat;
}

.vd-aff-prompt__confetti {
	position: fixed;
	inset: 0;
	z-index: 3;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
}

/* Popover puts the canvas in the browser's top layer, independent of ticket clipping. */
.vd-aff-prompt__confetti-layer:popover-open {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	overflow: visible;
	pointer-events: none;
}

.vd-aff-prompt__success-eyebrow,
.vd-aff-prompt__art { display: none; }

.vd-aff-prompt .vd-aff-prompt__success-title {
	position: relative;
	z-index: 4;
	min-height: 180px;
	margin: -180px 0 0;
	padding: 30px 28px 24px;
	color: #1c261f;
	font-size: 25px;
	font-weight: 500;
	line-height: 1.04;
	letter-spacing: -0.045em;
	text-align: right;
}

.vd-aff-prompt__success-title-prefix,
.vd-aff-prompt__success-title-suffix,
.vd-aff-prompt__success-title-code { display: block; }
.vd-aff-prompt__success-title-prefix,
.vd-aff-prompt__success-title-suffix { font-size: .86em; }
.vd-aff-prompt__success-title-code {
	margin: 4px 0;
	color: #007a43;
	font-size: clamp(42px, 9vw, 52px);
	font-weight: 800;
	letter-spacing: -0.06em;
	overflow-wrap: anywhere;
}

.vd-aff-prompt__benefit {
	position: relative;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 28px 20px;
	padding: 20px 0 0;
	border: 0;
	border-top: 1px solid rgba(0, 104, 55, 0.16);
	background: transparent;
	color: #075f36;
}

.vd-aff-prompt__benefit svg {
	flex: 0 0 auto;
	width: 23px;
	height: 23px;
	margin-top: 0;
	color: #a37a16;
}

.vd-aff-prompt__benefit p { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.42; }

.vd-aff-prompt__benefit-value {
	display: inline-block;
	padding: 0 4px;
	color: #006837;
	font-size: 1.64em;
	font-weight: 800;
	letter-spacing: -0.055em;
	line-height: 0.78;
}

.vd-aff-prompt__shop {
	position: relative;
	z-index: 4;
	display: block;
	width: calc(100% - 56px);
	min-height: 52px;
	margin: 0 28px;
	padding: 0 20px;
	border: 0;
	border-radius: 10px;
	background: #006837;
	color: #fff;
	font: inherit;
	font-size: 16px;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 160ms ease;
}

.vd-aff-prompt .vd-aff-prompt__shop:not(:disabled):hover { background: #00592f; }
.vd-aff-prompt__shop:focus-visible { outline: 0; box-shadow: none; background: #00592f; }
.vd-aff-prompt__shop:active { background: #004b28; }

.vd-aff-prompt__stepbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 44px;
	margin: -12px 44px 12px -12px;
	color: #6b706b;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
}

.vd-aff-prompt__back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	margin: 0;
	padding: 0 12px;
	border: 0;
	background: transparent;
	color: #4f5650;
	font: inherit;
	font-size: 14px;
	line-height: 20px;
	text-decoration: none;
	cursor: pointer;
}

.vd-aff-prompt__back svg {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
}

.vd-aff-prompt__form-group {
	margin: 0 0 16px;
}

.vd-aff-prompt__form-group label {
	display: block;
	margin: 0 0 6px;
	color: #323332;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.45;
}

.vd-aff-prompt__form-group input {
	display: block;
	width: 100%;
	height: 52px;
	padding: 0 14px;
	border: 1px solid #d8d0c1;
	border-radius: 14px;
	background: #fff;
	color: #171916;
	font: inherit;
	font-size: 17px;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	text-transform: none;
}

.vd-aff-prompt__form-group input:focus,
.vd-aff-prompt__form-group input:focus-visible,
.vd-aff-prompt__otp-fields input:focus,
.vd-aff-prompt__otp-fields input:focus-visible {
	border-color: #8d908c;
	outline: none;
	box-shadow: none;
}

.vd-aff-prompt__form-group p {
	margin: 6px 0 0;
	color: #747a74;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.45;
}

.vd-aff-prompt__primary,
.vd-aff-prompt button[type="submit"].vd-aff-prompt__primary {
	display: block;
	width: 100%;
	min-height: 50px;
	padding: 0 20px;
	border: 1px solid #006837;
	border-radius: 12px;
	background: #006837;
	color: #fff;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.45;
	cursor: pointer;
}

/* The hospital OTP screen owns an explicit 20px rhythm around its six boxes.
   A flex form prevents paragraph/fieldset margins from collapsing through the
   form, which previously made both visual gaps disappear in the popup. */
[data-vd-aff-hospital-otp] form[data-vd-aff-otp-form] { display: flex; flex-direction: column; }
[data-vd-aff-hospital-otp] .vd-aff-prompt__lead { margin-bottom: 0; }
[data-vd-aff-hospital-otp] .vd-aff-prompt__otp-fields { margin-top: 20px; }
[data-vd-aff-hospital-otp] .vd-aff-prompt__status:empty { display: none; }
[data-vd-aff-hospital-otp] .vd-aff-prompt__primary { margin-top: 20px; }

/* A verification request locks the action in place instead of moving its
   progress copy into the form. Keep its dimensions and hierarchy intact. */
.vd-aff-prompt button[type="submit"].vd-aff-prompt__primary:disabled {
	border-color: #006837;
	background: #006837;
	color: #fff;
	cursor: wait;
	opacity: .58;
}

.vd-aff-prompt__privacy {
	margin: 10px 0 0;
	color: #747a74;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.5;
	text-align: center;
}

.vd-aff-prompt__otp-fields {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin: 0;
	padding: 0;
	border: 0;
}

.vd-aff-prompt__otp-fields legend {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.vd-aff-prompt__otp-fields input {
	width: 48px;
	height: 56px;
	padding: 0;
	border: 1px solid #d8d0c1;
	border-radius: 10px;
	background: #fff;
	color: #171916;
	font: inherit;
	font-size: 22px;
	font-weight: 500;
	line-height: 1;
	text-align: center;
}

.vd-aff-prompt__resend {
	display: block;
	margin: 14px auto 0;
	padding: 6px;
	border: 0;
	background: transparent;
	color: #006837;
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
}

.vd-aff-prompt__resend:disabled { color: #747a74; cursor: wait; }

.vd-aff-prompt button:not(:disabled):hover { filter: brightness(0.94); }
.vd-aff-prompt button:focus-visible {
	outline: 3px solid rgba(0, 104, 55, 0.25);
	outline-offset: 2px;
}

/* The success CTA stays colour-only on focus so it never gains a visible ring. */
.vd-aff-prompt .vd-aff-prompt__shop:focus-visible { outline: 0; outline-offset: 0; box-shadow: none; background: #00592f; }

.vd-aff-prompt input:focus,
.vd-aff-prompt input:focus-visible {
	outline: none;
	box-shadow: none;
}

.vd-aff-prompt__field:focus-within {
	border-color: #d8d0c1;
	box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
	.vd-aff-prompt,
	.vd-aff-prompt * { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 520px) {
	.vd-aff-prompt {
		width: calc(100% - 24px);
		border-radius: 22px;
	}
	.vd-aff-prompt__panel { padding: 28px 24px 24px; }
	.vd-aff-prompt__close { top: 16px; right: 16px; }
	.vd-aff-prompt__stepbar { margin-right: 40px; }
	.vd-aff-prompt__form-group input { font-size: 16px; }
	.vd-aff-prompt__otp-fields { gap: 8px; }
	.vd-aff-prompt__otp-fields input { width: min(48px, calc((100vw - 104px) / 6)); }
	.vd-aff-prompt__foot {
		display: block;
		text-align: center;
	}
	.vd-aff-prompt__later { display: block; margin: 6px auto 0; }
	.vd-aff-prompt__success { margin: -28px -24px -24px; padding-bottom: 24px; }
	.vd-aff-prompt[data-vd-aff-success-mode="true"] { --vd-ticket-seam: 156px; }
	.vd-aff-prompt__success::before { height: 156px; background-position: left center; }
	.vd-aff-prompt .vd-aff-prompt__success-title { min-height: 156px; margin-top: -156px; padding: 25px 24px 18px; font-size: 23px; }
	.vd-aff-prompt__success-title-code { font-size: clamp(39px, 12vw, 48px); }
	.vd-aff-prompt__benefit { margin: 0 24px 18px; padding-top: 18px; gap: 10px; }
	.vd-aff-prompt__benefit p { font-size: 17px; }
	.vd-aff-prompt__shop { width: calc(100% - 48px); margin: 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
	.vd-aff-prompt::backdrop { backdrop-filter: none; }
}
