/* Защищённые сообщения — в стиле темы Admin-Lic. Всё изолировано в .asm-app */

.asm-root {
	--asm-card: var(--card, #fff);
	--asm-card-2: var(--card-2, #f9fafc);
	--asm-line: var(--line-2, #e2e5ee);
	--asm-text: var(--text, #232a3b);
	--asm-muted: var(--muted, #8c9097);
	--asm-primary: var(--primary, #845adf);
	--asm-soft: var(--primary-soft, rgba(132, 90, 223, .1));
	--asm-green: var(--success, #26bf94);
	--asm-red: var(--danger, #e6533c);
	--asm-amber: var(--warning, #f5b849);
	--asm-input: var(--input, #fff);
	--asm-shadow: var(--shadow, 0 1px 2px rgba(33, 40, 50, .05), 0 6px 18px -10px rgba(33, 40, 50, .14));
	display: block;
	max-width: 100%;
	color: var(--asm-text);
	font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
}

.asm-app,
.asm-app *,
.asm-app *::before,
.asm-app *::after {
	box-sizing: border-box;
}

.asm-app [hidden] {
	display: none !important;
}

.asm-app h2,
.asm-app h3,
.asm-app p {
	margin: 0;
	padding: 0;
}

/* Шапка */
.asm-head {
	margin-bottom: 18px;
}

.asm-head--row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

/* Своя подложка: шапка попадает на цветную полосу темы */
.asm-app > .asm-head {
	padding: 14px 18px;
	background: var(--asm-card);
	border: 1px solid var(--asm-line);
	border-radius: 8px;
	box-shadow: var(--asm-shadow);
}

.asm-head--row .asm-head {
	margin: 0;
}

.asm-app .asm-title {
	font-size: 26px;
	font-weight: 600;
	line-height: 1.2;
}

.asm-app .asm-sub {
	margin-top: 6px;
	color: var(--asm-muted);
}

/* Карточка и формы */
.asm-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 24px;
	background: var(--asm-card);
	border: 1px solid var(--asm-line);
	border-radius: 8px;
	box-shadow: var(--asm-shadow);
}

.asm-narrow {
	max-width: 480px;
}

.asm-app .asm-card h2,
.asm-app .asm-card h3 {
	font-size: 18px;
	font-weight: 600;
}

.asm-muted {
	color: var(--asm-muted);
}

.asm-app .asm-error {
	color: var(--asm-red);
}

.asm-app .asm-error:empty {
	display: none;
}

.asm-status {
	margin-bottom: 12px !important;
}

.asm-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-weight: 500;
}

.asm-input {
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	color: var(--asm-text);
	background: var(--asm-input);
	border: 1px solid var(--asm-line);
	border-radius: 8px;
	font: inherit;
}

.asm-input:focus {
	outline: 2px solid var(--asm-primary);
	outline-offset: -1px;
}

.asm-check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	color: var(--asm-muted);
	font-size: 13px;
}

.asm-check input {
	margin-top: 3px;
}

.asm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: 8px;
	font: inherit;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
}

.asm-btn:disabled {
	opacity: .55;
	cursor: not-allowed;
}

.asm-btn--primary,
.asm-btn--primary:hover {
	color: #fff;
	background: var(--asm-primary);
}

.asm-btn--ghost {
	color: var(--asm-text);
	background: transparent;
	border-color: var(--asm-line);
}

.asm-btn--ghost:hover {
	background: var(--asm-soft);
}

.asm-btn--sm {
	min-height: 32px;
	padding: 4px 10px;
	font-size: 13px;
}

/* Раскладка */
.asm-layout {
	display: grid;
	grid-template-columns: 300px minmax(0, 1fr);
	height: min(72vh, 760px);
	min-height: 460px;
	background: var(--asm-card);
	border: 1px solid var(--asm-line);
	border-radius: 8px;
	box-shadow: var(--asm-shadow);
	overflow: hidden;
}

.asm-side {
	display: flex;
	flex-direction: column;
	min-height: 0;
	border-right: 1px solid var(--asm-line);
}

.asm-side-top {
	padding: 12px;
	border-bottom: 1px solid var(--asm-line);
}

.asm-list {
	flex: 1;
	min-height: 0;
	padding: 6px;
	overflow-y: auto;
}

.asm-list-label {
	padding: 10px 8px 4px;
	color: var(--asm-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.asm-list-none {
	padding: 8px !important;
}

.asm-more {
	width: 100%;
	margin-top: 8px;
}

.asm-user {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 8px;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.asm-user:hover,
.asm-user.is-active {
	background: var(--asm-soft);
}

.asm-avatar {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	color: var(--asm-primary);
	background: var(--asm-soft);
	border-radius: 50%;
	font-size: 12px;
	font-weight: 600;
}

.asm-user-text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.asm-user-name {
	overflow: hidden;
	font-weight: 500;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.asm-user-text small {
	color: var(--asm-muted);
	font-size: 12px;
}

.asm-badge {
	flex: none;
	min-width: 20px;
	padding: 0 6px;
	color: #fff;
	background: var(--asm-primary);
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	text-align: center;
}

/* Переписка */
.asm-main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}

.asm-empty {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 24px;
	color: var(--asm-muted);
	text-align: center;
}

.asm-empty b {
	color: var(--asm-text);
	font-weight: 600;
}

.asm-chat-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--asm-line);
}

.asm-back {
	display: none;
}

.asm-tools {
	display: flex;
	flex: none;
	gap: 6px;
}

.asm-verify.is-ok {
	color: var(--asm-green);
}

.asm-safety,
.asm-warn {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	padding: 12px 14px;
	border-bottom: 1px solid var(--asm-line);
	font-size: 13px;
}

.asm-safety {
	background: var(--asm-card-2);
}

.asm-warn {
	background: rgba(245, 184, 73, .14);
	border-left: 3px solid var(--asm-amber);
}

.asm-code {
	padding: 8px 10px;
	background: var(--asm-card);
	border: 1px solid var(--asm-line);
	border-radius: 8px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	line-height: 1.7;
	word-spacing: 4px;
}

.asm-msgs {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	min-height: 0;
	padding: 14px;
	overflow-y: auto;
}

.asm-center {
	margin: auto !important;
	text-align: center;
}

.asm-center-btn {
	align-self: center;
	flex: none;
}

.asm-day {
	align-self: center;
	margin: 8px 0 4px;
	color: var(--asm-muted);
	font-size: 12px;
}

.asm-msg {
	align-self: flex-start;
	max-width: min(75%, 560px);
	padding: 7px 11px;
	background: var(--asm-card-2);
	border: 1px solid var(--asm-line);
	border-radius: 10px;
}

.asm-msg.is-mine {
	align-self: flex-end;
	background: var(--asm-soft);
	border-color: transparent;
}

.asm-msg.is-bad .asm-msg-text {
	color: var(--asm-muted);
	font-style: italic;
}

.asm-msg-text {
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}

.asm-msg-meta {
	margin-top: 2px;
	color: var(--asm-muted);
	font-size: 11px;
	text-align: right;
}

.asm-compose {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid var(--asm-line);
}

.asm-compose-input {
	flex: 1;
	max-height: 140px;
	resize: vertical;
}

/* Телефон: список и переписка по очереди */
@media (max-width: 760px) {
	.asm-layout {
		grid-template-columns: minmax(0, 1fr);
		height: 76vh;
	}

	.asm-side {
		border-right: 0;
	}

	.asm-main {
		display: none;
	}

	.asm-layout.has-peer .asm-side {
		display: none;
	}

	.asm-layout.has-peer .asm-main {
		display: flex;
	}

	.asm-back {
		display: inline-flex;
	}

	.asm-chat-head {
		flex-wrap: wrap;
	}

	.asm-tools {
		order: 3;
		width: 100%;
	}

	.asm-msg {
		max-width: 88%;
	}
}
