/* Цвета, шрифт и геометрия — как на medexpress.ru */
:root {
	--me-primary: #163767;
	--me-primary-rgb: 22, 55, 103;
	--me-primary-hover: #1f4a86;
	--me-primary-dark: #132E59;
	--me-accent: #789CE3;
	--me-font: #363D4A;
	--me-muted: #868B92;
	--me-border: #E1E7F2;
	--me-border-hover: #C5D0E3;
	--me-card: #F3F5FA;
	--me-danger: #E53935;

	--bs-body-font-family: 'PT Root UI', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--bs-body-color: var(--me-font);
	--bs-link-color: var(--me-primary);
	--bs-link-color-rgb: var(--me-primary-rgb);
	--bs-link-hover-color: var(--me-primary-hover);
	--bs-border-radius: 0;
	--bs-border-radius-sm: 0;
	--bs-border-radius-lg: 0;
	--bs-border-color: var(--me-border);
	--bs-form-invalid-color: var(--me-danger);
	--bs-form-invalid-border-color: var(--me-danger);
	--bs-focus-ring-color: rgba(var(--me-primary-rgb), .15);
}

body.auth {
	background: #fff;
	-webkit-font-smoothing: antialiased;
}

.auth a {
	text-decoration: none;
}

.auth a:hover {
	text-decoration: underline;
}

/* layout */

.auth-layout {
	flex: 1 0 auto;
	display: grid;
	grid-template-columns: minmax(400px, 5fr) 7fr;
	min-height: 100vh;
}

/* бренд-панель */

.auth-brand {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	padding: 48px 56px;
	overflow: hidden;
	color: #fff;
	background:
		radial-gradient(120% 80% at 0% 0%, rgba(120, 156, 227, .22) 0%, rgba(120, 156, 227, 0) 60%),
		linear-gradient(160deg, #1B427C 0%, var(--me-primary) 50%, var(--me-primary-dark) 100%);
	isolation: isolate;
}

.auth-brand__ring {
	position: absolute;
	z-index: -1;
	width: 620px;
	aspect-ratio: 1;
	right: -330px;
	bottom: -330px;
	border-radius: 50%;
	background: conic-gradient(from 180deg,
		rgba(255, 255, 255, 0) 0deg,
		rgba(255, 255, 255, .15) 60deg,
		rgba(255, 255, 255, .85) 150deg,
		rgba(255, 255, 255, .35) 230deg,
		rgba(255, 255, 255, 0) 300deg);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 64px), #000 calc(100% - 63px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 64px), #000 calc(100% - 63px));
	pointer-events: none;
}

.auth-brand__ring--small {
	width: 300px;
	bottom: auto;
	right: -150px;
	top: -150px;
	opacity: .3;
	transform: rotate(-30deg);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 28px), #000 calc(100% - 27px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 28px), #000 calc(100% - 27px));
}

.auth-brand__logo {
	display: inline-block;
	align-self: flex-start;
}

.auth-brand__logo img {
	display: block;
	width: 196px;
	height: auto;
}

.auth-brand__body {
	margin-top: auto;
	margin-bottom: auto;
	padding: 48px 0;
	max-width: 440px;
}

.auth-brand__title {
	margin: 0 0 24px;
	font-size: 56px;
	font-weight: 500;
	line-height: .92;
	color: #fff;
}

.auth-brand__lead {
	margin: 0 0 40px;
	font-size: 20px;
	line-height: 1.25;
	color: rgba(255, 255, 255, .72);
}

.auth-brand__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.auth-brand__list li {
	position: relative;
	padding-left: 24px;
	font-size: 18px;
	line-height: 1.2;
}

/* фирменный маркер-параллелограмм */
.auth-brand__list li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 6px;
	width: 10px;
	height: 8px;
	background: var(--me-accent);
	clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%);
}

