/* Auth and error pages. Three auth layouts share one form panel:
     basic  - centred box on the page background
     card   - one rounded card, form beside a photo
     split  - full-height form panel beside a photo
   The accent (buttons, links, focus) follows the active skin; text and borders
   use a neutral grey scale in light mode and the skin tokens in dark mode. */

body.auth-page {
	--auth-text: #4c4c5c;
	--auth-heading: #313a46;
	--auth-muted: #8a95a8;
	--auth-border: #e7e9eb;
	--auth-surface: #fff;
	--auth-page-bg: #f6f7fb;
	--auth-radius: 0.3rem;
	margin: 0;
	min-height: 100vh;
	background: var(--auth-page-bg);
	color: var(--auth-text);
	font-family: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 0.875rem;
	line-height: 1.5;
	opacity: 1;
}
body.auth-page[data-theme="dark"] {
	--auth-text: var(--sk-foreground);
	--auth-heading: var(--sk-foreground);
	--auth-muted: var(--sk-muted-foreground);
	--auth-border: var(--sk-border);
	--auth-surface: var(--sk-surface);
	--auth-page-bg: var(--sk-background);
}

.auth-split-layout {
	display: flex;
	min-height: 100vh;
}

/* ── Form panel ── */
.auth-panel {
	position: relative;
	z-index: 1;
	flex: 0 0 425px;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	padding: 50px;
	overflow: hidden;
	background: var(--auth-surface);
}
/* Corner decoration: a few soft strokes in the skin accent. */
.auth-deco {
	position: absolute;
	top: -28px;
	right: -36px;
	width: 180px;
	height: 150px;
	pointer-events: none;
	opacity: 0.55;
}
.auth-deco::before,
.auth-deco::after,
.auth-deco span {
	content: "";
	position: absolute;
	height: 26px;
	border-radius: 26px;
	transform: rotate(-58deg);
	background: linear-gradient(90deg, color-mix(in srgb, var(--sk-primary) 10%, transparent), color-mix(in srgb, var(--sk-primary) 32%, transparent));
}
.auth-deco::before { width: 150px; top: 40px; left: 10px; }
.auth-deco span    { width: 120px; top: 30px; left: 62px; }
.auth-deco::after  { width: 22px; height: 22px; top: 112px; left: 118px; border-radius: 50%; transform: none; background: color-mix(in srgb, var(--sk-primary) 26%, transparent); }

.auth-brand {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	align-self: center;
	color: var(--auth-heading);
	font-size: 1.375rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 26px;
	text-decoration: none;
}
.auth-brand:hover { color: var(--auth-heading); }
.auth-brand img { width: 26px; height: 26px; }

.auth-body {
	margin-top: auto;
	padding-top: 2rem;
}
.auth-title {
	margin: 0 0 0.5rem;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.5;
	text-align: center;
	color: var(--auth-heading);
}
.auth-lead {
	margin: 0 auto 1rem;
	max-width: 75%;
	text-align: center;
	color: var(--auth-muted);
}

/* Social sign-in: label first, brand mark after it. */
.auth-social {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
}
.auth-social .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	height: 38px;
	padding: 0 0.75rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--auth-heading);
	background: transparent;
	border: 1px solid color-mix(in srgb, var(--auth-heading) 12%, transparent);
	border-radius: var(--auth-radius);
}
.auth-social .btn:hover { background: color-mix(in srgb, var(--auth-heading) 4%, transparent); color: var(--auth-heading); }
.auth-social svg { width: 15px; height: 15px; flex-shrink: 0; }

.auth-divider {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin: 1rem 0;
	color: var(--auth-muted);
	font-weight: 500;
}
.auth-divider::before,
.auth-divider::after {
	content: "";
	flex: 1;
	border-top: 2px dotted color-mix(in srgb, var(--auth-muted) 45%, transparent);
}

/* Fields */
.auth-form { margin-top: 1.5rem; }
.auth-form .form-label {
	margin-bottom: 0.5rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--auth-text);
}
.auth-form .form-label .req { color: var(--sk-danger); margin-left: 0.2rem; }
.auth-field { position: relative; }
.auth-field > svg {
	position: absolute;
	top: 50%;
	left: 0.875rem;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	color: var(--auth-muted);
	pointer-events: none;
}
.auth-form .form-control {
	height: 38px;
	padding: 0.45rem 0.75rem 0.45rem 2.5rem;
	font-size: 0.875rem;
	color: var(--auth-text);
	background: var(--auth-surface);
	border: 1px solid var(--auth-border);
	border-radius: var(--auth-radius);
	box-shadow: none;
}
.auth-form .form-control::placeholder { color: var(--auth-muted); opacity: 1; }
.auth-form .form-control:focus {
	border-color: color-mix(in srgb, var(--sk-primary) 55%, var(--auth-border));
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--sk-primary) 15%, transparent);
}
.auth-field:focus-within > svg { color: var(--sk-primary); }
.auth-form .form-check { margin-bottom: 0; }
.auth-form .form-check-input { width: 1.05em; height: 1.05em; margin-top: 0.2em; border-color: var(--auth-border); }
.auth-form .form-check-input:checked { background-color: var(--sk-primary); border-color: var(--sk-primary); }
.auth-form .form-check-input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sk-primary) 18%, transparent); }
.auth-form .form-check-label { color: var(--auth-text); }

