/* styles.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    touch-action: pan-x pan-y pinch-zoom;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* ===== Милый светлый тема: переменные и базовые акценты ===== */
:root {
    --bg-base: #f7f9fc;
    --bg-card: #ffffff;
    --text-base: #2b2d42;
    --text-muted: #6c757d;
    --primary: #6366f1; /* индиго */
    --primary-strong: #4f46e5;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e5e7eb;
    --shadow: 0 6px 18px rgba(0,0,0,0.08);
    --radius: 10px;
}

body {
	background: linear-gradient(180deg, #fbfdff 0%, var(--bg-base) 100%);
	color: var(--text-base);
}

/* Контейнеры-карточки: чуть больше скругления и тени */
.preview-container,
.pdf-page-container,
.search-result-item,
.comment,
.xlsx-preview,
.docx-preview {
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	background: var(--bg-card);
	border: 1px solid var(--border);
}

/* Режим "только линии" для PDF */
.pdf-page-container.lines-only,
.pdf-page.lines-only {
	background: transparent;
}

.pdf-page-container.lines-only img,
.pdf-page.lines-only img {
	background: transparent;
}

#pdf-viewer {
	background: #f5f5f5;
}

/* 3D режим просмотра PDF */
#pdf-viewer.pdf-3d-viewer {
	perspective: 2000px;
	perspective-origin: center center;
	overflow: hidden;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	cursor: grab;
}

#pdf-viewer.pdf-3d-viewer:active {
	cursor: grabbing;
}

.pdf-pages-container.pdf-3d-view {
	transform-style: preserve-3d;
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	transform-origin: center center;
	transition: transform 0.1s ease-out;
}

.pdf-3d-view .pdf-page-container,
.pdf-3d-view .pdf-page {
	transform-style: preserve-3d;
	backface-visibility: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	border-radius: 4px;
	background: transparent !important;
}

.pdf-3d-view .pdf-page-container img,
.pdf-3d-view .pdf-page img {
	background: transparent !important;
	display: block;
	border-radius: 4px;
}

/* Шапки/бейджи с приглушёнными цветами */
.version-info,
.page-info,
.preview-header {
	border-color: var(--border);
	background: #f5f7fb;
	color: var(--text-muted);
}

/* Унификация кнопок: мягкие, округлые, с плавным hover */
.btn,
.action-button,
#search-button,
#copy-link-button,
#apply-stamp-button,
.download-file-btn,
.manage-links-btn,
.link-email-file-btn,
.show-email-links-btn,
.remove-link-btn,
.approve-file-btn,
.reject-file-btn {
	background: var(--bg-card);
	color: var(--text-base);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.06);
	transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn:hover,
.action-button:hover,
#search-button:hover,
#copy-link-button:hover,
#apply-stamp-button:hover,
.download-file-btn:hover,
.manage-links-btn:hover,
.link-email-file-btn:hover,
.show-email-links-btn:hover,
.remove-link-btn:hover,
.approve-file-btn:hover,
.reject-file-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 16px rgba(0,0,0,0.08);
	background: #f6f8fc;
}

/* Акцентные кнопки */
.btn-primary,
.rendering-toggle-btn,
.copy-text-btn,
.download-text-btn {
	background: var(--primary);
	color: #fff;
	border: none;
}

.btn-primary:hover,
.rendering-toggle-btn:hover,
.copy-text-btn:hover,
.download-text-btn:hover {
	background: var(--primary-strong);
}

