/* Auth modals, account menu and profile settings */

.m4t-modal {
	position: fixed;
	inset: 0;
	z-index: 300;
	display: grid;
	place-items: center;
	padding: 24px;
}

.m4t-modal[hidden] {
	display: none;
}

.m4t-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(3, 6, 10, 0.74);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.m4t-modal-dialog {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 28px;
	border: 1px solid var(--line-2);
	border-radius: 18px;
	background: linear-gradient(180deg, #0c121b, #090d14);
	box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
	animation: m4t-modal-in 0.22s ease both;
	scrollbar-width: thin;
	scrollbar-color: #1c2634 transparent;
}

.m4t-modal-dialog.auth-dialog {
	max-width: 440px;
	padding-top: 58px;
}

.m4t-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	transition: color 0.2s, border-color 0.2s;
}

.m4t-modal-close:hover {
	color: var(--text);
	border-color: var(--line-2);
}

.m4t-modal-close svg {
	width: 16px;
	height: 16px;
}

.m4t-modal-dialog h2 {
	font-size: 26px;
	letter-spacing: -0.03em;
}

.m4t .auth-sub {
	margin: 6px 0 20px;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--muted);
}

/* Tabs */

.m4t .auth-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 20px;
	padding: 4px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #080c12;
}

.m4t .auth-tab {
	flex: 1;
	height: 36px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}

.m4t .auth-tab.is-active {
	background: #121a26;
	color: var(--text);
	box-shadow: inset 0 0 0 1px var(--line-2);
}

/* Fields */

.m4t .auth-field {
	margin-bottom: 14px;
}

.m4t .auth-field > label {
	display: block;
	margin-bottom: 6px;
	font-family: 'JetBrains Mono', monospace;
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted-2);
}

.m4t .auth-field > label span {
	font-family: inherit;
	letter-spacing: 0;
	text-transform: none;
}

.m4t .auth-field input {
	width: 100%;
	height: 46px;
	padding: 0 14px;
	border: 1px solid var(--line-2);
	border-radius: 10px;
	background: #070b11;
	color: var(--text);
	font-family: inherit;
	font-size: 14px;
}

.m4t .auth-field input:focus {
	outline: none;
	border-color: rgba(0, 226, 138, 0.5);
	box-shadow: 0 0 0 3px rgba(0, 226, 138, 0.08);
}

.m4t .pw-wrap {
	position: relative;
}

.m4t .pw-wrap input {
	padding-right: 62px;
}

.m4t .pw-toggle {
	position: absolute;
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
	padding: 6px 8px;
	border: 0;
	background: none;
	color: var(--muted-2);
	font-family: 'JetBrains Mono', monospace;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}

.m4t .pw-toggle:hover {
	color: var(--green);
}

.m4t .auth-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 2px 0 16px;
	font-size: 12.5px;
	color: var(--muted);
}

.m4t .auth-row a {
	color: var(--green);
}

/* Reuse checkbox styling */

.m4t .check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.m4t .check input {
	position: relative;
	width: 16px;
	height: 16px;
	margin: 0;
	border: 1px solid var(--line-2);
	border-radius: 4px;
	background: #0a0f16;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

.m4t .check input:checked {
	border-color: var(--green);
	background: var(--green);
}

.m4t .check input:checked::after {
	content: '';
	position: absolute;
	top: 1px;
	left: 4px;
	width: 4px;
	height: 8px;
	border-right: 2px solid #04120b;
	border-bottom: 2px solid #04120b;
	transform: rotate(45deg);
}

/* Feedback */

.m4t .auth-error,
.m4t .auth-success {
	margin: 10px 0 14px;
	padding: 10px 12px;
	border-radius: 9px;
	font-size: 12.5px;
	line-height: 1.5;
}

.m4t .auth-error {
	border: 1px solid rgba(255, 90, 106, 0.35);
	background: rgba(255, 90, 106, 0.08);
	color: #ffb3ba;
}

.m4t .auth-success {
	border: 1px solid rgba(0, 226, 138, 0.3);
	background: rgba(0, 226, 138, 0.07);
	color: #9ff0cd;
}

.m4t .auth-hint {
	margin: 8px 0 12px;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--muted-2);
}

.m4t .auth-alt {
	margin-top: 18px;
	font-size: 12.5px;
	color: var(--muted);
	text-align: center;
}

.m4t .auth-alt button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--green);
	font: inherit;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.m4t .btn-block {
	width: 100%;
	height: 46px;
	border-radius: 10px;
	font-size: 14.5px;
}

.m4t .login-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Profile photo editor */

.m4t .avatar-editor {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 4px 0 16px;
}

.m4t .avatar-preview {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 84px;
	height: 84px;
	overflow: hidden;
	border: 1px solid var(--line-2);
	border-radius: 50%;
	background: #0b1119;
	color: var(--green);
	font-size: 22px;
	font-weight: 700;
}

.m4t .avatar-preview img,
.m4t .avatar-preview .avatar-preview-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.m4t .avatar-preview span {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	color: var(--green);
}

.m4t .upload-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px;
	border: 1px solid var(--line-2);
	border-radius: 10px;
	background: transparent;
	color: var(--text);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.m4t .upload-btn:hover {
	border-color: rgba(255, 255, 255, 0.3);
}

