:root {
	--bg: #f8fafc;
	--card: #fff;
	--border: #e2e8f0;
	--border-strong: #cbd5e1;
	--text: #1f2937;
	--text-soft: #475569;
	--muted: #64748b;
	--ring: rgba(2, 132, 199, 0.18);
}

.login-page {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 16px;
	background: var(--bg);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.6;
	color: var(--text);
}
.card {
	width: 100%;
	max-width: 420px;
	padding: 34px 32px 30px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 10px 28px rgba(16, 24, 40, 0.07);
}
.logo-row,
.theme-logo-row {
	display: flex;
	align-items: center;
	justify-content: center;
}
.logo-row {
	gap: 6px;
	margin-bottom: 20px;
}
.theme-logo-row {
	min-height: 98px;
	margin-bottom: 20px;
}
.brand-logo {
	width: 100px;
	height: auto;
	display: block;
	object-fit: contain;
}
.theme-logo {
	width: 100px;
	height: 98px;
	display: block;
	object-fit: contain;
}
.card h1 {
	margin: 0;
	font-size: 32px;
	line-height: 1.25;
	font-weight: 700;
	text-align: center;
	color: var(--text);
}
.card form {
	margin-top: 26px;
	display: flex;
	flex-direction: column;
	gap: 18px;
}
.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	position: relative;
}
.field label {
	font-size: 16px;
	font-weight: 600;
	color: var(--text-soft);
}
.label-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}
.label-row a {
	font-size: 16px;
	color: var(--primary);
	text-decoration: none;
}
.field input {
	width: 100%;
	box-sizing: border-box;
	padding: 11px 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: #fff;
	color: var(--text);
	font: inherit;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease;
}
.field input::placeholder {
	color: #aab1be;
}
.field input:hover {
	border-color: var(--border-strong);
}
.field input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--ring);
}
.password-field input {
	padding-right: 48px;
}
.password-input-wrap {
	position: relative;
	width: 100%;
}
.password-input-wrap input {
	display: block;
}
.password-input-wrap button:hover,
#login-password-toggle:hover {
	color: var(--text-soft);
}
.password-input-wrap button svg,
#login-password-toggle svg {
	width: 16px;
	height: 16px;
}
.theme-body [data-password-toggle] svg {
	width: 16px;
	height: 16px;
	display: block;
}
.btn-primary {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	margin-top: 2px;
	width: 100%;
	padding: 12px 14px;
	border: 0;
	border-radius: 6px;
	background: var(--secondary);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease;
}
.btn-primary:hover {
	filter: brightness(0.94);
	text-decoration: none;
}
.theme-body a.btn-primary,
.theme-body a.btn-primary:hover,
.theme-body a.btn-primary:focus {
	color: #fff !important;
	text-decoration: none !important;
}
.theme-body button[type="submit"]:hover {
	background: var(--secondary) !important;
	filter: brightness(0.94);
}
.card form + .social-row,
.social-row {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 20px !important;
}
.btn-social {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: #fff;
	color: var(--text-soft);
	font: inherit;
	font-weight: 500;
	text-decoration: none;
	transition:
		border-color 0.15s ease,
		background 0.15s ease;
}
.btn-social:hover {
	border-color: var(--border-strong);
	background: #fafbfc;
}
.btn-social img,
.btn-social .social-fallback {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}
.form-error {
	padding: 10px;
	border-radius: 6px;
	color: #dc2626;
	background: #fef2f2;
	border: 1px solid #fecaca;
	font-size: 14px;
}
.foot-links {
	margin-top: 16px;
	text-align: center;
}
.foot-links .line1 {
	font-size: 16px;
	color: var(--muted);
}
.foot-links .line1 a {
	color: var(--primary);
	text-decoration: none;
}
.foot-links .line2 {
	margin-top: 8px;
	font-size: 16px;
}
.foot-links .line2 button {
	padding: 0;
	border: 0;
	background: none;
	color: #9aa2b1;
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.theme-body {
	font-family:
		"Sarabun",
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		Helvetica,
		Arial,
		sans-serif;
	background: var(--bg) !important;
	color: var(--text);
}
.theme-body a {
	color: var(--primary);
	text-decoration: none;
	transition:
		color 0.15s ease,
		background 0.15s ease,
		border-color 0.15s ease;
}
.theme-body a:hover:not(.btn-social) {
	color: var(--primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.theme-body button,
.theme-body input {
	font-family: inherit;
}
.theme-body :focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}
.theme-body .bg-slate-100,
.theme-body .bg-slate-50 {
	background: var(--bg) !important;
}
.theme-body .text-slate-900,
.theme-body .text-slate-800 {
	color: var(--text) !important;
}
.theme-body .text-slate-700 {
	color: var(--text-soft) !important;
}
.theme-body .text-slate-600,
.theme-body .text-slate-500 {
	color: var(--muted) !important;
}
.theme-body .text-sky-700,
.theme-body .text-sky-600 {
	color: var(--primary) !important;
}
.theme-body .bg-sky-600,
.theme-body .bg-sky-700 {
	background: var(--secondary) !important;
}
.theme-body .hover\\:bg-sky-700:hover {
	background: var(--secondary) !important;
	filter: brightness(0.94);
}
.theme-body .border-slate-200,
.theme-body .border-slate-300 {
	border-color: var(--border) !important;
}
.theme-body input[type="text"],
.theme-body input[type="email"],
.theme-body input[type="password"] {
	border: 1px solid var(--border);
	border-radius: 6px;
	border-color: var(--border);
	font-family: inherit;
}
.theme-body input[type="text"]:hover,
.theme-body input[type="email"]:hover,
.theme-body input[type="password"]:hover {
	border-color: var(--border-strong);
}
.theme-body input[type="text"]:focus,
.theme-body input[type="email"]:focus,
.theme-body input[type="password"]:focus {
	border-color: var(--primary) !important;
	box-shadow: 0 0 0 3px var(--ring) !important;
	outline: none !important;
}
.theme-body form label {
	color: var(--text-soft);
	font-size: 16px;
	font-weight: 600;
}
.theme-body form input[type="text"],
.theme-body form input[type="email"],
.theme-body form input[type="password"] {
	padding: 11px 12px;
	font-size: 16px;
}
.theme-body .rounded-2xl,
.theme-body .rounded-3xl {
	border-radius: 12px !important;
}
.theme-body .shadow-lg,
.theme-body .shadow-2xl {
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 10px 28px rgba(16, 24, 40, 0.07) !important;
}
.theme-body .hover\\:border-sky-300:hover,
.theme-body .focus\\:border-sky-500:focus {
	border-color: var(--primary) !important;
}
.theme-body .focus\\:ring-sky-100:focus,
.theme-body .focus\\:ring-sky-200:focus {
	--tw-ring-color: var(--ring) !important;
}
.theme-body .bg-rose-50 {
	background: #fef2f2 !important;
}
.theme-body .border-rose-200 {
	border-color: #fecaca !important;
}
.theme-body .text-rose-700 {
	color: #dc2626 !important;
}

.theme-body .relative {
	position: relative;
}
.theme-body .relative > button[id$="-toggle"],
.password-input-wrap button,
#login-password-toggle {
	position: absolute !important;
	right: 4px;
	top: 50%;
	bottom: auto;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 5px;
	background: transparent;
}
.theme-body .relative > input[type="password"],
.password-input-wrap input {
	padding-right: 48px;
}

.theme-body #modal-terms-of-service > div,
.theme-body #modal-privacy-policy > div {
	max-width: 640px;
	max-height: 86vh;
	padding: 40px 44px 36px;
	border-radius: 12px;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 10px 28px rgba(16, 24, 40, 0.07);
}
.theme-body #modal-terms-of-service h2,
.theme-body #modal-privacy-policy h2 {
	margin: 0;
	color: var(--primary);
	font-size: 32px;
	line-height: 1.3;
	font-weight: 700;
}
.theme-body #modal-terms-of-service h2 + p,
.theme-body #modal-privacy-policy h2 + p {
	margin: 8px 0 0;
	color: var(--text-soft);
	font-size: 24px;
	line-height: 1.5;
	font-weight: 500;
}
.theme-body #modal-terms-of-service .space-y-3,
.theme-body #modal-privacy-policy .space-y-3 {
	margin-top: 28px;
	color: var(--text);
	font-size: 16px;
	line-height: 1.6;
}
.theme-body #modal-terms-of-service .space-y-3 p,
.theme-body #modal-privacy-policy .space-y-3 p {
	margin: 0 0 16px;
}
.theme-body #modal-terms-of-service .space-y-3 ul {
	margin: 0 0 16px;
	padding-left: 22px;
}
.theme-body #modal-terms-of-service .space-y-3 li {
	margin-bottom: 10px;
}
.theme-body #modal-terms-of-service .pt-8,
.theme-body #modal-privacy-policy .pt-8 {
	padding-top: 18px;
}
.theme-body #modal-terms-of-service .pt-8 button,
.theme-body #modal-privacy-policy .pt-8 button {
	border-radius: 6px;
	background: var(--secondary) !important;
	padding: 12px 14px;
	font-size: 16px;
	font-weight: 600;
}

