:root {
	--bg: #0f1824;
	--sidebar-bg: #17212b;
	--panel-bg: #1f2b38;
	--panel-light: #223142;
	--accent: #2a9df4;
	--accent-dark: #1f7cc4;
	--text: #f2f5fb;
	--muted: #93a5b9;
	--border: rgba(255, 255, 255, 0.08);
	--success: #3cc755;
	--danger: #ff5c5c;
	--font: "Inter", "Segoe UI", "Roboto", sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: radial-gradient(circle at top, #18212e, #0c121b 40%, #05070a);
	color: var(--text);
	font-family: var(--font);
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.app {
	width: 100%;
	max-width: 1400px;
	padding: 24px;
}

.hidden {
	display: none !important;
}

.login-panel {
	display: flex;
	align-items: center;
	justify-content: center;
}

.login-card {
	background: rgba(23, 33, 43, 0.95);
	backdrop-filter: blur(12px);
	padding: 48px;
	border-radius: 24px;
	width: min(420px, 90vw);
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
	text-align: center;
}

.login-card h1 {
	margin: 0;
	font-size: 32px;
	letter-spacing: 0.5px;
}

.login-subtitle {
	margin: 12px 0 32px;
	color: var(--muted);
}

.login-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
	text-align: left;
}

.login-form label span {
	display: block;
	margin-bottom: 6px;
	color: var(--muted);
	font-size: 14px;
}

.login-form input {
	width: 100%;
	padding: 14px 16px;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(31, 43, 56, 0.6);
	color: var(--text);
	font-size: 15px;
	outline: none;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.login-form input:focus {
	border-color: var(--accent);
	background: rgba(42, 157, 244, 0.08);
}

.primary-btn,
.secondary-btn,
.link-btn {
	cursor: pointer;
	border: none;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	padding: 12px 20px;
	transition: transform 0.1s ease, opacity 0.2s ease, background 0.2s ease;
}

.primary-btn {
	background: linear-gradient(135deg, var(--accent), #37b1ff);
	color: #fff;
	box-shadow: 0 6px 12px rgba(42, 157, 244, 0.25);
}

.primary-btn:hover {
	box-shadow: 0 7px 14px rgba(42, 157, 244, 0.3);
	opacity: 0.94;
}

.primary-btn:active {
	transform: translateY(1px);
}

.primary-btn.small {
	padding: 10px 16px;
	font-size: 14px;
}

.primary-btn.small-icon {
	padding: 0;
	width: 45px;
	height: 45px;
	font-size: 14px;
}

.secondary-btn {
	background: rgba(255, 255, 255, 0.08);
	color: var(--text);
}

.secondary-btn:hover {
	background: rgba(255, 255, 255, 0.14);
}

.secondary-btn.small {
	padding: 10px 16px;
	font-size: 14px;

	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.secondary-btn.small svg {
	width: 16px;
	height: 16px;
	vertical-align: middle;
}


.secondary-btn:disabled,
.primary-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.link-btn {
	background: none;
	color: var(--accent);
	padding: 0;
	font-size: 14px;
}

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

.error-text {
	margin-top: 16px;
	color: var(--danger);
	font-size: 14px;
}

.chat-panel {
	display: flex;
	gap: 0;
	height: 95vh;
	min-height: 540px;
	border-radius: 28px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
	background: rgba(23, 33, 43, 0.9);
	backdrop-filter: blur(16px);
}

.sidebar-overlay {
	position: fixed;
	inset: 0;
	background: rgba(6, 11, 19, 0.65);
	backdrop-filter: blur(2px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 70;
}

.sidebar {
	width: 32%;
	max-width: 380px;
	background: linear-gradient(180deg, rgba(25, 36, 48, 0.98), rgba(16, 23, 33, 0.98));
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--border);
}

.sidebar-header {
	padding: 24px;
	border-bottom: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.sidebar-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.08);
	border: none;
	color: var(--text);
	border-radius: 12px;
	padding: 8px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.sidebar-toggle:hover {
	background: rgba(255, 255, 255, 0.14);
}

.sidebar-toggle img {
	width: 22px;
	height: 22px;
	filter: invert(1);
}

.operator-info {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 14px;
}

.operator-name {
	font-weight: 600;
	color: #fff;
}

.conversation-heading {
	position: relative;
	display: flex;
	align-items: center;
	gap: 16px;
	width: 100%;
}

.search-box {
	display: flex;
	gap: 12px;
	/* flex-wrap: wrap; */
	align-items: center;
}

.search-box input {
	flex: 1;
	min-width: 200px;
	padding: 12px 14px;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(31, 43, 56, 0.6);
	color: var(--text);
	font-size: 14px;
	outline: none;
}

.search-box input:focus {
	border-color: var(--accent);
	background: rgba(42, 157, 244, 0.08);
}

#admin-btn,
.search-box .primary-btn {
	flex: 0 0 auto;
}

#admin-btn {
	flex: 0 0 auto;
	margin-right: 10px;
}

.ticket-list {
	flex: 1;
	overflow-y: auto;
	scrollbar-width: thin;
}

.ticket-item {
	padding: 18px 24px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	cursor: pointer;
	display: flex;
	flex-direction: column;
	gap: 8px;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.ticket-item:hover,
.ticket-item.active {
	background: rgba(42, 157, 244, 0.16);
}

.ticket-item.has-history {
	background: rgba(42, 157, 244, 0.08);
}

.ticket-item.active {
	background: rgba(42, 157, 244, 0.22);
}

.ticket-item.has-unread {
	border-left: 3px solid var(--accent);
	padding-left: 21px;
	background: rgba(42, 157, 244, 0.18);
}

.ticket-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.ticket-status-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 13px;
	color: var(--muted);
	flex-wrap: wrap;
}

.ticket-status-row span:last-child {
	margin-left: auto;
}

.ticket-title {
	font-weight: 600;
	color: #fff;
	flex: 1;
}

.ticket-item.has-unread .ticket-title {
	font-weight: 700;
	color: #fff;
}

.ticket-status {
	font-size: 12px;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.ticket-updated {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.5);
}

.unread-badge {
	background: var(--accent);
	color: #fff;
	border-radius: 999px;
	min-width: 22px;
	height: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 600;
	padding: 0 6px;
}

.ticket-remove {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.5);
	font-size: 18px;
	margin-left: 8px;
	cursor: pointer;
}

.ticket-remove:hover {
	color: #fff;
}

.ticket-load-more {
	padding: 16px 24px;
	display: flex;
	justify-content: center;
}

.ticket-item.new-message .ticket-title::after {
	content: "•";
	color: #ffcc29;
	margin-left: 6px;
}

.placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
	text-align: center;
	color: var(--muted);
	font-size: 14px;
	padding: 24px;
}

.conversation {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: rgba(20, 28, 39, 0.9);
}

.conversation-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding: 16px 18px;
	border-bottom: 1px solid var(--border);
	background: rgba(24, 34, 45, 0.8);
}