.auth-brand__footer {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.auth-brand__caption {
	font-size: 14px;
	color: rgba(255, 255, 255, .6);
}

.auth-brand__phones {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
}

.auth .auth-brand__phone {
	font-size: 24px;
	font-weight: 500;
	line-height: 1;
	color: #fff;
	white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
	.auth .auth-brand__phone {
		cursor: text;
		user-select: text;
		-webkit-user-drag: none;
		text-decoration: none;
	}
}

/* правая колонка */

.auth-main {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 64px 32px 32px;
	min-width: 0;
}

.auth-panel {
	width: 100%;
	max-width: 440px;
	margin-top: auto;
	margin-bottom: auto;
}

.auth-panel__title {
	margin: 0 0 12px;
	font-size: 32px;
	font-weight: 500;
	line-height: 1;
	color: var(--me-font);
}

.auth-footer {
	display: flex;
	gap: 24px;
	justify-content: center;
	margin-top: 48px;
	font-size: 14px;
	color: var(--me-muted);
}

.auth .auth-footer a {
	color: var(--me-muted);
}

/* табы — как .me-tabs на сайте */

.auth-tabs {
	position: relative;
	display: flex;
	flex-wrap: nowrap;
	gap: 32px;
	margin-bottom: 32px;
	box-shadow: inset 0 -1px 0 var(--me-border);
}

.auth-tabs__tab {
	padding: 0 0 16px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.1;
	color: var(--me-muted);
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	transition: color .2s ease, border-color .2s ease;
}

.auth-tabs__tab:hover {
	color: var(--me-font);
	border-bottom-color: #D3D6DD;
}

.auth-tabs__tab.active {
	color: var(--me-primary);
	border-bottom-color: var(--me-primary);
}

.auth-tabs__tab:focus-visible {
	outline: 2px solid rgba(var(--me-primary-rgb), .35);
	outline-offset: 4px;
}

.auth-tabs__tab--hidden,
.auth-tabs:has(#passwordRecoveryTab.active) {
	display: none;
}

/* формы */

.auth-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.auth-form .auth-panel__title {
	margin-bottom: -8px;
}

.auth-form__lead {
	margin: 0 0 4px;
	font-size: 16px;
	line-height: 1.35;
	color: var(--me-muted);
}

.auth-field {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.auth-field__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
}

.auth-field__label {
	font-size: 15px;
	line-height: 1.2;
	color: var(--me-muted);
}

.auth-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.auth-row--document {
	grid-template-columns: 2fr 3fr;
}

.auth .form-control,
.auth .form-select {
	min-height: 52px;
	padding: 12px 16px;
	font-size: 17px;
	line-height: 1.3;
	color: var(--me-font);
	background-color: #fff;
	border: 1px solid var(--me-border);
	transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.auth .form-select {
	padding-right: 44px;
	background-position: right 16px center;
	cursor: pointer;
}

.auth .form-control::placeholder {
	color: rgba(54, 61, 74, .38);
}

.auth .form-control:hover,
.auth .form-select:hover {
	border-color: var(--me-border-hover);
}

.auth .form-control:focus,
.auth .form-select:focus {
	border-color: var(--me-primary);
	box-shadow: 0 0 0 3px rgba(var(--me-primary-rgb), .12);
}

.auth .form-control[readonly] {
	background-color: var(--me-card);
	border-color: var(--me-card);
}

.auth .form-control[readonly]:focus {
	box-shadow: none;
}

.auth .was-validated .form-control:invalid,
.auth .was-validated .form-select:invalid {
	border-color: var(--me-danger);
	background-image: none;
	padding-right: 16px;
}

.auth .was-validated .form-control:invalid:focus {
	box-shadow: 0 0 0 3px rgba(229, 57, 53, .12);
}

.auth .invalid-feedback {
	margin-top: 0;
	font-size: 14px;
	color: var(--me-danger);
}

/* пароль */

.auth-password {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.auth .auth-password .form-control {
	padding-right: 52px;
}

.auth-password__toggle {
	position: absolute;
	top: 26px;
	right: 6px;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	font-size: 20px;
	color: var(--me-muted);
	cursor: pointer;
	transition: color .15s ease;
}

.auth-password__toggle:hover {
	color: var(--me-primary);
}

/* ссылки-кнопки */

.auth-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
	font-size: 15px;
	line-height: 1.2;
	color: var(--me-primary);
	background: none;
	border: 0;
}

.auth-link:hover {
	text-decoration: underline;
}

.auth-link--back {
	align-self: flex-start;
	margin-bottom: 8px;
	color: var(--me-muted);
}

.auth-link--back:hover {
	color: var(--me-primary);
}

/* кнопки — как .me-btn на сайте */

.auth .auth-btn {
	min-height: 56px;
	padding: 14px 32px;
	font-size: 18px;
	font-weight: 400;
	line-height: 1.05;
}

.auth .btn-primary {
	--bs-btn-bg: var(--me-primary);
	--bs-btn-border-color: var(--me-primary);
	--bs-btn-hover-bg: var(--me-primary-hover);
	--bs-btn-hover-border-color: var(--me-primary-hover);
	--bs-btn-active-bg: var(--me-primary-dark);
	--bs-btn-active-border-color: var(--me-primary-dark);
	--bs-btn-disabled-bg: var(--me-primary);
	--bs-btn-disabled-border-color: var(--me-primary);
	--bs-btn-disabled-opacity: .6;
	--bs-btn-focus-shadow-rgb: var(--me-primary-rgb);
}

.auth .btn-primary .bi-arrow-right {
	transition: transform .2s ease;
}

.auth .btn-primary:hover .bi-arrow-right {
	transform: translateX(4px);
}

.auth .auth-btn--gosuslugi {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: var(--me-font);
	background: #fff;
	border: 1px solid var(--me-border);
	transition: border-color .2s ease, background-color .2s ease;
}

.auth .auth-btn--gosuslugi:hover {
	color: var(--me-font);
	background: var(--me-card);
	border-color: var(--me-border-hover);
}

.auth .auth-btn--gosuslugi img,
.auth .auth-btn--gosuslugi .spinner-border {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
}

.auth .auth-btn--gosuslugi .spinner-border {
	border-width: 3px;
	color: var(--me-primary);
}

.auth .auth-btn--gosuslugi.is-waiting img,
.auth .auth-btn--gosuslugi:not(.is-waiting) .spinner-border {
	display: none;
}

.auth .auth-btn--gosuslugi:disabled,
.auth .auth-btn--gosuslugi:disabled:hover {
	color: var(--me-font);
	background: #fff;
	border-color: var(--me-border);
	opacity: .72;
}

.auth-divider {
	display: flex;
	align-items: center;
	gap: 16px;
	font-size: 14px;
	color: var(--me-muted);
}

.auth-divider::before,
.auth-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--me-border);
}