.portal {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
}
.portal-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 32px;
	background: var(--primary);
	border-bottom: 1px solid color-mix(in srgb, var(--primary) 75%, #000);
}
.portal-brand,
.portal-user {
	display: flex;
	align-items: center;
}
.portal-brand {
	min-height: 44px;
}
.portal-logo {
	width: 44px;
	height: 44px;
	object-fit: contain;
	display: block;
}
.portal-user {
	gap: 12px;
}
.portal-user-pill {
	display: inline-flex;
	align-items: center;
	padding: 8px 18px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: #fff;
	color: var(--text-soft);
	font-size: 14px;
	font-weight: 600;
}
.portal-logout {
	padding: 8px 18px;
	border: 1px solid var(--border-strong);
	border-radius: 10px;
	background: #fff;
	color: var(--text) !important;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none !important;
}
.portal-logout:hover {
	background: var(--bg);
	border-color: var(--border-strong);
}
.portal-main {
	flex: 1;
	width: 100%;
	padding: 48px 40px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
}
.portal-container {
	width: 100%;
	max-width: 1280px;
	padding: 44px 48px;
	border: 1px solid var(--border);
	border-radius: 20px;
	background: #fff;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 10px 28px rgba(16, 24, 40, 0.06);
}
.portal-container h1 {
	margin: 0 0 28px;
	color: var(--text);
	font-size: 30px;
	line-height: 1.25;
	font-weight: 700;
}
.service-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
}
.service-card {
	width: 100%;
	padding: 20px;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--bg);
}
.service-card-top {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}
.service-icon {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: linear-gradient(135deg, #ede9fe, #f3e8ff);
	color: var(--primary);
	overflow: hidden;
}
.service-icon svg {
	width: 20px;
	height: 20px;
	display: block;
}
.service-logo {
	width: 32px;
	height: 32px;
	object-fit: contain;
	display: block;
}
.service-copy {
	min-width: 0;
	flex: 1;
}
.service-copy h2 {
	margin: 0;
	overflow: hidden;
	color: var(--text);
	font-size: 19px;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.service-copy p {
	display: -webkit-box;
	overflow: hidden;
	margin: 2px 0 0;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.5;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}
.service-divider {
	margin: 18px 0;
	border-top: 1px solid var(--border);
}
.service-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: var(--muted);
	font-size: 14px;
}
.service-foot a {
	color: var(--primary);
	font-weight: 700;
	text-decoration: none;
}
.service-foot a:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}
.service-empty {
	grid-column: 1/-1;
	padding: 32px;
	border: 1px dashed var(--border-strong);
	border-radius: 14px;
	background: var(--bg);
	color: var(--muted);
	text-align: center;
}

