:root {
	--bg: #ffffff;
	--surface: #ffffff;
	--text: #0f1115;
	--muted: #6b7280;
	--border: #e5e7eb;
	--input-bg: #f7f8fa;
	--accent: #4f46e5;
	--accent-hover: #4338ca;
	--accent-fg: #ffffff;
	--error: #dc2626;
	--ring: rgba(79, 70, 229, 0.35);
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f1115;
		--surface: #161922;
		--text: #f3f4f6;
		--muted: #9ca3af;
		--border: #2a2f3a;
		--input-bg: #1c2030;
		--accent: #6366f1;
		--accent-hover: #818cf8;
		--accent-fg: #ffffff;
		--error: #f87171;
		--ring: rgba(99, 102, 241, 0.45);
	}
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family:
		-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
		Arial, sans-serif;
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	min-height: 100dvh;
}

body {
	display: flex;
	align-items: stretch;
	justify-content: center;
	padding: max(env(safe-area-inset-top, 0), 16px)
		max(env(safe-area-inset-right, 0), 20px)
		max(env(safe-area-inset-bottom, 0), 16px)
		max(env(safe-area-inset-left, 0), 20px);
}

.card {
	width: 100%;
	max-width: 420px;
	margin: auto;
	background: var(--surface);
	border-radius: 16px;
	padding: 28px 22px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

@media (min-width: 480px) {
	.card {
		border: 1px solid var(--border);
		padding: 32px 28px;
	}
}

.brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
}

.logo {
	width: 56px;
	height: 56px;
	border-radius: 14px;
	background: var(--accent);
	color: var(--accent-fg);
	display: grid;
	place-items: center;
	font-weight: 700;
	letter-spacing: 0.05em;
	margin-bottom: 4px;
}

.brand h1 {
	font-size: 22px;
	margin: 0;
	font-weight: 600;
}

.muted {
	color: var(--muted);
	margin: 0;
	font-size: 14px;
}

form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 14px;
}

.field span {
	color: var(--muted);
	font-weight: 500;
	padding-left: 2px;
}

.field input {
	-webkit-appearance: none;
	appearance: none;
	background: var(--input-bg);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: 10px;
	padding: 14px 14px;
	font-size: 16px;
	line-height: 1.2;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder {
	color: var(--muted);
	opacity: 0.7;
}

.field input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--ring);
}

.error {
	color: var(--error);
	font-size: 14px;
	margin: 0;
	min-height: 1em;
}

.primary {
	position: relative;
	background: var(--accent);
	color: var(--accent-fg);
	border: none;
	border-radius: 10px;
	padding: 14px 16px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	transition: background 0.15s ease, transform 0.05s ease;
}

.primary:hover:not(:disabled) {
	background: var(--accent-hover);
}

.primary:active:not(:disabled) {
	transform: scale(0.99);
}

.primary:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.primary .spinner {
	display: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	animation: spin 0.8s linear infinite;
}

.primary.loading .label {
	visibility: hidden;
}

.primary.loading .spinner {
	display: inline-block;
	position: absolute;
}

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

.foot {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 4px;
	font-size: 13px;
}

.link {
	background: none;
	border: none;
	color: var(--muted);
	padding: 8px 4px;
	cursor: pointer;
	font-size: 14px;
}

.link:hover {
	color: var(--text);
}

.env {
	color: var(--muted);
	font-size: 12px;
	opacity: 0.6;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