.conversation-title {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.conversation-header h2 {
	margin: 0;
	font-size: 22px;
}

.conversation-header .muted {
	margin-top: 6px;
	font-size: 14px;
	color: var(--muted);
}

.status-controls {
	display: flex;
	gap: 12px;
	align-items: center;
}

.status-controls select {
	padding: 10px 14px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(31, 43, 56, 0.6);
	color: var(--text);
	font-size: 14px;
}

.message-list {
	flex: 1;
	overflow-y: auto;
	padding: 24px 28px 12px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	scrollbar-width: thin;
}

.message {
	max-width: 70%;
	min-width: 15%;
	padding: 10px 12px;
	border-radius: 18px;
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.message-operator {
	margin-left: auto;
	background: linear-gradient(135deg, rgba(42, 157, 244, 0.95), rgba(82, 185, 255, 0.9));
	color: #fff;
	box-shadow: 0 4px 12px rgba(42, 157, 244, 0.35);
}

.message-client {
	margin-right: auto;
	background: rgba(31, 43, 56, 0.8);
	color: var(--text);
	border: 1px solid rgba(255, 255, 255, 0.04);
	display: flex;
	flex-direction: column;
}

.message-system {
	margin: 0 auto;
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
	padding: 12px 16px;
	border-radius: 12px;
}

.message-time {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.6);
}

.message-attachments {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.attachment-link {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 10px;
	padding: 10px 12px;
	color: inherit;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	transition: background 0.2s ease;
	border: none;
	cursor: pointer;
	font-size: 13px;
}

.attachment-link:hover {
	background: rgba(0, 0, 0, 0.35);
}

/* .composer {
	border-top: 1px solid var(--border);
	padding: 18px 24px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: rgba(24, 34, 45, 0.92);
}

.composer-body {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.composer textarea {
	width: 100%;
	resize: none;
	border-radius: 16px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(31, 43, 56, 0.65);
	padding: 14px 18px;
	font-size: 15px;
	color: var(--text);
	min-height: 52px;
	font-family: var(--font);
}

.composer textarea:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}
*/
.composer-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	background: rgba(17, 24, 34, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 14px;
	padding: 10px 12px;
}

.composer-attachments.hidden {
	display: none;
}

.composer-attachment {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: rgba(42, 157, 244, 0.12);
	border-radius: 12px;
	padding: 8px 12px;
	font-size: 13px;
	color: var(--text);
	border: 1px solid rgba(255, 255, 255, 0.05);
}

.composer-attachment button {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.7);
	cursor: pointer;
	font-size: 14px;
}

.composer-attachment button:hover {
	color: #fff;
}

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

.composer {
	border-top: 1px solid var(--border);
	padding: 14px 18px;
	background: rgba(24, 34, 45, 0.92);
	display: flex;
	flex-direction: column;
	gap: 10px;
	/* justify-content: center; */
	/* align-items: center; */
}

.composer-row {
	display: flex;
	align-items: flex-end;
	gap: 10px;
}


.composer textarea {
	flex: 1;
	resize: none;
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(31, 43, 56, 0.65);
	padding: 12px 14px;
	font-size: 15px;
	color: var(--text);
	min-height: 42px;
	max-height: 200px;
	line-height: 1.4;
	overflow-y: hidden;
	font-family: var(--font);
	transition: height 0.2s ease;
	display: flex;
	align-items: center;
	/* визуально текст не липнет к верхнему краю */
}


.file-input span,
.send-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 47px;
	height: 47px;
	border: none;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.08);
	color: var(--text);
	cursor: pointer;
	transition: background 0.15s;
}