/* Access denied page from the V6 layout. */
.denied-page {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 16px;
	background: var(--bg);
	color: var(--text);
}
.denied-card {
	width: 100%;
	max-width: 420px;
	padding: 34px 32px 30px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: #fff;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 10px 28px rgba(16, 24, 40, 0.07);
}
.denied-icon {
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 22px;
	border-radius: 14px;
	background: #fde8e8;
	color: #dc2626;
}
.denied-icon svg {
	width: 26px;
	height: 26px;
}
.denied-card h1 {
	margin: 0;
	color: var(--text);
	font-size: 32px;
	line-height: 1.25;
	font-weight: 700;
	text-align: center;
}
.denied-card > p {
	margin: 10px 0 0;
	color: var(--text-soft);
	font-size: 16px;
	line-height: 1.6;
	text-align: center;
}
.denied-actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 30px;
}
.denied-actions a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border-radius: 6px;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none !important;
}
.denied-primary {
	background: var(--secondary);
	color: #fff !important;
}
.denied-primary:hover {
	filter: brightness(0.94);
}
.denied-secondary {
	border: 1px solid var(--border);
	background: #fff;
	color: var(--text-soft) !important;
}
.denied-secondary:hover {
	background: #fafbfc;
	border-color: var(--border-strong);
}