.btn-success { background: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-secondary { background: #8b93a6; color: #fff; border: none; }
.btn-secondary:hover { background: #6b7280; }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; }

/* Дерево папок и таблица файлов — более спокойные цвета */
.files-table-header {
	background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
	border-bottom: 1px solid var(--border);
}

.file-row:hover { background-color: #f3f6fb; }
.file-row.active { background-color: #eef2ff !important; border-left: 4px solid var(--primary) !important; }

/* Локальные DPI‑контролы как компактный «чип» в правом верхнем углу */
.dpi-controls {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	backdrop-filter: saturate(180%) blur(6px);
	z-index: 5;
}

.dpi-controls .btn {
	background: var(--primary);
	color: #fff;
	border: none;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 12px;
}

.dpi-controls .btn:hover { background: var(--primary-strong); }
.dpi-controls .dpi-value { color: var(--text-muted); font-weight: 600; font-size: 12px; }

/* Улучшение читаемости меток и бейджей */
.unviewed-badge,
.file-count-badge {
	box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Верхняя панель и поиск — мягкая подложка */
.auth-bar { background: #ffffff; border-bottom: 1px solid var(--border); }
.controls { background: #fbfcfe; border-bottom: 1px solid var(--border); }
.search-container input[type="text"],
#search-text-input,
#stamp-text {
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #ffffff;
}

/* Подсветка активных областей PDF */
.pdf-page-container:hover { box-shadow: 0 10px 24px rgba(0,0,0,0.08); }
.pdf-page-container.zoomed { border-color: var(--primary); box-shadow: 0 8px 24px rgba(99,102,241,0.25); }

/* Индикатор зума — приглушённые тона */
.zoom-indicator { background: rgba(99,102,241,0.92); }

/* Красивые стили для заголовков */
h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    margin: 0 0 10px 0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

h2::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

h2:hover::before {
    left: 100%;
}

h2:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Специальные стили для разных заголовков */
.sidebar h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 14px;
    padding: 4px 8px;
    height: 20px;
    margin-top: -4px;
}

.content h2 {
    background: transparent;
    box-shadow: none;
    color: #333;
    font-size: 14px;
    padding: 0;
    height: auto;
    margin: 0 0 8px 0;
}

.preview h2 {
    background: transparent;
    box-shadow: none;
    color: #333;
    font-size: 14px;
    padding: 0;
    height: auto;
    margin: 0 0 8px 0;
}

.auth-bar {
    background-color: white;
    color: #333;
    padding: 10px;
    text-align: right;
    font-size: 14px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-bar a {
    color: #007bff;
    text-decoration: none;
    margin-left: 10px;
    transition: color 0.2s;
}

.auth-bar a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.container {
    display: flex;
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.sidebar {
    width: 15%;
    min-width: 180px;
    max-width: 300px;
    background-color: #f4f4f4;
    padding: 8px 10px;
    border-right: 1px solid #ccc;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    max-height: 100%;
    flex-shrink: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
}

/* Кастомный вертикальный скроллбар для sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
    background: #f4f4f4;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #b0b7c3;
}

.content {
    width: 25%;
    min-width: 300px;
    padding: 12px 10px;
    border-right: 1px solid #ccc;
    overflow-y: auto;
    flex-shrink: 0;
}

.preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 20px;
    overflow: hidden;
    min-width: 0;
    max-width: 75%;
}

.preview-container {
    position: relative;
    width: 100%;
    height: 800px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    background: #f5f5f5;
    overflow: hidden;
}

.preview-container img,
.preview-container iframe {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.comment-section {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    padding: 20px;
    border-left: 1px solid #ccc;
    background-color: white;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.comment-section .close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.comment-section .close-button:hover {
    background: #c82333;
}

.comment-section textarea {
    flex: 1;
    margin-bottom: 10px;
}

.comment-section button {
    padding: 5px 10px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.comment-section button:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
}

.comments-list p {
    margin: 5px 0;
    padding: 5px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
}

/* Стили для статусов */
.status {
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    margin-left: 10px;
}

.status-new {
    background-color: #d4edda; /* Зеленый */
    color: #155724;
}

.status-correction {
    background-color: #fff3cd; /* Желтый */
    color: #856404;
}

.status-production {
    background-color: #cce5ff; /* Синий */
    color: #004085;
}

.status-dropdown {
    width: 100%;
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background-color: white;
    font-size: 0.9em;
}

.status-dropdown:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.status-корректировка {
    background-color: #fff3cd;
    color: #856404;
}

.status-в-производство-работ {
    background-color: #cce5ff;
    color: #004085;
}

.status-архив {
    background-color: #f8d7da;
    color: #721c24;
}

.file {
    padding: 2px;
    margin: 2px 0;
    border-radius: 3px;
}

.file-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.file-name {
    cursor: pointer;
    padding: 2px 0;
    flex-grow: 1;
}

.file:hover {
    background-color: #f8f9fa;
}

.controls {
    display: flex;
    gap: 12px;
    margin: 10px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
    flex-wrap: wrap;
}

.controls button:not(.action-button) {
    padding: 8px 16px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.controls button:not(.action-button):hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Иконки без прямоугольников в шапке */
.controls #add-folder,
.controls #upload-file,
.controls #copy-link-button,
.controls #material-request-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px !important;
}

.controls #add-folder:hover,
.controls #upload-file:hover,
.controls #copy-link-button:hover,
.controls #material-request-btn:hover {
    background: transparent !important;
    box-shadow: none !important;
}

.controls #copy-link-button {
    font-size: 18px;
}

/* Дополнительно убираем прямоугольники у остальных иконок-кнопок */
.controls #search-button,
.controls #apply-stamp-button,
.controls #extract-text-button,
.controls #search-text-button,
.controls .object-status-btn,
.controls #calendar-button,
.controls #messages-button,
.controls #tracker-search-button,
.controls #tracker-search-simple-button {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px !important;
}

.controls #search-button:hover,
.controls #apply-stamp-button:hover,
.controls #extract-text-button:hover,
.controls #search-text-button:hover,
.controls .object-status-btn:hover,
.controls #calendar-button:hover,
.controls #messages-button:hover,
.controls #tracker-search-button:hover,
.controls #tracker-search-simple-button:hover {
    background: transparent !important;
    box-shadow: none !important;
}

/* Убираем фон для кнопок поиска в трекере */
#tracker-search-button,
#tracker-search-simple-button {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    filter: grayscale(100%) opacity(0.5) !important;
    transition: all 0.2s !important;
}

#tracker-search-button:hover,
#tracker-search-simple-button:hover {
    background: none !important;
    box-shadow: none !important;
    transform: scale(1.1) !important;
    filter: grayscale(100%) opacity(0.7) !important;
}

/* Минималистичные серые значки для всех кнопок */
.controls .action-button,
.controls #search-button,
.controls #add-folder,
.controls #upload-file,
.controls #copy-link-button,
.controls #share-button,
.controls #my-tasks-button,
.controls #apply-stamp-button,
.controls #extract-text-button,
.controls #search-text-button,
.controls .object-status-btn,
.controls #calendar-button,
.controls #messages-button {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 6px !important;
    transition: all 0.2s !important;
}

.controls .action-button:hover,
.controls #search-button:hover,
.controls #add-folder:hover,
.controls #upload-file:hover,
.controls #copy-link-button:hover,
.controls #share-button:hover,
.controls #my-tasks-button:hover,
.controls #apply-stamp-button:hover,
.controls #extract-text-button:hover,
.controls #search-text-button:hover,
.controls .object-status-btn:hover,
.controls #calendar-button:hover,
.controls #messages-button:hover {
    background: transparent !important;
    box-shadow: none !important;
    transform: scale(1.1) !important;
}

.controls .action-button .button-icon,
.controls #search-button,
.controls #add-folder .button-icon,
.controls #upload-file .button-icon,
.controls #copy-link-button .button-icon,
.controls #share-button .button-icon,
.controls #my-tasks-button .button-icon,
.controls #apply-stamp-button .button-icon,
.controls #extract-text-button .button-icon,
.controls #search-text-button .button-icon,
.controls .object-status-btn,
.controls #calendar-button .button-icon,
.controls #messages-button .button-icon {
    filter: grayscale(100%) opacity(0.5);
}

.controls .action-button:hover .button-icon,
.controls #search-button:hover,
.controls #add-folder:hover .button-icon,
.controls #upload-file:hover .button-icon,
.controls #copy-link-button:hover .button-icon,
.controls #share-button:hover .button-icon,
.controls #my-tasks-button:hover .button-icon,
.controls #apply-stamp-button:hover .button-icon,
.controls #extract-text-button:hover .button-icon,
.controls #search-text-button:hover .button-icon,
.controls .object-status-btn:hover,
.controls #calendar-button:hover .button-icon,
.controls #messages-button:hover .button-icon {
    filter: grayscale(100%) opacity(0.7);
}

/* Бейджи остаются цветными */
#calendar-badge,
#unread-messages-badge {
    filter: none !important;
    background: #dc3545 !important;
    color: white !important;
}

/* Иконка согласований серая */
.approval-icon {
    filter: grayscale(100%) opacity(0.5);
    transition: all 0.2s;
}

#show-approvals-toggle:checked + .approval-icon,
.approval-icon:hover {
    filter: grayscale(100%) opacity(0.7);
}

/* Стили для кнопок переключения вида отображения */
.view-mode-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    transition: all 0.2s ease;
    filter: grayscale(100%);
    opacity: 0.5;
}

.view-mode-btn.active {
    opacity: 1;
    filter: grayscale(100%);
}

/* Кнопка "Дерево" всегда зеленая */
.view-mode-btn.tree-view-btn {
    filter: none !important;
}

.view-mode-btn:hover {
    opacity: 0.7;
}

/* Стили для кнопок отправки сообщений */
.message-send-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 12px;
    transition: all 0.2s ease;
    filter: grayscale(100%);
    opacity: 0.8;
}

.message-send-btn:hover {
    opacity: 1;
    filter: grayscale(100%);
}

.message-send-btn:active {
    transform: scale(0.95);
}