.file-input span:hover,
.send-btn:hover {
	background: rgba(255, 255, 255, 0.15);
}

.composer-attachments {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	background: rgba(17, 24, 34, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 12px;
	padding: 10px 12px;
}

.composer-attachments.hidden {
	display: none;
}

.file-input {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.0);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 20px;
}

.file-input input {
	display: none;
}

.file-input span {
	display: flex;
}

.composer-actions label:hover {
	background: rgba(255, 255, 255, 0.14);
}

.message-attachments {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: 320px;
	align-items: stretch;
	/* чтобы картинки тянулись по ширине контейнера */
}

.message-bubble.has-attachments {
	align-self: flex-start;
	/* чтобы такой пузырь не растягивался до 100% */
	width: auto;
	max-width: 320px;
}

.message-attachments a {
	display: block;
	line-height: 0;
}

.message-attachments img,
.message-attachments video {
	max-width: min(320px, 100%);
	width: 100%;
	height: auto;
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(0, 0, 0, 0.25);
}

.message-attachments img {
	cursor: zoom-in;
}

.message-meta {
	margin-top: 6px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: rgba(255, 255, 255, 0.6);
}

.message-meta span + span::before {
	content: "•";
	margin: 0 6px;
	color: rgba(255, 255, 255, 0.4);
}

.message-author {
	font-weight: 600;
}

.message-attachments audio {
	width: min(320px, 100%);
}

.message-attachments .attachment-link {
	align-self: flex-start;
}

.load-more-container {
	display: flex;
	justify-content: center;
	margin-bottom: 12px;
}

#message-input {
	outline: none;
}

.image-viewer {
	position: fixed;
	inset: 0;
	background: rgba(6, 10, 18, 0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	z-index: 120;
}

.image-viewer.hidden {
	display: none;
}

.image-viewer-content {
	position: relative;
	width: min(100%, 980px);
	max-height: calc(100vh - 48px);
}

.image-viewer-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 12px;
	box-shadow: 0 25px 65px rgba(0, 0, 0, 0.55);
}

.image-viewer-close {
	position: absolute;
	top: -16px;
	right: -16px;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: none;
	background: rgba(16, 24, 36, 0.92);
	color: #fff;
	font-size: 22px;
	cursor: pointer;
	box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
}