.m4t .upload-btn input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.m4t .upload-btn svg {
	width: 16px;
	height: 16px;
	color: var(--green);
}

/* Account menu in the header */

.m4t .account {
	position: relative;
}

.m4t .account-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 42px;
	padding: 0 10px 0 6px;
	border: 1px solid var(--line-2);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.02);
	color: var(--text);
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
}

.m4t .account-btn:hover {
	border-color: rgba(255, 255, 255, 0.28);
	background: rgba(255, 255, 255, 0.05);
}

.m4t .account-avatar {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 30px;
	height: 30px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--green);
	color: #04120b;
	font-size: 11px;
	font-weight: 700;
	object-fit: cover;
}

.m4t .account-avatar.account-avatar-lg {
	width: 46px;
	height: 46px;
	font-size: 14px;
}

.m4t .account-btn-name {
	max-width: 110px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.m4t .account-chevron {
	width: 14px;
	height: 14px;
	color: var(--muted);
}

.m4t .account-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 80;
	width: 300px;
	padding: 10px;
	border: 1px solid var(--line-2);
	border-radius: 16px;
	background: #0b1119;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.m4t .account-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
	padding: 10px 8px 14px;
	border-bottom: 1px solid var(--line);
}

.m4t .account-id {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.m4t .account-id strong {
	font-size: 13.5px;
	color: var(--text);
}

.m4t .account-id span {
	overflow: hidden;
	font-size: 11.5px;
	color: var(--muted-2);
	text-overflow: ellipsis;
}

.m4t .account-menu {
	display: grid;
	gap: 2px;
}

.m4t .account-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 8px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--text);
	text-align: left;
	font: inherit;
	cursor: pointer;
}

.m4t .account-item:hover {
	background: rgba(255, 255, 255, 0.04);
}

.m4t .account-item svg {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	color: var(--green);
}

.m4t .account-item span {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.m4t .account-item b {
	font-size: 13px;
	font-weight: 600;
}

.m4t .account-item small {
	font-size: 11px;
	color: var(--muted-2);
}

.m4t .account-logout {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
	padding: 10px 8px;
	border-top: 1px solid var(--line);
	color: #ff8a95;
	font-size: 13px;
	font-weight: 600;
}

.m4t .account-logout:hover {
	color: #ffb3ba;
}

.m4t .account-logout svg {
	width: 16px;
	height: 16px;
}

body.m4t-modal-open {
	overflow: hidden;
}

@keyframes m4t-modal-in {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.985);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* Notification bell */

.m4t .notify {
	position: relative;
}

.m4t .notify-btn {
	position: relative;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid var(--line-2);
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.02);
	color: var(--muted);
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.m4t .notify-btn:hover {
	border-color: rgba(255, 255, 255, 0.28);
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
}

.m4t .notify-btn svg {
	width: 18px;
	height: 18px;
}

.m4t .notify-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	display: grid;
	place-items: center;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: var(--green);
	color: #04120b;
	font-family: 'JetBrains Mono', monospace;
	font-size: 9.5px;
	font-weight: 700;
}

.m4t .notify-badge[hidden] {
	display: none;
}

.m4t .notify-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 80;
	width: 330px;
	max-height: 380px;
	overflow-y: auto;
	padding: 10px;
	border: 1px solid var(--line-2);
	border-radius: 16px;
	background: #0b1119;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.m4t .notify-head {
	padding: 8px 8px 12px;
	border-bottom: 1px solid var(--line);
	font-size: 12px;
	font-weight: 600;
	color: var(--text);
}

.m4t .notify-list {
	display: grid;
	gap: 2px;
	padding-top: 8px;
}

.m4t .notify-empty {
	padding: 16px 8px;
	font-size: 12px;
	color: var(--muted-2);
}

.m4t .notify-item {
	display: flex;
	gap: 10px;
	padding: 9px 8px;
	border-radius: 10px;
}

.m4t .notify-item.is-unread {
	background: rgba(0, 226, 138, 0.06);
}

.m4t .notify-emoji {
	font-size: 16px;
	line-height: 1.2;
}

.m4t .notify-body {
	min-width: 0;
	font-size: 12px;
}

.m4t .notify-body p {
	margin: 0;
	color: #c7d2e2;
}

.m4t .notify-body b {
	color: var(--text);
}

.m4t .notify-body em {
	display: block;
	margin-top: 2px;
	overflow: hidden;
	font-style: normal;
	font-size: 11px;
	color: var(--muted-2);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.m4t .notify-body time {
	display: block;
	margin-top: 2px;
	font-family: 'JetBrains Mono', monospace;
	font-size: 10px;
	color: #556274;
}

@media (max-width: 980px) {
	.m4t .notify-panel {
		position: fixed;
		top: 78px;
		right: 16px;
		left: 16px;
		width: auto;
	}
}

@media (max-width: 980px) {
	.m4t .account-btn-name {
		display: none;
	}

	.m4t .account-panel {
		position: fixed;
		top: 78px;
		right: 16px;
		left: 16px;
		width: auto;
	}
}

@media (max-width: 640px) {
	.m4t-modal {
		padding: 12px;
	}

	.m4t-modal-dialog {
		padding: 22px;
		max-height: calc(100vh - 24px);
	}

	.m4t-modal-dialog h2 {
		font-size: 23px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.m4t-modal-dialog {
		animation: none;
	}
}