@media (max-width: 1024px) {
	.service-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 640px) {
	.portal-nav {
		padding: 14px 16px;
	}
	.portal-user-pill {
		display: none;
	}
	.portal-main {
		padding: 24px 16px;
	}
	.portal-container {
		padding: 28px 22px;
	}
	.service-grid {
		grid-template-columns: 1fr;
	}
}

/* Shared status and password-reset components reuse the V6 auth card. */
.status-card {
	text-align: center;
}
.status-icon {
	width: 72px;
	height: 72px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 24px;
	border-radius: 50%;
	background: #dcfce7;
	color: #16a34a;
}
.status-icon svg {
	width: 38px;
	height: 38px;
}
.status-heading {
	text-align: center;
}
.status-subtitle {
	margin: 10px 0 0;
	color: var(--muted);
	font-size: 16px;
	line-height: 1.6;
}
.status-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 26px;
	color: var(--primary);
	font-size: 16px;
	font-weight: 400;
	text-decoration: none;
}
.status-link:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}
.field-hint {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.field-hint p {
	margin: 0;
	color: #94a3b8;
	font-size: 13px;
	line-height: 1.5;
}
@media (max-width: 420px) {
	.status-card {
		padding: 30px 22px 26px;
	}
	.status-card h1 {
		font-size: 28px;
	}
}

/* The standalone Terms page and the base modal share one content partial. */
.terms-card {
	max-width: 640px;
	padding: 40px 44px 36px;
}
.terms-content h2 {
	margin: 0;
	color: var(--primary);
	font-size: 32px;
	line-height: 1.3;
	font-weight: 700;
}
.terms-content h2 + p {
	margin: 8px 0 0;
	color: var(--text-soft);
	font-size: 24px;
	line-height: 1.5;
	font-weight: 500;
}
.terms-body {
	margin-top: 28px;
	color: var(--text);
	font-size: 16px;
	line-height: 1.6;
}
.terms-body p {
	margin: 0 0 16px;
}
.terms-body ul {
	display: block;
	margin: 0 0 16px;
	padding-left: 22px;
	list-style: disc;
}
.terms-body li {
	margin-bottom: 10px;
}
@media (max-width: 640px) {
	.terms-card {
		padding: 30px 24px 26px;
	}
	.terms-content h2 {
		font-size: 26px;
	}
	.terms-content h2 + p {
		font-size: 20px;
	}
}
@media (max-width: 420px) {
	.card {
		padding: 30px 22px 26px;
	}
	.card h1 {
		font-size: 28px;
	}
}