/* согласие */

.auth-consent {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	font-size: 14px;
	line-height: 1.35;
	color: var(--me-font);
	background: var(--me-card);
	cursor: pointer;
}

.auth .auth-consent a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.auth .auth-consent a:hover {
	text-decoration-thickness: 2px;
}

.auth .auth-consent .form-check-input {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	margin: 0;
	border: 1px solid var(--me-border-hover);
	border-radius: 0;
	cursor: pointer;
}

.auth .auth-consent .form-check-input:checked {
	background-color: var(--me-primary);
	border-color: var(--me-primary);
}

.auth .auth-consent .form-check-input:focus {
	box-shadow: 0 0 0 3px rgba(var(--me-primary-rgb), .15);
}

.auth .was-validated .auth-consent .form-check-input:invalid,
.auth .auth-consent--invalid .form-check-input:not(:checked) {
	border-color: var(--me-danger);
}

.auth .was-validated .auth-consent:has(.form-check-input:invalid),
.auth .auth-consent--invalid:has(.form-check-input:not(:checked)) {
	color: var(--me-danger);
}

/* уведомления (в т.ч. те, что вставляет auth.js) */

.auth .alert {
	position: relative;
	margin: 0;
	padding: 14px 16px;
	font-size: 15px;
	line-height: 1.35;
	border: 0;
	border-left: 3px solid;
}

.auth .alert-warning {
	color: #5A4610;
	background: #FFF6DB;
	border-left-color: #F2B705;
}

.auth .alert-info {
	color: var(--me-primary);
	background: var(--me-card);
	border-left-color: var(--me-accent);
}

.auth .alert-success {
	color: #1E5B2A;
	background: #EDF7EF;
	border-left-color: #2E9E4A;
}

.auth #loginErrorAlert {
	padding-right: 40px;
}

.auth #loginErrorAlert p {
	margin-bottom: 4px;
	color: inherit;
}

.auth #loginErrorAlert .btn-warning {
	margin-top: 8px;
	padding: 6px 14px;
	font-size: 14px;
	color: var(--me-primary);
	background: transparent;
	border: 1px solid var(--me-primary);
}

.auth #loginErrorAlert .btn-warning:hover {
	background: rgba(var(--me-primary-rgb), .08);
}

.auth #loginErrorAlert .btn-close {
	margin: 10px 10px 0 0 !important;
}

/* смена вкладок */

.auth .tab-pane.fade {
	transition: opacity .2s ease;
}

/* адаптив */

@media (max-width: 1199.98px) {
	.auth-brand {
		padding: 40px;
	}

	.auth-brand__title {
		font-size: 48px;
	}
}

@media (max-width: 991.98px) {
	.auth-layout {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
	}

	.auth-brand {
		position: relative;
		height: auto;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		padding: 16px 24px;
	}

	.auth-brand__logo img {
		width: 150px;
	}

	.auth-brand__body,
	.auth-brand__ring--small {
		display: none;
	}

	.auth-brand__ring {
		width: 240px;
		right: auto;
		left: 30%;
		bottom: -170px;
		opacity: .45;
		-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 30px), #000 calc(100% - 29px));
		mask: radial-gradient(farthest-side, transparent calc(100% - 30px), #000 calc(100% - 29px));
	}

	.auth-brand__footer {
		align-items: flex-end;
		gap: 2px;
		text-align: right;
	}

	.auth-brand__caption {
		font-size: 12px;
	}

	.auth-brand__phones {
		flex-direction: column;
		align-items: flex-end;
		gap: 4px;
	}

	.auth .auth-brand__phone {
		font-size: 16px;
	}

	.auth-main {
		padding: 40px 20px 24px;
	}

	.auth-panel {
		margin-top: 0;
	}
}

@media (max-width: 479.98px) {
	.auth-brand {
		padding: 14px 16px;
	}

	.auth-brand__logo img {
		width: 128px;
	}

	.auth-main {
		padding: 28px 16px 20px;
	}

	.auth-tabs {
		gap: 24px;
		margin-bottom: 24px;
	}

	.auth-tabs__tab {
		font-size: 20px;
		padding-bottom: 14px;
	}

	.auth-panel__title {
		font-size: 26px;
	}

	.auth-row {
		grid-template-columns: 1fr;
	}

	.auth-row--document {
		grid-template-columns: 2fr 3fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.auth *,
	.auth *::before,
	.auth *::after {
		transition: none !important;
	}
}