.toast {
	position: fixed;
	right: 24px;
	bottom: 24px;
	padding: 14px 18px;
	background: rgba(15, 22, 32, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 14px;
	box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
	color: var(--text);
	font-size: 14px;
	min-width: 220px;
	max-width: 320px;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 100;
	text-align: center;
}

.toast.show {
	opacity: 1;
	transform: translateY(0);
}

.modal {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 110;
}

.modal:not(.hidden) {
	display: flex;
}

.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(5, 7, 12, 0.7);
	backdrop-filter: blur(8px);
}

.modal-dialog {
	position: relative;
	width: min(420px, 92vw);
	max-height: 80vh;
	background: rgba(26, 36, 48, 0.95);
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	color: var(--text);
}

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

.modal-header h3 {
	margin: 0;
	font-size: 18px;
}

.modal-body {
	overflow-y: auto;
	max-height: calc(70vh - 60px);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.modal-option {
	border-radius: 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(28, 39, 52, 0.6);
	padding: 14px 16px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
	text-align: left;
	color: inherit;
}

.modal-option:hover {
	background: rgba(42, 157, 244, 0.18);
	border-color: rgba(42, 157, 244, 0.4);
}

.modal-option-title {
	font-weight: 600;
	font-size: 15px;
}

.modal-option-meta {
	font-size: 13px;
	color: var(--muted);
}

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

.broadcast-status.success {
	color: var(--success);
}

.broadcast-status.error {
	color: var(--danger);
}

.admin-panel {
	position: fixed;
	inset: 0;
	background: rgba(5, 7, 12, 0.72);
	backdrop-filter: blur(18px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 90;
	padding: 24px;
}

.admin-card {
	width: min(920px, 95vw);
	max-height: 90vh;
	background: rgba(19, 28, 38, 0.95);
	border-radius: 28px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
	display: flex;
	flex-direction: column;
}

.admin-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 24px 28px;
	border-bottom: 1px solid var(--border);
}

.admin-card-header h2 {
	margin: 0;
	font-size: 22px;
}

.close-btn {
	background: rgba(255, 255, 255, 0.08);
	border: none;
	color: var(--text);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
}

.admin-tabs {
	display: flex;
	gap: 12px;
	padding: 16px 28px 0;
}

.admin-tab {
	border: none;
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
	padding: 10px 18px;
	border-radius: 12px;
	cursor: pointer;
	font-weight: 600;
}

.admin-tab.active {
	background: linear-gradient(135deg, var(--accent), #37b1ff);
	box-shadow: 0 6px 12px rgba(42, 157, 244, 0.3);
}

.admin-section {
	padding: 24px 28px 32px;
	overflow-y: auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.admin-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
	padding: 18px;
	border-radius: 20px;
	background: rgba(28, 39, 52, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.05);
}

.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
}

.form-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
}

.form-row.end {
	justify-content: flex-end;
}

.admin-form label span {
	display: block;
	margin-bottom: 6px;
	color: var(--muted);
	font-size: 13px;
}

.admin-form input[readonly] {
	background: rgba(255, 255, 255, 0.05);
	color: var(--muted);
	cursor: text;
}

.admin-form input,
.admin-form textarea {
	width: 100%;
	padding: 12px 14px;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(24, 35, 47, 0.7);
	color: var(--text);
	font-size: 14px;
	outline: none;
	resize: vertical;
}

.admin-form textarea {
	min-height: 82px;
}

.checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--muted);
}

.checkbox input {
	width: 18px;
	height: 18px;
}

.admin-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.admin-item {
	padding: 16px 18px;
	border-radius: 18px;
	background: rgba(26, 36, 48, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.05);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.admin-item-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.admin-item-title {
	font-size: 16px;
	font-weight: 600;
}

.admin-item-subtitle {
	color: var(--muted);
	font-size: 13px;
	word-break: break-all;
}

.admin-item-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	font-size: 12px;
	color: var(--muted);
	text-transform: uppercase;
}

@media (max-width: 1100px) {
	.chat-panel {
		flex-direction: column;
		height: auto;
		min-height: 100vh;
		border-radius: 0;
	}

	.sidebar {
		width: 100%;
		max-width: none;
		border-right: none;
		border-bottom: 1px solid var(--border);
	}

	.conversation {
		height: calc(100vh - 280px);
	}

	.admin-panel {
		padding: 16px;
	}

	.admin-card {
		width: 100%;
		max-height: 100%;
	}
}

