@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@600&family=Sora:wght@400;600&display=swap');

body.is-login-route {
	color-scheme: dark;
	background: #050507;
	color: #e8e9ef;
	font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	overflow: hidden;
}

body.is-login-route .topbar {
	display: none;
}

body.is-login-route .app-shell {
	min-height: 100svh;
}

.login-page {
	position: relative;
	min-height: 100svh;
	display: grid;
	place-items: center;
	padding: calc(32px + env(safe-area-inset-top, 0px)) calc(32px + env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) calc(32px + env(safe-area-inset-left, 0px));
	background:
		radial-gradient(92% 58% at 50% -13%, rgba(138, 121, 210, 0.1) 0%, rgba(138, 121, 210, 0) 60%),
		linear-gradient(180deg, #101015 0%, #050507 56%, #030305 100%);
	overflow: hidden;
}

.has-brand-background .login-page {
	background:
		linear-gradient(180deg, rgba(12, 12, 17, 0.86), rgba(5, 5, 7, 0.93)),
		var(--brand-background-image);
	background-position: center;
	background-size: cover;
}

.aurora,
.particles,
.grid-overlay,
.noise {
	position: fixed;
	inset: 0;
	pointer-events: none;
}

.aurora {
	z-index: 0;
	overflow: hidden;
}

.aurora-orb {
	position: absolute;
	border-radius: 50%;
	filter: blur(100px);
	opacity: 0.14;
	will-change: transform;
}

.aurora-orb:nth-child(1) {
	top: -18%;
	left: -12%;
	width: 620px;
	height: 620px;
	background: radial-gradient(circle, #7d6bc8 0%, transparent 72%);
	animation: drift-1 18s ease-in-out infinite alternate;
}

.aurora-orb:nth-child(2) {
	top: 40%;
	right: -14%;
	width: 500px;
	height: 500px;
	background: radial-gradient(circle, #2d2950 0%, transparent 70%);
	opacity: 0.12;
	animation: drift-2 22s ease-in-out infinite alternate;
}

.aurora-orb:nth-child(3) {
	bottom: -20%;
	left: 30%;
	width: 580px;
	height: 580px;
	background: radial-gradient(circle, #211d39 0%, transparent 70%);
	opacity: 0.09;
	animation: drift-3 20s ease-in-out infinite alternate;
}

.aurora-orb:nth-child(4) {
	top: 20%;
	left: 50%;
	width: 300px;
	height: 300px;
	background: radial-gradient(circle, #9280d9 0%, transparent 70%);
	opacity: 0.08;
	animation: drift-4 16s ease-in-out infinite alternate;
}

.particles {
	z-index: 1;
}

.particle {
	position: absolute;
	width: 2px;
	height: 2px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
	animation: float-up linear infinite;
}

.grid-overlay {
	z-index: 1;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
	background-size: 60px 60px;
	mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 0%, transparent 100%);
}

.noise {
	z-index: 2;
	opacity: 0.028;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	background-size: 128px 128px;
}

.auth-stack {
	position: relative;
	z-index: 3;
	width: min(100%, 460px);
}

.auth-layout {
	width: 100%;
	animation: panel-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel {
	position: relative;
	display: flex;
	overflow: hidden;
	padding: 44px 40px 36px;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 16px;
	background: rgba(12, 12, 17, 0.88);
	box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(40px) saturate(1.3);
	-webkit-backdrop-filter: blur(40px) saturate(1.3);
	flex-direction: column;
	justify-content: center;
}

.panel::before {
	position: absolute;
	top: 0;
	right: 40px;
	left: 40px;
	height: 1px;
	content: "";
	background: linear-gradient(90deg, transparent, rgba(79, 125, 255, 0.6), rgba(255, 255, 255, 0.3), rgba(79, 125, 255, 0.6), transparent);
	animation: edge-shimmer 4s ease-in-out infinite;
}

.panel::after {
	position: absolute;
	inset: 0;
	content: "";
	border-radius: inherit;
	background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(79, 125, 255, 0.06) 0%, transparent 60%);
	pointer-events: none;
}

.panel > * {
	position: relative;
	z-index: 1;
}

.panel-glow {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: radial-gradient(600px circle at var(--glow-x, 50%) var(--glow-y, -20%), rgba(79, 125, 255, 0.08) 0%, transparent 50%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.panel-glow-border {
	position: absolute;
	inset: -1px;
	border-radius: inherit;
	padding: 1px;
	background: radial-gradient(400px circle at var(--glow-x, 50%) var(--glow-y, -20%), rgba(79, 125, 255, 0.2) 0%, transparent 50%);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask-composite: exclude;
	-webkit-mask-composite: xor;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.panel:hover .panel-glow,
.panel:hover .panel-glow-border {
	opacity: 1;
}

.form-head {
	margin-bottom: 32px;
}

.login-brand {
	color: #babdc9;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.login-logo {
	display: block;
	max-width: 260px;
	max-height: 56px;
	margin-top: 14px;
	object-fit: contain;
}

.form-head h2 {
	margin: 14px 0 0;
	font-size: 28px;
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.form-head p {
	margin: 10px 0 0;
	color: #babdc9;
	font-size: 14.5px;
	line-height: 1.6;
}

form {
	display: grid;
	gap: 18px;
}

.field {
	display: grid;
	gap: 7px;
}

.field-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

label {
	color: #8f94a5;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.link {
	color: #a596e4;
	font-size: 11.5px;
	font-weight: 600;
	text-decoration: none;
	transition: color 0.2s ease;
}

.link:hover {
	color: #fff;
}

.control {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 52px;
	padding: 0 16px;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.04);
	transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.control:hover {
	border-color: rgba(255, 255, 255, 0.1);
	background: rgba(255, 255, 255, 0.065);
}

.control:focus-within {
	border-color: rgba(79, 125, 255, 0.4);
	background: rgba(255, 255, 255, 0.065);
	box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.08);
}

.control input {
	width: 100%;
	min-width: 0;
	padding: 14px 0;
	border: 0;
	outline: none;
	background: transparent;
	color: #e8e9ef;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
}

.control input::placeholder {
	color: rgba(255, 255, 255, 0.2);
	font-weight: 400;
}

.control input:-webkit-autofill,
.control input:-webkit-autofill:hover,
.control input:-webkit-autofill:focus,
.control input:-webkit-autofill:active {
	border-radius: inherit;
	caret-color: #e8e9ef;
	-webkit-text-fill-color: #e8e9ef !important;
	-webkit-box-shadow: 0 0 0 1000px transparent inset !important;
	box-shadow: 0 0 0 1000px transparent inset !important;
	transition: background-color 99999s ease-out 0s, color 99999s ease-out 0s;
}

.otp-control {
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	backdrop-filter: none;
}

.otp-control:hover,
.otp-control:focus-within {
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
}

.otp-source {
	position: absolute;
	inset: 0;
	z-index: 2;
	height: 100%;
	padding: 0;
	color: transparent;
	caret-color: transparent;
	font-size: 16px;
	opacity: 0;
}

.otp-source::placeholder {
	color: transparent;
}

.otp-slots {
	display: grid;
	width: 100%;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 8px;
	cursor: text;
}

.otp-slots span {
	position: relative;
	display: grid;
	min-width: 0;
	min-height: 52px;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 10px;
	color: #e8e9ef;
	background: rgba(255, 255, 255, 0.04);
	font-family: "JetBrains Mono", monospace;
	font-size: 18px;
	font-weight: 600;
	line-height: 1;
	place-items: center;
	transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.otp-slots span.is-active {
	border-color: rgba(79, 125, 255, 0.4);
	background: rgba(255, 255, 255, 0.065);
	box-shadow: 0 0 0 3px rgba(79, 125, 255, 0.08);
}

.otp-slots span.is-active::after {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 2px;
	height: 22px;
	content: "";
	background: #8b79d8;
	border-radius: 1px;
	transform: translate(-50%, -50%);
	animation: otp-blink 1s step-end infinite;
}

.otp-slots span.is-active.is-filled::after {
	display: none;
}

.otp-slots span.is-filled {
	border-color: rgba(79, 125, 255, 0.35);
	background: rgba(255, 255, 255, 0.1);
	transform: translateY(-1px);
}

.otp-timer {
	display: flex;
	align-items: center;
	gap: 6px;
	color: #8f94a5;
	font-family: "JetBrains Mono", monospace;
	font-size: 11px;
	font-weight: 600;
	user-select: none;
}

.otp-timer svg {
	width: 20px;
	height: 20px;
}

.otp-timer-track {
	fill: none;
	stroke: rgba(255, 255, 255, 0.24);
	stroke-width: 2.5;
	transition: stroke 0.3s ease;
}

.otp-timer-fill {
	fill: none;
	stroke: rgba(34, 31, 50, 0.96);
	stroke-width: 2.5;
	stroke-linecap: round;
	transform: rotate(-90deg);
	transform-origin: center;
	transition: stroke 0.3s ease;
}

.otp-timer.is-warn .otp-timer-fill {
	stroke: rgba(92, 53, 16, 0.96);
}

.otp-timer.is-warn .otp-timer-track {
	stroke: rgba(255, 184, 105, 0.4);
}

.otp-timer.is-warn .otp-timer-sec {
	color: #ffbd7f;
}

.otp-timer.is-urgent .otp-timer-fill {
	stroke: rgba(86, 24, 35, 0.95);
}

.otp-timer.is-urgent .otp-timer-track {
	stroke: rgba(255, 155, 155, 0.34);
}

.otp-timer.is-urgent .otp-timer-sec {
	color: #ff9b9b;
}

.otp-timer-sec {
	min-width: 18px;
	color: #babdc9;
	font-variant-numeric: tabular-nums;
	transition: color 0.3s ease;
}

.toggle-pw {
	display: grid;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	color: #8f94a5;
	background: transparent;
	cursor: pointer;
	flex-shrink: 0;
	place-items: center;
	transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.toggle-pw:hover {
	color: #e8e9ef;
	background: rgba(255, 255, 255, 0.06);
	transform: scale(1.08);
}

.toggle-pw svg {
	width: 18px;
	height: 18px;
}

.remember-option {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #8f94a5;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.remember-option input {
	width: 16px;
	height: 16px;
	accent-color: #215fc4;
}

.btn {
	position: relative;
	display: flex;
	min-height: 54px;
	margin-top: 6px;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 0;
	border-radius: 14px;
	color: #fff;
	background: linear-gradient(135deg, #8b79d8 0%, #5b92ff 100%);
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: pointer;
	overflow: hidden;
	transition: box-shadow 0.3s ease, transform 0.16s ease;
}

.btn::before {
	position: absolute;
	inset: 0;
	content: "";
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
}

.btn::after {
	position: absolute;
	inset: -1px;
	content: "";
	border-radius: inherit;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 40%);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask-composite: exclude;
	-webkit-mask-composite: xor;
	padding: 1px;
	pointer-events: none;
}

.btn:hover {
	box-shadow: 0 6px 18px rgba(139, 121, 216, 0.2), 0 0 0 1px rgba(139, 121, 216, 0.14);
}

.btn:active {
	transform: translateY(1px);
	box-shadow: 0 3px 10px rgba(139, 121, 216, 0.14);
}

.btn:disabled {
	cursor: wait;
	opacity: 0.75;
	box-shadow: none;
}

#spinner {
	display: inline-flex;
}

.status {
	display: none;
	padding: 12px 16px;
	border: 1px solid transparent;
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.5;
	animation: fade-in 0.25s ease both;
}

.status.err {
	display: block;
	color: #ff9b9b;
	border-color: rgba(255, 155, 155, 0.16);
	background: rgba(100, 24, 36, 0.34);
}

.support-line {
	display: grid;
	width: fit-content;
	max-width: 100%;
	margin: 28px auto 0;
	padding: 10px 16px;
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: 100px;
	justify-items: center;
	gap: 2px;
	color: #8f94a5;
	background: rgba(255, 255, 255, 0.015);
	font-size: 11.5px;
	line-height: 1.4;
	text-align: center;
	transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.support-line a {
	color: #babdc9;
	font-weight: 600;
	text-decoration: none;
	transition: color 0.2s ease;
}

.support-line a:hover {
	color: #a596e4;
}

.support-line.is-highlighted {
	color: #e8e9ef;
	border-color: rgba(79, 125, 255, 0.3);
	background: rgba(79, 125, 255, 0.06);
}

.copyright {
	margin-top: 20px;
	color: rgba(255, 255, 255, 0.4);
	font-size: 11px;
	line-height: 1.5;
	text-align: center;
}

.copyright a {
	color: rgba(255, 255, 255, 1);
	text-decoration: none;
	transition: color 0.2s ease;
}

.copyright a:hover {
	color: #babdc9;
}

@keyframes panel-enter {
	from {
		opacity: 0;
		transform: translateY(24px) scale(0.97);
		filter: blur(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
		filter: blur(0);
	}
}

@keyframes fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes otp-blink {
	0%,
	50% {
		opacity: 1;
	}
	51%,
	100% {
		opacity: 0;
	}
}

@keyframes drift-1 {
	0% {
		transform: translate(0, 0) scale(1);
	}
	100% {
		transform: translate(80px, 60px) scale(1.15);
	}
}

@keyframes drift-2 {
	0% {
		transform: translate(0, 0) scale(1);
	}
	100% {
		transform: translate(-60px, -80px) scale(1.1);
	}
}

@keyframes drift-3 {
	0% {
		transform: translate(0, 0) scale(1);
	}
	100% {
		transform: translate(40px, -50px) scale(1.2);
	}
}

@keyframes drift-4 {
	0% {
		transform: translate(0, 0) scale(1);
	}
	100% {
		transform: translate(-50px, 40px) scale(0.9);
	}
}

@keyframes float-up {
	0% {
		opacity: 0;
		transform: translateY(100vh) scale(0);
	}
	10% {
		opacity: 1;
	}
	90% {
		opacity: 1;
	}
	100% {
		opacity: 0;
		transform: translateY(-20vh) scale(1);
	}
}

@keyframes edge-shimmer {
	0%,
	100% {
		opacity: 0.4;
	}
	50% {
		opacity: 0.9;
	}
}

@media (max-width: 860px) {
	body.is-login-route {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100dvh;
		min-height: 100dvh;
		overflow: hidden;
		background: #050507;
		overscroll-behavior: none;
	}

	.aurora,
	.particles,
	.grid-overlay,
	.noise {
		display: none;
	}

	.login-page {
		height: 100dvh;
		min-height: 100dvh;
		overflow-x: hidden;
		overflow-y: auto;
		padding: calc(16px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
		align-items: center;
		overscroll-behavior-y: contain;
		-webkit-overflow-scrolling: touch;
	}

	body.is-input-focused .login-page {
		align-items: start;
	}

	.panel {
		padding: 32px 28px 28px;
	}
}

@media (max-width: 520px) {
	.login-page {
		padding: calc(16px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
	}

	.auth-stack {
		padding: 0 12px;
	}

	.form-head h2 {
		font-size: 24px;
	}

	.panel {
		padding: 28px 22px 24px;
	}

	.otp-slots {
		gap: 5px;
	}

	.otp-slots span {
		min-height: 48px;
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