.auth-link {
	color: var(--sk-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.25em;
}
.auth-link:hover { color: var(--sk-primary-hover, var(--sk-primary)); }
.auth-link-muted {
	color: var(--auth-muted);
	text-decoration: underline;
	text-underline-offset: 0.25em;
}
.auth-link-muted:hover { color: var(--auth-text); }

.auth-submit {
	display: block;
	width: 100%;
	padding: 0.6rem 1rem;
	font-size: 0.875rem;
	font-weight: 700;
	border-radius: var(--auth-radius);
	background: var(--sk-primary);
	border: 1px solid var(--sk-primary);
	color: var(--sk-primary-foreground, #fff);
}
.auth-submit:hover,
.auth-submit:focus { background: var(--sk-primary-hover, var(--sk-primary)); border-color: var(--sk-primary-hover, var(--sk-primary)); color: var(--sk-primary-foreground, #fff); }
.auth-submit:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sk-primary) 35%, transparent); }

.auth-switch {
	margin: 1.5rem 0 0;
	text-align: center;
	color: var(--auth-muted);
}
.auth-footer {
	margin: 0;
	padding-top: 2rem;
	text-align: center;
	color: var(--auth-muted);
}
.auth-panel .auth-footer { margin-top: auto; }
.auth-footer strong { font-weight: 700; }

/* Password strength (sign up): four segments that fill as the password improves. */
.auth-strength {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.75rem;
	margin-top: 0.75rem;
}
.auth-strength span {
	height: 5px;
	border-radius: 1rem;
	background: color-mix(in srgb, var(--auth-muted) 22%, transparent);
	transition: background-color 0.2s ease;
}
.auth-strength[data-score="1"] span:nth-child(-n+1) { background: var(--sk-danger); }
.auth-strength[data-score="2"] span:nth-child(-n+2) { background: var(--sk-warning); }
.auth-strength[data-score="3"] span:nth-child(-n+3) { background: var(--sk-info); }
.auth-strength[data-score="4"] span { background: var(--sk-success); }
.auth-hint { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--auth-muted); }

/* ── Photo panel: neutral slate wash, darkest at the bottom. ── */
.auth-visual {
	position: relative;
	flex: 1;
	min-width: 0;
	background: #313a46 center / cover no-repeat;
}
.auth-visual::after {
	content: "";
	position: absolute;
	inset: 0;
	/* Same wash as the reference; the top stop is a little stronger because our photo has a bright sky. */
	background: linear-gradient(to top, #313a46, rgba(49, 58, 70, 0.82), rgba(49, 58, 70, 0.66));
}

/* ── Basic and card layouts: centred on the page ── */
.auth-center {
	position: relative;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 2.5rem 1rem;
	overflow: hidden;
}
.auth-box {
	position: relative;
	overflow: hidden;
	width: 100%;
	max-width: 440px;
	padding: 2.5rem;
	background: var(--auth-surface);
	border-radius: 0.5rem;
	box-shadow: 0 1px 2px rgba(49, 58, 70, 0.04), 0 10px 30px -12px rgba(49, 58, 70, 0.14);
}
.auth-box .auth-body { margin-top: 0; padding-top: 1.75rem; }
.auth-duo {
	display: flex;
	width: 100%;
	max-width: 1000px;
	overflow: hidden;
	background: var(--auth-surface);
	border-radius: 0.5rem;
	box-shadow: 0 1px 2px rgba(49, 58, 70, 0.04), 0 16px 40px -16px rgba(49, 58, 70, 0.18);
}
.auth-duo .auth-panel { min-height: 0; padding: 2.5rem 50px; }
.auth-duo .auth-visual { border-radius: 0 0.5rem 0.5rem 0; }

/* ── Shared pieces ── */
/* 6-digit code: separate boxes, filled left to right (auth-pages.js moves focus). */
.auth-code {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 0.5rem;
}
.auth-form .auth-code .form-control {
	height: 42px;
	padding: 0;
	text-align: center;
	font-size: 1.125rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.auth-masked {
	margin: -0.5rem 0 1rem;
	text-align: center;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--auth-heading);
}
.auth-user { margin: 0.5rem 0 0; text-align: center; }
.auth-user img {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
}
.auth-user strong { display: block; margin-top: 0.5rem; font-weight: 700; color: var(--auth-heading); }
.auth-user span { font-size: 0.8125rem; color: var(--auth-muted); }

/* Status icon for result screens (email verified, account deactivated, maintenance). */
.auth-status {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 1.25rem;
	border-radius: 50%;
	color: var(--sk-status, var(--sk-primary));
	background: color-mix(in srgb, var(--sk-status, var(--sk-primary)) 12%, transparent);
}
.auth-status svg { width: 28px; height: 28px; }
.auth-status--danger { --sk-status: var(--sk-danger); }
.auth-status--warning { --sk-status: var(--sk-warning); }

/* ── Error pages ── */
.error-code {
	margin: 0;
	font-size: 4.5rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	text-align: center;
	color: var(--sk-primary);
}
.error-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 1.5rem;
}
.error-actions .btn { min-width: 8.5rem; padding: 0.5rem 1rem; font-weight: 700; border-radius: var(--auth-radius); }
.error-actions .auth-submit { width: auto; }
.error-actions .btn-outline {
	color: var(--auth-heading);
	background: transparent;
	border: 1px solid color-mix(in srgb, var(--auth-heading) 12%, transparent);
}
.error-actions .btn-outline:hover { background: color-mix(in srgb, var(--auth-heading) 4%, transparent); }