.controls .object-status-btn {
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#stamp-text {
    padding: 6px;
    margin: 0 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#apply-stamp-button {
    padding: 6px 12px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#apply-stamp-button:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.folder.active {
    background-color: #d1ecf1; /* светло-голубой */
    color: #0c5460;
    font-weight: bold;
    border-radius: 4px;
    padding-left: 2px;
}

.image-upload-container {
    margin: 10px 0;
}

#upload-image-btn {
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    padding: 5px 10px;
    cursor: pointer;
    margin-bottom: 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#upload-image-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#image-preview {
    position: relative;
    display: inline-block;
    margin: 10px 0;
}

#remove-image-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#remove-image-btn:hover {
    background-color: #c82333;
}

.comment-item {
    margin: 10px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.comment-item img {
    display: block;
    margin-top: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bulk-status-section {
    margin-top: 15px;
    padding: 10px;
    border-top: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bulk-status-label {
    font-size: 0.9em;
    color: #6c757d;
    white-space: nowrap;
}

.bulk-status-select {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    min-width: 150px;
}

.apply-bulk-status-btn {
    padding: 4px 12px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.apply-bulk-status-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.apply-bulk-status-btn:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    box-shadow: none;
}

ul {
    padding-left: 5px; /* Уменьшенный отступ для вложенных списков */
    margin-bottom: 5px; /* Уменьшенный отступ снизу для всего списка */
}

li {
    padding-left: 5px; /* Уменьшенный отступ для вложенных списков */
    margin-bottom: 5px; /* Отступ между пунктами одного уровня */
}

/* Убираем маркеры списка для файлов и папок в содержимом папки */
.folder, .file {
    list-style: none;
}

/* Дополнительно уменьшаем отступы для содержимого папки */
#folder-content {
    padding-left: 0;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
}

#folder-content li {
    padding-left: 2px;
}

/* Стили для PDF просмотра и аннотаций */
/* Убраны элементы управления масштабом */

/* Стили для предпросмотра различных типов файлов */
.preview-header {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.2rem;
}

.preview-info {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #6c757d;
}

.preview-info span {
    background: white;
    padding: 4px 8px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

.preview-actions {
    display: flex;
    gap: 10px;
}

.preview-actions .btn {
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* Стили для DOCX предпросмотра */
.docx-preview {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.docx-content {
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

.docx-content h1, .docx-content h2, .docx-content h3 {
    color: #2c3e50;
    margin-top: 20px;
    margin-bottom: 10px;
}

.docx-content p {
    margin-bottom: 10px;
}

.docx-content ul, .docx-content ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

/* Стили для XLSX предпросмотра */
.xlsx-preview {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.xlsx-content {
    padding: 20px;
    overflow-x: auto;
}

.table-container {
    min-width: 100%;
}

.xlsx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.xlsx-table th,
.xlsx-table td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

.xlsx-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.xlsx-table tr:nth-child(even) {
    background: #f8f9fa;
}

.xlsx-table tr:hover {
    background: #e9ecef;
}

/* Стили для предпросмотра изображений */
.image-preview {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.image-content {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
}

.image-content img {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Убраны адаптивные стили для мобильных устройств - все устройства работают одинаково */

#pdf-viewer {
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

.pdf-pages-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

.pdf-page {
    position: relative;
    margin: 0 auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    touch-action: pan-x pan-y;
}

.pdf-page canvas {
    display: block;
    max-width: 1000%;
    height: auto;
}

.annotation {
    position: absolute;
    background: rgba(255, 255, 0, 0.2);
    border: 1px solid #ffd700;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 16px;
    color: #000;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.annotation.viewed {
    background: rgba(144, 238, 144, 0.3);
    border: 1px solid #90ee90;
    color: #2d5a2d;
}

.annotation:hover {
    background: rgba(255, 255, 0, 0.3);
    z-index: 1000;
}

.annotation.viewed:hover {
    background: rgba(144, 238, 144, 0.4);
    z-index: 1000;
}

/* Общие стили для модальных окон */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.annotation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.close {
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    background: none;
    border: none;
    transition: color 0.2s;
}

.close:hover {
    color: #000;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 80px;
}

.form-group select[multiple] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 100px;
}

.form-group select[multiple] option {
    padding: 4px 8px;
    margin: 1px 0;
    border-radius: 2px;
}

.form-group select[multiple] option:checked {
    background-color: #007bff;
    color: white;
}

.form-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

.position-info {
    display: flex;
    gap: 15px;
    margin-top: 5px;
    font-size: 14px;
    color: #666;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* Стили для комментариев */
.comment {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.comment-header {
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.comment-content {
    margin-bottom: 10px;
}

.comment-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Windows Explorer-like folder tree styles */
#folder-tree {
    list-style: none;
    padding: 0;
    margin: 0;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
}

.folder-item {
    margin: 0;
    padding: 0;
}

.folder-container {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: default;
    border-radius: 3px;
    transition: background-color 0.2s;
    gap: 2px;
}

.folder-container:hover {
    background-color: #f0f0f0;
}

.folder-container.active {
    background-color: #e3f2fd;
    color: #1976d2;
}

.expand-button {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    text-align: center !important;
    line-height: 16px !important;
    font-size: 12px !important;
    color: #666 !important;
    cursor: pointer !important;
    user-select: none;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    margin-right: 2px;
    border-radius: 2px;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 16px;
}

.expand-button:hover {
    color: #1976d2 !important;
    background-color: #e3f2fd;
    transform: scale(1.1);
}

.expand-button:active {
    transform: scale(0.95);
}

.expand-button[style*="display: none"] {
    display: none !important;
}

.folder-icon {
    margin: 0 2px;
    font-size: 14px;
    flex-shrink: 0;
}

.folder-icon svg {
    width: 14px;
    height: 14px;
}

.folder-name {
    margin-left: 2px;
    font-size: 13px;
    flex: 1;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Позволяет flex-элементу сжиматься */
    display: inline-block;
    transition: transform 0.5s ease-in-out;
    transform-origin: left center;
    position: relative;
}

.folder-name:hover {
    color: #1976d2;
    text-decoration: underline;
}

/* Автоматическая прокрутка текста при наведении - один раз до конца */
.folder-name.text-scrolling {
    animation: scroll-text-once 2s ease-in-out forwards;
    text-overflow: clip;
    will-change: transform;
    overflow: visible; /* Показываем переполнение при прокрутке */
    z-index: 100;
    background: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

@keyframes scroll-text-once {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(var(--scroll-amount, 0));
    }
}

/* Убрали кастомный tooltip - используем стандартный браузерный через title attribute */

.folder-name-container {
    gap: 2px !important;
    min-width: 0;
    flex: 1;
    overflow: hidden; /* Скрываем переполнение по умолчанию */
    position: relative;
}

/* При наведении на контейнер с обрезанным текстом показываем прокручиваемый текст */
.folder-name-container:hover {
    overflow: visible; /* Показываем переполнение при наведении */
    z-index: 10;
}

.folder-children {
    list-style: none;
    padding-left: 16px;
    margin: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.folder-children:not([style*="block"]) {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.folder-children[style*="block"],
.folder-children.expanded {
    max-height: 5000px;
    opacity: 1;
    padding-top: 1px;
    padding-bottom: 1px;
}

/* Action buttons styles */
.action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.action-button:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.action-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-icon {
    font-size: 16px;
}

.button-text {
    font-weight: 500;
}

.file-version {
    font-size: 0.8em;
    color: #666;
    margin: 0 10px;
    display: inline-block;
}

.version-select {
    padding: 2px 6px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
    color: #333;
    cursor: pointer;
}

.version-select:hover {
    background-color: #e8e8e8;
}

.version-select option {
    padding: 4px;
}

.unviewed-badge {
    background-color: transparent;
    color: #dc3545;
    border-radius: 0;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: bold;
    min-width: 14px;
    height: 14px;
    text-align: center;
    display: none;
    line-height: 12px;
    flex-shrink: 0;
}

/* Бейдж "Внимание" с плавным переливом */
.attention-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    background: linear-gradient(90deg, #ff4d4f, #ff9800, #ffc107, #ff4d4f);
    background-size: 300% 100%;
    animation: attentionPulse 2.2s ease-in-out infinite;
}

@keyframes attentionPulse {
    0% { background-position: 0% 50%; box-shadow: 0 0 6px rgba(255,77,79,0.6); }
    50% { background-position: 100% 50%; box-shadow: 0 0 12px rgba(255,152,0,0.8); }
    100% { background-position: 0% 50%; box-shadow: 0 0 6px rgba(255,77,79,0.6); }
}

/* Бейдж для непрочитанных сообщений в папках */
.messages-badge {
    display: inline-block;
    min-width: 20px;
    height: 14px;
    padding: 1px 4px;
    border-radius: 10px;
    background-color: #17a2b8;
    color: white;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    line-height: 12px;
    margin-left: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.unviewed-badge.inspection {
    background-color: transparent;
    color: #007bff;
}

.unviewed-badge.default {
    background-color: transparent;
    color: #dc3545;
}

.file-count-badge {
    background-color: transparent;
    color: #28a745;
    border: none;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    margin-left: 5px;
    display: none;
}

/* Стили для заголовка комментариев */
.comment-section h3 {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    padding: 12px 15px;
    margin: 0 0 15px 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 3px 10px rgba(250, 112, 154, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.comment-section h3::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.comment-section h3:hover::before {
    left: 100%;
}

.comment-section h3:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.4);
}

/* Стили для заголовка в модальном окне */
.modal-content h3 {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
    padding: 12px 15px;
    margin: -20px -20px 20px -20px;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(168, 237, 234, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.modal-content h3::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.modal-content h3:hover::before {
    left: 100%;
}

/* Стили для заголовка h4 в списке пользователей */
.access-list h4 {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #333;
    padding: 10px 12px;
    margin: 15px 0 10px 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 6px rgba(252, 182, 159, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.access-list h4::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.access-list h4:hover::before {
    left: 100%;
}

.access-list h4:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(252, 182, 159, 0.4);
}

/* Стили для заголовка в результатах поиска */
#folder-content h3 {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #333;
    padding: 12px 15px;
    margin: 0 0 15px 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 3px 10px rgba(255, 154, 158, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#folder-content h3::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

#folder-content h3:hover::before {
    left: 100%;
}

#folder-content h3:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
}

.linked-files-icon {
    margin-left: 8px;
    color: #007bff;
    font-size: 14px;
    vertical-align: middle;
    cursor: pointer;
}
.linked-files-icon:hover {
    text-decoration: underline;
    color: #0056b3;
}
.linked-files-popup {
    position: fixed;
    background: #fff;
    border: 1px solid #007bff;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 12px 18px;
    z-index: 9999;
    min-width: 180px;
    font-size: 15px;
    color: #222;
}
.linked-files-popup ul {
    margin: 0;
    padding-left: 18px;
}
.linked-files-popup li {
    margin-bottom: 4px;
}
.linked-files-popup a {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}
.linked-files-popup a:hover {
    color: #0056b3;
}

.linked-files-popup .download-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s;
    margin-left: 5px;
}

.linked-files-popup .download-file-btn:hover {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.manage-links-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
}
.manage-links-modal .modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 24px 32px;
    min-width: 320px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}
.remove-link-btn {
    margin-left: 8px;
    color: #dc3545;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
}
.remove-link-btn:hover {
    color: #a71d2a;
}

.manage-links-modal .download-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s;
    margin-left: 5px;
}

.manage-links-modal .download-file-btn:hover {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

/* Стили для табличного отображения файлов */
.files-table-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.files-table-header {
    display: grid;
    /* По умолчанию 7 колонок БЕЗ версии: Имя, Дата, Размер, Статус, Загрузил, Трекер, Заметки */
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 12px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* С отображением версии - 8 колонок */
body.show-version-column .files-table-header {
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

/* Вариант без столбца "Задача в Трекер" (6 колонок без версии, 7 с версией) */
.files-table-header.no-tracker {
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

body.show-version-column .files-table-header.no-tracker {
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

.header-cell {
    padding: 6px 8px;
    border-right: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-cell:hover {
    background-color: #e9ecef;
}

.header-cell:last-child {
    border-right: none;
}

.folders-container {
    border-bottom: 1px solid #dee2e6;
}

.folder-item-list {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
    min-height: 28px;
}

.folder-item-list:hover {
    background-color: #f8f9fa;
}

.folder-item-list .folder-icon {
    margin-right: 8px;
    font-size: 16px;
}

.folder-item-list .folder-name {
    font-weight: 500;
    color: #495057;
}

/* Стили для бейджиков количества файлов в окне содержимого папки */
.folder-item-list .file-count-badge {
    background-color: transparent;
    color: #28a745;
    border: none;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    margin-left: 5px;
    display: none;
}

/* Стили для бейджиков непросмотренных аннотаций в окне содержимого папки */
.folder-item-list .unviewed-badge {
    background-color: transparent;
    color: #dc3545;
    border-radius: 0;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: bold;
    min-width: 14px;
    height: 14px;
    text-align: center;
    display: none;
    line-height: 12px;
    flex-shrink: 0;
    margin-left: 5px;
}

.folder-item-list .unviewed-badge.inspection {
    background-color: transparent;
    color: #007bff;
}

.folder-item-list .unviewed-badge.default {
    background-color: transparent;
    color: #dc3545;
}

.files-table {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: auto;
    height: 100%;
    min-height: 0;
    max-height: calc(100vh - 170px); /* 170px — примерная высота шапки, заголовка и отступов, скорректируйте при необходимости */
    min-width: 800px;
}

.file-row {
    display: grid;
    /* По умолчанию 7 колонок БЕЗ версии */
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
    min-height: 32px;
    max-height: none;
}

/* С отображением версии - 8 колонок */
body.show-version-column .file-row {
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

/* Вариант без столбца "Задача в Трекер" */
.file-row.no-tracker {
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

body.show-version-column .file-row.no-tracker {
    grid-template-columns: minmax(250px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

.file-row:hover {
    background-color: #f8f9fa;
}

.file-row:last-child {
    border-bottom: none;
}

.file-cell {
    padding: 4px 8px;
    border-right: 1px solid #f8f9fa;
    display: flex;
    align-items: center;
    font-size: 12px;
    overflow: visible;
}

.file-cell:last-child {
    border-right: none;
}

.name-cell {
    font-weight: 500;
    color: #495057;
    min-width: 250px;
    overflow: visible;
}

.upload-date-cell {
    font-size: 12px;
    color: #666;
    min-width: 120px;
    text-align: center;
    white-space: nowrap;
}

.status-cell {
    justify-content: center;
}

.links-cell {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.version-cell {
    justify-content: center;
}

/* По умолчанию скрываем столбец версии */
body:not(.show-version-column) .version-cell {
    display: none !important;
}

/* Показываем столбец версии для определенных пользователей */
body.show-version-column .version-cell {
    display: flex !important;
}

.file-name-container {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.file-name {
    cursor: pointer;
    color: #007bff;
    transition: color 0.2s ease;
    flex: 1;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    min-width: 200px;
    font-size: 12px;
    padding: 4px 0;
    line-height: 1.4;
}

.file-name:hover {
    color: #0056b3;
    text-decoration: underline;
}

.status-dropdown {
    width: 100%;
    padding: 2px 6px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    background-color: white;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-height: 24px;
}

.status-dropdown:hover {
    border-color: #adb5bd;
}

.status-dropdown:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.linked-files-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.linked-file-item {
    padding: 2px 6px;
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 3px;
    font-size: 11px;
    color: #1976d2;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.linked-file-item:hover {
    background-color: #bbdefb;
    border-color: #90caf9;
    color: #1565c0;
}

.version-select {
    width: 100%;
    padding: 2px 6px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    background-color: white;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-height: 24px;
}

.version-select:hover {
    border-color: #adb5bd;
}

.version-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.manage-links-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #6c757d;
    transition: color 0.2s ease;
    padding: 2px 4px;
    border-radius: 2px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manage-links-btn:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

.unviewed-badge {
    background-color: transparent;
    color: #dc3545;
    border-radius: 0;
    padding: 1px 4px;
    font-size: 9px;
    font-weight: bold;
    min-width: 14px;
    height: 14px;
    text-align: center;
    display: none;
    line-height: 12px;
    flex-shrink: 0;
}

.unviewed-badge.inspection {
    background-color: transparent;
    color: #007bff;
}

.unviewed-badge.default {
    background-color: transparent;
    color: #dc3545;
}

/* Стили для статусов файлов */
.file-row.status-new {
    background-color: #f8fff9;
}

.file-row.status-new:hover {
    background-color: #e8f5e8;
}

.file-row.status-корректировка {
    background-color: #fffbf0;
}

.file-row.status-корректировка:hover {
    background-color: #fff3cd;
}

.file-row.status-в-производство-работ {
    background-color: #f0f8ff;
}

.file-row.status-в-производство-работ:hover {
    background-color: #cce5ff;
}

.file-row.status-архив {
    background-color: #f8f9fa;
}

.file-row.status-архив:hover {
    background-color: #e9ecef;
}

/* Убрана адаптивность для маленьких экранов - все устройства работают одинаково */

/* Дополнительные стили для компактности */
.files-table {
    max-height: calc(100vh - 200px);
}

.files-table-header,
.file-row {
    /* 7 колонок для компактности БЕЗ версии */
    grid-template-columns: minmax(200px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

/* С версией - 8 колонок */
body.show-version-column .files-table-header,
body.show-version-column .file-row {
    grid-template-columns: minmax(200px, 3fr) minmax(120px, 1fr) minmax(100px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(180px, 2fr);
}

/* Стили для скроллбара в таблице */
.files-table::-webkit-scrollbar {
    width: 8px;
}

.files-table::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.files-table::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.files-table::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.main-content-flex {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    min-height: 0;
}
.content {
    flex: 1 1 100%;
    transition: flex 0.3s;
}
.content.shrink {
    flex: 1 1 25%;
    min-width: 300px; /* Минимальная ширина для видимости имен файлов */
}

/* Обеспечиваем видимость имен файлов при сжатом контенте */
.content.shrink .file-name {
    min-width: 200px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.content.shrink .name-cell {
    min-width: 250px;
    overflow: visible;
}

/* Добавляем горизонтальную прокрутку для таблицы файлов при необходимости */
.content.shrink .files-table-container {
    overflow-x: auto;
    min-width: 100%;
}

.content.shrink .files-table {
    min-width: 400px; /* Минимальная ширина таблицы в режиме shrink */
}

/* Обеспечиваем минимальную ширину контента даже при активном превью */
.content {
    min-width: 300px !important;
    width: 25% !important;
}

/* Скрываем столбцы "Дата загрузки", "Размер", "Статус", "Загрузил", "Задача в Трекер", "Личные заметки" при активном превью */
.content.shrink .files-table-header .upload-date-cell,
.content.shrink .files-table-header .size-cell,
.content.shrink .files-table-header .status-cell,
.content.shrink .files-table-header .uploader-cell,
.content.shrink .files-table-header .tracker-cell,
.content.shrink .files-table-header .notes-cell {
    display: none;
}

.content.shrink .file-row .upload-date-cell,
.content.shrink .file-row .size-cell,
.content.shrink .file-row .status-cell,
.content.shrink .file-row .uploader-cell,
.content.shrink .file-row .tracker-cell,
.content.shrink .file-row .notes-cell {
    display: none;
}

/* Личные заметки: позволяем многострочный ввод без обрезания */
.notes-cell {
    align-items: stretch;
}
.personal-note-input {
    min-height: 24px;
    max-height: none;
    height: auto;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* Изменяем grid-template-columns для скрытых столбцов при активном превью */
.content.shrink .files-table-header,
.content.shrink .file-row {
    grid-template-columns: minmax(200px, 2fr) minmax(100px, 1fr);
}

/* Дополнительные стили для обеспечения видимости имен файлов */
.file-name-container {
    min-width: 250px;
    max-width: 100%;
}

.file-name {
    min-width: 200px !important;
    max-width: 100%;
    word-break: break-word;
    hyphens: auto;
}

/* Убеждаемся, что имена файлов всегда кликабельны */
.file-name:hover {
    color: #0056b3;
    text-decoration: underline;
    background-color: rgba(0, 123, 255, 0.1);
    border-radius: 3px;
    padding: 2px 4px;
    margin: -2px -4px;
}
.preview {
    flex: 1 1 75%;
    display: none;
    transition: flex 0.3s;
}
.preview.active {
    display: flex;
}

/* Полноэкранный предпросмотр на мобильных */
@media (max-width: 768px) {
    .preview.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: var(--bg-base, #fff);
        max-width: 100% !important;
        padding: 8px 8px 56px 8px; /* место под плавающую панель */
        overflow: hidden;
    }
    .preview .preview-container {
        height: calc(100vh - 80px) !important;
        max-height: 100vh !important;
        width: 100% !important;
        margin: 0 !important;
        border: none !important;
        background: transparent !important;
        -webkit-overflow-scrolling: touch;
    }
    .pdf-pages-container,
    .pdf-page-container {
        max-width: 100% !important;
    }
    .mobile-close-btn {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1100;
        padding: 8px 12px;
        border-radius: 8px;
        background: rgba(0,0,0,0.6) !important;
        color: #fff !important;
        border: none !important;
        box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    }
}

.linked-file-row {
    background: #f7fbff;
    font-size: 12px;
}
.linked-file-row:hover {
    background: #e3f2fd;
}
.linked-file-name-cell {
    padding-left: 32px !important;
    position: relative;
    display: flex;
    align-items: center;
}
.linked-file-arrow {
    color: #1976d2;
    margin-right: 6px;
    font-size: 15px;
}

.linked-file-row .file-cell {
    font-size: 11px;
    padding: 2px 6px;
}



/* === Mobile layout fixes: make Header and Folders responsive/scrollable === */
@media (max-width: 768px) {
	body {
		height: auto;
	}
	.container {
		flex-direction: column;
		overflow: visible;
		height: auto;
	}
	.sidebar {
		width: 100%;
		min-width: 0;
		max-height: 40vh;
		height: auto;
		overflow-y: auto;
	}
	.content {
		width: 100% !important;
		min-width: 0 !important;
	}
	.preview {
		max-width: 100% !important;
	}
	.files-table {
		min-width: 0;
		max-height: calc(100vh - 260px);
	}
	.files-table-header,
	.file-row {
		grid-template-columns: minmax(180px, 3fr) minmax(100px, 1fr);
	}
	/* Hide secondary columns on small screens */
	.files-table-header .upload-date-cell,
	.files-table-header .size-cell,
	.files-table-header .status-cell,
	.files-table-header .uploader-cell,
	.files-table-header .tracker-cell,
	.files-table-header .notes-cell,
	.file-row .upload-date-cell,
	.file-row .size-cell,
	.file-row .status-cell,
	.file-row .uploader-cell,
	.file-row .tracker-cell,
	.file-row .notes-cell {
		display: none;
	}
}

.pdf-annotations-row {
    background: #fffbe7;
    padding: 6px 24px 6px 48px;
    border-top: 1px dashed #ffe082;
    font-size: 11px;
    color: #7a5c00;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.linked-annotations-row {
    background: #f7fbff;
    border-top: 1px dashed #bbdefb;
    color: #1565c0;
}
.pdf-annotation-text {
    background: #fffde4;
    border-radius: 3px;
    padding: 2px 8px;
    margin-bottom: 2px;
    box-shadow: 0 1px 2px rgba(255, 215, 64, 0.07);
    border: 1px solid #ffe082;
    font-size: 11px;
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-line;
}

/* Стили для кнопки отображения связанных почтовых файлов */
.show-email-links-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 14px;
    transition: background-color 0.2s;
    margin-left: 5px;
}

.show-email-links-btn:hover {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

/* ==== СТИЛИ ДЛЯ ПЕРЕКЛЮЧАТЕЛЯ ПЕРСОНАЛЬНЫХ ПАПОК ==== */

.folder-mode-btn {
    transition: all 0.3s ease;
}

.folder-mode-btn.active {
    background-color: #007bff !important;
    color: white !important;
}

.folder-mode-btn:not(.active) {
    background-color: #6c757d !important;
    color: white !important;
}

.folder-mode-btn:hover:not(.active) {
    background-color: #5a6268 !important;
}

/* ==== СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА ПЕРСОНАЛЬНЫХ ПАПОК ==== */

#personal-folders-modal .modal-content {
    max-width: 600px;
}

#personal-folders-modal .modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px 20px;
    border-radius: 5px 5px 0 0;
}

#personal-folders-modal .modal-body {
    padding: 20px;
}

#personal-folders-modal h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

#personal-folders-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.personal-folder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.personal-folder-item:hover {
    background-color: #f8f9fa;
}

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

.personal-folder-name {
    font-weight: 500;
    color: #495057;
    flex: 1;
}

.personal-folder-path {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
}

.remove-personal-folder-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.remove-personal-folder-btn:hover {
    background-color: #c82333;
}

#available-folders-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#available-folders-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

#add-personal-folder-btn {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

#add-personal-folder-btn:hover {
    background-color: #218838;
}

#add-personal-folder-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Стили для подсветки файла */
.highlighted-file {
    background-color: #fff8dc !important;
    border: 2px solid #d4af37 !important;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.6) !important;
    animation: highlight-pulse 2s ease-in-out;
    transform: scale(1.01);
}

@keyframes highlight-pulse {
    0% {
        background-color: #fff8dc;
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
    }
    50% {
        background-color: #f5f5dc;
        box-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
    }
    100% {
        background-color: #fff8dc;
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
    }
}

/* Стили для ленивой загрузки PDF */
.page-placeholder {
    height: 600px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 4px;
}

.loading-indicator {
    font-size: 24px;
    margin-bottom: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.page-label {
    font-weight: bold;
    margin-bottom: 4px;
}

.mobile-info {
    position: sticky;
    top: 0;
    background: #2196F3;
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 14px;
    z-index: 100;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Убрана оптимизация для мобильных устройств - все устройства работают одинаково */

/* Убраны улучшения для скроллинга на мобильных - все устройства работают одинаково */

/* ================================================ 
   СЕРВЕРНЫЙ РЕНДЕРИНГ PDF - Стили
   ================================================ */

/* Информация о PDF - УБРАНО */
/* .pdf-info {
    display: flex;
    gap: 15px;
    align-items: center;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    border: 1px solid #dee2e6;
}

.pdf-info span {
    display: flex;
    align-items: center;
    gap: 4px;
} */

/* Контейнер страниц с серверным рендерингом */
.pdf-pages-container.server-rendered {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 15px;
    /* Разрешаем вертикальную и горизонтальную прокрутку общего контейнера */
    max-height: none;
    overflow: visible;
}

/* Контейнер одной страницы */
.pdf-page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 20px;
    /* Разрешаем прокрутку, если изображение шире */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Ограничиваем высоту контейнера, чтобы появилась вертикальная прокрутка */
    max-height: 80vh;
}

/* Визуальная обратная связь при перетаскивании (CTRL + ЛКМ) */
.pdf-page-container.panning {
    cursor: grabbing !important;
}
.pdf-page-container.panning .pdf-page-image {
    cursor: grabbing !important;
}

.pdf-page-container:hover {
    /* Убираем transform на hover, чтобы избежать размытия из-за ресэмплинга */
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Изображение страницы PDF */
.pdf-page-image {
    max-width: none;
    width: auto;
    height: auto;
    border-radius: 4px;
    cursor: zoom-in;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Поддержка touch-zoom как на мобильном */
    touch-action: pinch-zoom;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Поддержка CSS zoom для масштабирования */
    zoom: 1;
    /* Принудительно убираем ограничения размеров */
    min-width: auto !important;
    min-height: auto !important;
}

.pdf-page-image:hover {
    /* Убираем масштаб на hover, чтобы не терять резкость */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Состояние масштабирования */
.pdf-page-image.zoomed {
    cursor: zoom-out;
    z-index: 1000;
    position: relative;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    /* transform будет устанавливаться через JavaScript */
}

/* Контейнер с прокруткой для масштабированных изображений */
.pdf-page-container.zoomed {
    overflow: auto;
    position: relative;
    border: 2px solid #007bff;
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.3);
    /* Размеры будут устанавливаться через JavaScript */
}

/* Подсветка страницы после двойного клика */
.pdf-page-container.double-click-highlight {
    border: 3px solid #ff6b6b !important;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5) !important;
    animation: doubleClickPulse 2s ease-in-out;
}

@keyframes doubleClickPulse {
    0% {
        border-color: #ff6b6b;
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
    }
    50% {
        border-color: #ff8e8e;
        box-shadow: 0 0 30px rgba(255, 107, 107, 0.7);
    }
    100% {
        border-color: #e9ecef;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* Поддержка gesture-zoom для трекпадов */
.pdf-page-image {
    -webkit-user-zoom: zoom;
    -moz-user-zoom: zoom;
    user-zoom: zoom;
}

/* Принудительный сброс зума - максимальный приоритет */
.pdf-page-image[style*="zoom: 1"] {
    zoom: 1 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
}

/* Принудительное применение зума - максимальный приоритет */
.pdf-page-image[style*="zoom:"] {
    zoom: inherit !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
}

/* Информация о странице */
.page-info {
    margin-top: 10px;
    text-align: center;
    width: 100%;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px;
    border: 1px solid #e9ecef;
}

.page-number {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.page-status {
    font-size: 12px;
    color: #6c757d;
}

/* Кнопки управления масштабом */
.page-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.zoom-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.zoom-btn.active {
    background: #28a745;
}

/* Убрана адаптивность для мобильных устройств - все устройства работают одинаково */

/* Убраны специальные стили для Яндекс браузера - все браузеры работают одинаково */

/* Убрана специальная поддержка touch устройств - все устройства работают одинаково */

/* Анимации для плавного масштабирования */
.pdf-page-image {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdf-page-container {
    transition: border-color 0.3s ease,
                box-shadow 0.3s ease,
                transform 0.2s ease;
}

/* Состояния для кнопок масштабирования */
.zoom-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.zoom-btn:disabled:hover {
    transform: none;
    background: #6c757d;
}

/* Улучшенная доступность */
.zoom-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.pdf-page-image:focus {
    outline: 2px solid #007bff;
    outline-offset: 4px;
}

/* Убрана специальная поддержка высокого DPI - все устройства работают одинаково */

/* Кнопка "Загрузить больше" */
.load-more-btn {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(40,167,69,0.3);
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40,167,69,0.4);
}

/* Спиннер загрузки */
.loading-spinner {
    display: inline-block;
    font-size: 20px;
    animation: spin 1s linear infinite;
    margin-top: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Индикатор загрузки */
.loading-indicator {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #adb5bd;
}

/* Сообщение об ошибке страницы */
.page-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
}

.page-error button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 12px;
}

.page-error button:hover {
    background: #c82333;
}

/* Информация о версии в заголовке */
.version-info {
    color: #007bff;
    font-weight: 600;
    background: rgba(0, 123, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 123, 255, 0.3);
}

/* Кнопка переключения рендеринга */
.rendering-toggle-btn {
    background: linear-gradient(135deg, #6f42c1, #5a2d91);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.rendering-toggle-btn:hover {
    background: linear-gradient(135deg, #5a2d91, #4e1f7a);
    transform: translateY(-1px);
}

/* Индикатор загрузки */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-size: 18px;
    color: #007bff;
    font-weight: 500;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Сообщение об ошибке */
.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f8d7da;
    color: #721c24;
    font-size: 16px;
    font-weight: 500;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 15px;
}

/* Ошибка страницы */
.page-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 150px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.page-error button {
    background: #ffc107;
    color: #856404;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-error button:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

/* Убраны стили для мобильных устройств - все устройства работают одинаково */

/* Убраны стили для планшетов и десктопов - все устройства работают одинаково */

/* Убраны стили для очень маленьких экранов - все устройства работают одинаково */

/* Убраны стили для высокого DPI устройств - все устройства работают одинаково */

/* Убраны специальные стили для качества изображений - все устройства работают одинаково */

/* Стили для кнопок согласования */
.approve-file-btn,
.reject-file-btn {
    transition: all 0.2s ease;
    font-size: 12px;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Улучшенные стили для активного файла */
.file-row.active {
    background-color: #e3f2fd !important;
    border-left: 4px solid #2196f3 !important;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15) !important;
}

.file-row.active .file-name {
    color: #1976d2 !important;
    font-weight: 600 !important;
}

.approve-file-btn:hover {
    background-color: #218838 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.reject-file-btn:hover {
    background-color: #c82333 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* Стили для блока согласований */
.approvals-row {
    background: #f8f9fa !important;
    border-left: 3px solid #007bff !important;
    padding: 10px !important;
    margin: 5px 0 !important;
    font-size: 12px !important;
    border-radius: 0 4px 4px 0;
}

.approvals-row .approvals-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #007bff;
}

.approvals-row .approved-info {
    margin-bottom: 5px;
    color: #28a745;
}

.approvals-row .rejected-info {
    margin-bottom: 5px;
    color: #dc3545;
}

.approvals-row .comments-section {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #dee2e6;
}

.approvals-row .comment-item {
    margin: 3px 0;
    padding: 3px 8px;
    background: white;
    border-radius: 3px;
    border-left: 2px solid #007bff;
}

/* Убраны мобильные стили для кнопок согласования - все устройства работают одинаково */

/* ===== УЛУЧШЕННЫЕ СТИЛИ ДЛЯ МАСШТАБИРОВАНИЯ PDF ===== */

/* Базовые стили для изображений PDF */
.pdf-page-image {
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
    transform-origin: center center;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* Разрешаем естественную прокрутку пальцем по изображению */
    touch-action: pan-x pan-y;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Состояние масштабирования */
.pdf-page-image.zoomed {
    cursor: zoom-out;
    /* Убираем transform-origin так как теперь используем прямые размеры */
}

/* Контейнер страницы при масштабировании */
.pdf-page-container.zoomed {
    overflow: auto;
    position: relative;
    border: 2px solid #007bff;
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.3);
}

/* Плавное масштабирование */
.pdf-page-image {
    transition: all 0.3s ease;
}

/* Улучшенные кнопки масштабирования */
.zoom-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.zoom-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.zoom-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.zoom-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Анимация при масштабировании */
@keyframes zoomIn {
    from {
        transform: scale(1);
        opacity: 0.8;
    }
    to {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes zoomOut {
    from {
        transform: scale(1.1);
        opacity: 1;
    }
    to {
        transform: scale(1);
        opacity: 0.8;
    }
}

.pdf-page-image.zooming-in {
    animation: zoomIn 0.2s ease-out;
}

.pdf-page-image.zooming-out {
    animation: zoomOut 0.2s ease-out;
}

/* Улучшенный скроллбар для масштабированных изображений */
.pdf-page-container.zoomed::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.pdf-page-container.zoomed::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.pdf-page-container.zoomed::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.pdf-page-container.zoomed::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Индикатор масштабирования */
.zoom-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pdf-page-container.zoomed .zoom-indicator {
    opacity: 1;
}

/* Адаптивность для разных размеров экрана */
@media (max-width: 768px) {
    .pdf-page-container.zoomed {
        /* Убираем ограничения размеров для мобильных устройств */
    }
    
    .zoom-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .pdf-page-container.zoomed {
        /* Убираем ограничения размеров для маленьких экранов */
    }
    
    .page-controls {
        flex-direction: column;
        gap: 4px;
    }
    
    .zoom-btn {
        width: 100%;
        padding: 8px;
    }
}

/* ===== ПРЕДОТВРАЩЕНИЕ МАСШТАБИРОВАНИЯ БРАУЗЕРОМ ===== */

/* Предотвращаем масштабирование страницы браузером */
body {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Контейнер PDF страниц */
.pdf-pages-container {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Дополнительные правила для предотвращения масштабирования */
.pdf-page-container {
    touch-action: manipulation;
}

.pdf-page-image {
    touch-action: manipulation;
}

/* ПРИНУДИТЕЛЬНОЕ УБИРАНИЕ ВСЕХ ОГРАНИЧЕНИЙ РАЗМЕРОВ */
.pdf-page-container.zoomed {
    min-width: none !important;
    min-height: none !important;
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
}

/* Убираем все возможные ограничения от родительских элементов */
.pdf-pages-container .pdf-page-container.zoomed {
    min-width: none !important;
    min-height: none !important;
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
}

/* МАКСИМАЛЬНЫЙ ПРИОРИТЕТ - переопределяем все возможные стили */
.pdf-page-container.zoomed {
    min-width: none !important;
    min-height: none !important;
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
    flex-basis: auto !important;
    flex-shrink: 1 !important;
    flex-grow: 0 !important;
    box-sizing: content-box !important;
    display: block !important;
    position: relative !important;
    overflow: auto !important;
}

/* Принудительно убираем все flexbox ограничения */
.pdf-pages-container {
    display: block !important;
}

.pdf-pages-container .pdf-page-container {
    display: block !important;
    flex: none !important;
}

/* Освобождаем место от удалённых заголовков в контенте и превью */
.content { padding-top: 0 !important; }
.preview { padding-top: 0 !important; }

/* ===== DRAG AND DROP СТИЛИ ДЛЯ СОЗДАНИЯ СВЯЗЕЙ МЕЖДУ ФАЙЛАМИ ===== */

/* Основные стили для drag and drop */
.file-row {
    position: relative;
    transition: all 0.2s ease;
}

.file-row.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.file-row.drag-over {
    background-color: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
    border-radius: 4px;
    position: relative;
}

.file-row.drag-over::before {
    content: "📎 Перетащите сюда для создания связи";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(33, 150, 243, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1001;
    pointer-events: none;
    white-space: nowrap;
}

.file-row.drag-source {
    background-color: #fff3e0 !important;
    border: 2px solid #ff9800 !important;
    border-radius: 4px;
}

.file-row.drag-source::after {
    content: "🔄 Перетаскивается";
    position: absolute;
    top: -25px;
    left: 0;
    background: #ff9800;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    z-index: 1001;
    pointer-events: none;
    white-space: nowrap;
}

/* Связанные файлы - иерархическое отображение */
.linked-file-row {
    border-left: 3px solid #2196f3 !important;
    background-color: #f7fbff !important;
    position: relative;
}


.linked-file-row .file-name {
    color: #1976d2;
    font-style: italic;
}

/* Drop zone индикатор */
.drop-zone-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: #4caf50;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.drop-zone-indicator.active {
    opacity: 1;
}

/* Drag handle для файлов */
.drag-handle {
    cursor: grab;
    padding: 4px;
    margin-right: 8px;
    color: #666;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    user-select: none;
    display: inline-block;
    border-radius: 2px;
}

.drag-handle[draggable="true"] {
    cursor: grab;
}

.drag-handle:hover {
    opacity: 1;
    color: #333;
}

.file-row:hover .drag-handle {
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Стили для мобильных устройств */
@media (max-width: 768px) {
    .file-row.drag-over::before {
        font-size: 10px;
        padding: 6px 12px;
    }
    
    .file-row.drag-source::after {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .linked-file-row {
        /* Убран отступ для мобильной версии */
    }
}

/* Стили для папок подрядчиков */
.contractor-folder {
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
    margin: 2px 0;
    border-radius: 4px;
}

.contractor-folder .folder-name {
    color: #856404;
    font-weight: 500;
}

.executive-folder {
    background-color: #d1ecf1;
    border-left: 3px solid #17a2b8;
    margin: 2px 0;
    border-radius: 4px;
}

.executive-folder .folder-name {
    color: #0c5460;
    font-weight: 500;
}

.main-folder {
    background-color: #e8f5e8;
    border-left: 3px solid #28a745;
    margin: 2px 0;
    border-radius: 4px;
}

.main-folder .folder-name {
    color: #155724;
    font-weight: 500;
}

.contractor-folder:hover,
.executive-folder:hover,
.main-folder:hover {
    background-color: rgba(255, 193, 7, 0.1);
}

.executive-folder:hover {
    background-color: rgba(23, 162, 184, 0.1);
}

.main-folder:hover {
    background-color: rgba(40, 167, 69, 0.1);
}

/* Контекстное меню для файлов */
.file-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    min-width: 200px;
    padding: 8px 0;
    display: none;
}

.file-context-menu.show {
    display: block;
}

.file-context-menu-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    color: #333;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.file-context-menu-item:hover {
    background-color: #f8f9fa;
}

.file-context-menu-item .share-icon {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.file-context-menu-item .share-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.file-context-menu-item .share-text {
    flex: 1;
}

