body.dwr-thaid-modal-open {
	overflow: hidden;
}

.dwr-thaid-modal[hidden],
.dwr-thaid-modal [hidden] {
	display: none !important;
}

.dwr-thaid-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: grid;
	place-items: center;
	padding: 16px;
	box-sizing: border-box;
	font-family: var(--dwr-fe-font, 'Prompt', 'Kanit', 'Sarabun', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif);
}

.dwr-thaid-modal *,
.dwr-thaid-modal *::before,
.dwr-thaid-modal *::after {
	box-sizing: border-box;
	font-family: inherit;
}

.dwr-thaid-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(14, 36, 63, .76);
	backdrop-filter: blur(2px);
}

.dwr-thaid-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(450px, 100%);
	height: auto;
	max-height: min(700px, calc(100vh - 32px));
	overflow: hidden;
	border-radius: 22px;
	background: #fff;
	box-shadow: 0 28px 70px rgba(8, 28, 50, .3);
	color: #1e4675;
	-webkit-overflow-scrolling: touch;
}

.dwr-thaid-modal__header {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) 36px;
	align-items: center;
	gap: 12px;
	min-height: 72px;
	padding: 10px 14px 10px 20px;
	background: #1d4778;
	color: #fff;
}

.dwr-thaid-modal__brand-logo {
	display: block;
	width: 46px;
	height: 46px;
	border-radius: 7px;
	background: #04064c;
	object-fit: contain;
}

.dwr-thaid-modal__brand-copy h2 {
	margin: 0;
	color: #fff;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
}

.dwr-thaid-modal__brand-copy p {
	margin: 4px 0 0;
	color: #c9d8e8;
	font-size: 12px;
	line-height: 1.4;
}

.dwr-thaid-modal__close {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #113865;
	color: #9ab4d1;
	cursor: pointer;
	touch-action: manipulation;
}

.dwr-thaid-modal__close:hover {
	background: #0c315b;
	color: #fff;
}

.dwr-thaid-modal__close:focus-visible,
.dwr-thaid-modal__refresh:focus-visible,
.dwr-thaid-modal__footer a:focus-visible {
	outline: 3px solid #72aee6;
	outline-offset: 3px;
}

.dwr-thaid-modal__close svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 1.7;
}