@media (max-width: 991.98px) {
	.auth-visual { display: none; }
	.auth-panel { flex: 1 1 auto; }
	.auth-panel > * { width: 100%; max-width: 400px; margin-left: auto; margin-right: auto; }
	.auth-panel > .auth-brand { width: auto; }
	.auth-duo { max-width: 460px; }
}
@media (max-width: 575.98px) {
	.auth-panel { padding: 50px 1.5rem 1.5rem; }
	.auth-box { padding: 2rem 1.25rem; }
	.auth-code { gap: 0.375rem; }
	.auth-social { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	.auth-strength span { transition: none; }
}

/* Dark-mode skin primaries are light (e.g. mint), so white text drops below 4.5:1. */
body[data-theme="dark"] .auth-submit,
body[data-theme="dark"] .auth-submit:hover,
body[data-theme="dark"] .auth-submit:focus { color: color-mix(in srgb, var(--sk-primary) 15%, #000); }

/* Photo for the split and card layouts (was an inline style on .auth-visual). */
.auth-visual { background-image: url("../../img/photos/unsplash-3.jpg"); }

/* Brand "AI" badge after the JRP wordmark, tinted with the skin accent. */
.auth-brand .brand-ai-badge {
	padding: 3px 7px;
	border-radius: 999px;
	background: var(--sk-primary);
	color: #fff;
	font-size: 0.625rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.04em;
}

/* ══ JRP mark ══
   The logo: a white balance-scale glyph (Lucide "scale", ISC) on a rounded square
   filled with the theme's button colour, the accent shade already tuned for white
   text, so the glyph stays legible on every skin, in dark mode and with a custom
   colour. A plain element, not an <img>: an image cannot read CSS variables, which
   is why the old fixed-colour hexagon never followed the theme. */
.jrp-mark {
	display: inline-block;
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border-radius: 9px;
	background: var(--sk-btn-bg, var(--sk-primary, #088178)) url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2024%2024%27%20fill=%27none%27%20stroke=%27white%27%20stroke-width=%272%27%20stroke-linecap=%27round%27%20stroke-linejoin=%27round%27%3E%3Cpath%20d=%27m16%2016%203-8%203%208c-.87.65-1.92%201-3%201s-2.13-.35-3-1Z%27/%3E%3Cpath%20d=%27m2%2016%203-8%203%208c-.87.65-1.92%201-3%201s-2.13-.35-3-1Z%27/%3E%3Cpath%20d=%27M7%2021h10%27/%3E%3Cpath%20d=%27M12%203v18%27/%3E%3Cpath%20d=%27M3%207h2c2%200%205-1%207-2%202%201%205%202%207%202h2%27/%3E%3C/svg%3E") center / 62% no-repeat;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 2px 6px rgba(0, 0, 0, 0.18);
}
.auth-brand .jrp-mark { width: 28px; height: 28px; border-radius: 8px; }