@media (max-width: 900px) {
	body {
		align-items: stretch;
	}

	.app {
		padding: 0;
		max-width: none;
	}

	.admin-panel {
		z-index: 1000;
	}

	.chat-panel {
		position: relative;
		height: 100vh;
		min-height: 100vh;
		border-radius: 0;
	}

	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: min(360px, 80vw);
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		border-right: 1px solid var(--border);
		background: var(--background);
		z-index: 100;
		/* чтобы не перекрывалась */
	}

	.sidebar-overlay {
		position: fixed;
		top: 0;
		left: 0;
		width: 100vw;
		height: 100vh;
		background: rgba(0, 0, 0, 0.4);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.3s ease;
		z-index: 90;
		/* ниже сайдбара */
	}

	body.sidebar-open .sidebar {
		transform: translateX(0);
	}

	body.sidebar-open .sidebar-overlay {
		opacity: 1;
		pointer-events: all;
	}

	.sidebar-toggle {
		display: inline-flex !important;
		/* z-index: 200; */
		/* поверх всего, чтобы не пропадала */
		cursor: pointer;
	}

	body.sidebar-open {
		overflow: hidden;
	}

	/* === FIX BLUR AND SIDEBAR BEHAVIOR === */
	.chat-panel {
		background: #17212b;
		/* сплошной фон без прозрачности */
		backdrop-filter: none;
	}

	.sidebar-overlay {
		background: rgba(0, 0, 0, 0.45);
		backdrop-filter: none;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.3s ease;
		z-index: 90;
	}

	body.sidebar-open .sidebar-overlay {
		opacity: 1;
		pointer-events: all;
	}

	.sidebar {
		background: #1a2533;
		/* убираем rgba-прозрачность */
		backdrop-filter: none;
	}

	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: min(360px, 80vw);
		transform: translateX(-100%);
		transition: transform 0.3s ease;
		border-right: 1px solid var(--border);
		background: #1a2533;
		z-index: 100;
		overflow-y: auto;
		/* вот это важно */
		-webkit-overflow-scrolling: touch;
		/* плавная прокрутка на мобилках */
	}
}

@media (max-width: 720px) {
	body {
		align-items: stretch;
	}

	.app {
		padding: 0;
	}

	.login-card {
		padding: 32px 28px;
		border-radius: 0;
		height: 100vh;
		justify-content: center;
	}

	.chat-panel {
		height: 100vh;
	}

	.conversation-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}

	.status-controls {
		width: 100%;
	}

	.status-controls select {
		flex: 1;
	}

	.message {
		max-width: 90%;
	}

	.admin-panel {
		padding: 12px;
		align-items: flex-start;
	}

	.admin-card {
		border-radius: 18px;
	}

	.image-viewer {
		padding: 12px;
	}

	.image-viewer-content {
		max-width: 100vw;
		max-height: 100vh;
	}

	.image-viewer-close {
		top: 8px;
		right: 8px;
	}
}

.archive-content {
	padding: 16px;
}

#archive-btn {
	margin-right: 10px;
}

.archive-search {
	margin-bottom: 16px;
}

.archive-list {
	max-height: 60vh;
	overflow-y: auto;
	padding-right: 8px;
}

.archive-list::-webkit-scrollbar {
	width: 8px;
}

.archive-list::-webkit-scrollbar-track {
	background: var(--panel-bg);
	border-radius: 4px;
}

.archive-list::-webkit-scrollbar-thumb {
	background: var(--panel-light);
	border-radius: 4px;
}

.archive-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px;
	background: var(--panel-bg);
	border-radius: 8px;
	margin-bottom: 8px;
}

.archive-item:last-child {
	margin-bottom: 0;
}

.archive-item-info {
	flex: 1;
}

.archive-item-title {
	font-weight: 500;
	margin-bottom: 4px;
}

.archive-item-meta {
	color: var(--muted);
	font-size: 0.9em;
}

.archive-item-actions {
	margin-left: 16px;
}

.restore-btn {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.2s;
}

.restore-btn:hover {
	opacity: 1;
}

.restore-btn img {
	width: 20px;
	height: 20px;
}