.dwr-thaid-modal__body {
	flex: 0 1 auto;
	min-height: 0;
	padding: 16px 24px 10px;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.dwr-thaid-modal__intro {
	text-align: center;
}

.dwr-thaid-modal__intro h3 {
	margin: 0;
	color: #1e4675;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
}

.dwr-thaid-modal__intro p {
	margin: 4px 0 0;
	color: #8b8b8b;
	font-size: 13px;
	line-height: 1.5;
}

.dwr-thaid-modal__notice {
	margin: 8px auto 0;
	min-height: 18px;
	color: #65717e;
	font-size: 12px;
	line-height: 1.4;
	text-align: center;
}

.dwr-thaid-modal__notice.is-error {
	color: #b32d2e;
}

.dwr-thaid-modal__notice.is-warning {
	color: #8a5b00;
}

.dwr-thaid-modal__notice.is-success,
.dwr-thaid-modal__notice.is-ready {
	color: #08752c;
}

.dwr-thaid-modal__qr-shell {
	position: relative;
	display: grid;
	place-items: center;
	width: min(190px, 100%);
	aspect-ratio: 1;
	margin: 8px auto 0;
	padding: 10px;
	border: 2px solid #e1e8f0;
	border-radius: 22px;
	background: #f9fbfd;
}

.dwr-thaid-modal__qr {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
}

.dwr-thaid-modal__qr svg {
	display: block;
	width: 100%;
	height: 100%;
}

.dwr-thaid-modal__qr svg path {
	fill: #1e4675;
}

.dwr-thaid-modal__spinner {
	width: 34px;
	height: 34px;
	border: 3px solid #d8e2ed;
	border-top-color: #1e4675;
	border-radius: 50%;
	animation: dwr-thaid-spin .8s linear infinite;
}

.dwr-thaid-modal__expired {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	flex-direction: column;
	justify-content: center;
	padding: 20px;
	border-radius: 20px;
	background: rgba(249, 251, 253, .94);
	text-align: center;
}

.dwr-thaid-modal__expired p {
	margin: 0 0 14px;
	color: #2c3338;
	font-size: 16px;
	font-weight: 600;
}

.dwr-thaid-modal__refresh {
	min-height: 40px;
	padding: 7px 16px;
	border: 1px solid #1e4675;
	border-radius: 5px;
	background: #1e4675;
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.dwr-thaid-modal__reference {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: min(190px, 100%);
	margin: 8px auto 0;
	color: #60666d;
	font-size: 12px;
}

.dwr-thaid-modal__reference strong {
	color: #1e4675;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
	letter-spacing: .08em;
}

.dwr-thaid-modal__timer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	width: min(190px, 100%);
	min-height: 36px;
	margin: 8px auto 0;
	padding: 6px 12px;
	border-radius: 10px;
	background: #f0f4fa;
	color: #60666d;
	font-size: 12px;
}

.dwr-thaid-modal__timer strong {
	color: #d63638;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}

.dwr-thaid-modal__steps {
	margin-top: 12px;
	padding: 12px 8px 8px;
	border-top: 1px solid #e3e8ee;
}

.dwr-thaid-modal__steps > h3 {
	margin: 0 0 8px;
	color: #8a8a8a;
	font-size: 13px;
	font-weight: 500;
	text-align: center;
}

.dwr-thaid-modal__steps ol {
	position: relative;
	max-width: 360px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
}

.dwr-thaid-modal__steps ol::before {
	content: "";
	position: absolute;
	top: 16px;
	bottom: 16px;
	left: 15px;
	width: 1px;
	background: #9db4ce;
}

.dwr-thaid-modal__steps li {
	position: relative;
	display: grid;
	grid-template-columns: 32px minmax(0, 1fr);
	align-items: center;
	gap: 10px;
	min-height: 42px;
}

.dwr-thaid-modal__steps li > span {
	position: relative;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #1e4675;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

.dwr-thaid-modal__steps strong,
.dwr-thaid-modal__steps small {
	display: block;
}

.dwr-thaid-modal__steps strong {
	color: #1e4675;
	font-size: 13px;
	line-height: 1.25;
}

.dwr-thaid-modal__steps small {
	margin-top: 1px;
	color: #8a8a8a;
	font-size: 11px;
	line-height: 1.25;
}

.dwr-thaid-modal__footer {
	display: flex;
	align-items: center;
	flex-direction: column;
	flex: 0 0 auto;
	gap: 2px;
	padding: 10px 20px 12px;
	border-top: 1px solid #e3e8ee;
	color: #aaa;
	font-size: 11px;
	text-align: center;
}

.dwr-thaid-modal__footer a {
	color: #1769c2;
	text-decoration: none;
}

.dwr-thaid-modal__download-note {
	color: #1769c2;
}

.dwr-thaid-modal__footer a:hover {
	text-decoration: underline;
}

@keyframes dwr-thaid-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
	.dwr-thaid-modal {
		align-items: end;
		padding: 0;
	}

	.dwr-thaid-modal__dialog {
		width: 100%;
		max-height: 94vh;
		border-radius: 24px 24px 0 0;
	}

	.dwr-thaid-modal__header {
		grid-template-columns: 48px minmax(0, 1fr) 36px;
		gap: 12px;
		min-height: 72px;
		padding: 10px 14px 10px 18px;
	}

	.dwr-thaid-modal__brand-logo {
		width: 46px;
		height: 46px;
	}

	.dwr-thaid-modal__brand-copy h2 {
		font-size: 20px;
	}

	.dwr-thaid-modal__brand-copy p {
		margin-top: 3px;
		font-size: 12px;
	}

	.dwr-thaid-modal__close {
		width: 34px;
		height: 34px;
	}

	.dwr-thaid-modal__body {
		padding: 16px 18px 10px;
	}

	.dwr-thaid-modal__intro h3 {
		font-size: 18px;
	}

	.dwr-thaid-modal__intro p {
		font-size: 13px;
	}

	.dwr-thaid-modal__qr-shell {
		width: min(190px, 100%);
		border-radius: 22px;
	}

	.dwr-thaid-modal__timer {
		width: min(190px, 100%);
	}

	.dwr-thaid-modal__steps {
		padding-right: 4px;
		padding-left: 4px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dwr-thaid-modal__spinner {
		animation-duration: 1.8s;
	}
}

/* ─── เข้าสู่ระบบด้วยเลขบัตรประชาชน (fallback เมื่อ QR ยังใช้ไม่ได้) ─── */
.dwr-thaid-modal__manual { margin-top: 18px; text-align: left; }
.dwr-thaid-modal__manual-divider {
	display: flex; align-items: center; gap: 12px; color: #8a94a3;
	font-size: 13px; margin-bottom: 14px;
}
.dwr-thaid-modal__manual-divider::before,
.dwr-thaid-modal__manual-divider::after { content: ""; flex: 1; border-top: 1px solid #e2e8f0; }
.dwr-thaid-modal__manual h3 { margin: 0 0 4px; font-size: 15px; color: #0c2d5e; }
.dwr-thaid-modal__manual-hint { margin: 0 0 12px; font-size: 12.5px; color: #6b7280; }
.dwr-thaid-modal__manual-form label { display: block; margin-bottom: 10px; }
.dwr-thaid-modal__manual-form label span { display: block; font-size: 12.5px; color: #374151; margin-bottom: 4px; }
.dwr-thaid-modal__manual-form label span em { color: #c0392b; font-style: normal; }
.dwr-thaid-modal__manual-form input,
.dwr-thaid-modal__manual-form textarea {
	width: 100%; box-sizing: border-box; padding: 9px 12px;
	border: 1px solid #d0d5dd; border-radius: 8px; font-size: 13.5px; font-family: inherit;
}
.dwr-thaid-modal__manual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.dwr-thaid-modal__manual-submit {
	width: 100%; margin-top: 4px; padding: 12px; border: 0; border-radius: 8px;
	background: #0c2d5e; color: #fff; font-size: 14px; font-weight: 600;
	font-family: inherit; cursor: pointer;
}
.dwr-thaid-modal__manual-submit:hover { background: #0a2347; }
