/* ============================================
   Глобальные стили - Серо-бело-черная гамма
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

/* ============================================
   Боковое меню (Sidebar)
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: #2c2c2c;
    color: white;
    z-index: 1000;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    overflow-x: hidden;
    overflow-y: auto;
}

/* Настройка скроллбара для сайдбара */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: #3c3c3c;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .user-info-sidebar,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .logout-link span,
.sidebar.collapsed .nav-group-header span,
.sidebar.collapsed .nav-group-arrow {
    display: none;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
}

.sidebar.collapsed .user-avatar {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 1rem 0;
}

.sidebar.collapsed .user-info-sidebar {
    display: none;
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .logout-link,
.sidebar.collapsed .nav-group-header {
    justify-content: center;
    padding: 0.75rem 0;
}

.sidebar.collapsed .nav-item i,
.sidebar.collapsed .logout-link i,
.sidebar.collapsed .nav-group-header i:first-child {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar.collapsed .nav-group-items {
    display: none !important;
}

.sidebar.collapsed .nav-group-header i:first-child {
    width: auto;
}

/* Шапка меню */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-logo i {
    font-size: 1.3rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: #444;
    color: white;
}

/* Профиль пользователя */
.sidebar-user {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-align: center;
}

.user-avatar {
    width: 120px;
    height: 120px;
    background: #555;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.2s;
}

.user-avatar:hover {
    opacity: 0.8;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-sidebar {
    width: 100%;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.85rem;
    line-height: 1.3;
    word-break: break-word;
    white-space: normal;
    color: #fff;
}

.user-role {
    font-size: 0.7rem;
    color: #aaa;
}

.user-role i {
    margin-right: 4px;
}

.impersonate-badge {
    background: #ffc107;
    color: #333;
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    margin-top: 8px;
    text-align: center;
}

.impersonate-badge i {
    margin-right: 4px;
}

.stop-impersonate-btn {
    display: block;
    background: #17a2b8;
    color: white;
    text-decoration: none;
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    margin-top: 8px;
    text-align: center;
    transition: background 0.2s;
}

.stop-impersonate-btn:hover {
    background: #138496;
    color: white;
}

.stop-impersonate-btn i {
    margin-right: 4px;
}

/* Навигация */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1rem;
    color: #ddd;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-item i {
    width: 22px;
    text-align: center;
    font-size: 1rem;
}

.nav-item:hover {
    background: #3c3c3c;
    color: white;
}

.nav-item.active {
    background: #444;
    color: white;
    border-left: 3px solid white;
}

.nav-group {
    margin-top: 0.25rem;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1rem;
    color: #aaa;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-group-header i:first-child {
    width: 22px;
    text-align: center;
    font-size: 0.9rem;
}

.nav-group-header span {
    flex: 1;
}

.nav-group-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.nav-group.open .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-group-header:hover {
    background: #3c3c3c;
    color: white;
}

.nav-group-items {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 0;
}

.nav-group.open .nav-group-items {
    max-height: 500px;
}

.nav-subitem {
    padding-left: 2.5rem !important;
    font-size: 0.85rem;
}

.sidebar-footer {
    padding: 0.5rem 0;
    border-top: 1px solid #444;
    margin-top: auto;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1rem;
    color: #ff6b6b;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.logout-link:hover {
    background: #3c3c3c;
    color: #ff8888;
}

.logout-link i {
    width: 22px;
    text-align: center;
}

.menu-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: #333;
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.menu-toggle:hover {
    background: #444;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   Стили для аватаров пользователей
   ============================================ */

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 8px;
    object-fit: cover;
}

.user-avatar-medium {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    font-size: 1.3rem;
}

.user-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 2.5rem;
}

.default-avatar {
    background: #555;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.default-avatar.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.8rem;
}

.default-avatar.avatar-medium {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    font-size: 1.3rem;
}

.default-avatar.avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    font-size: 2.5rem;
}

.avatar-upload-container {
    text-align: center;
    padding: 1rem;
}

.current-avatar {
    margin-bottom: 1rem;
    text-align: center;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid #ddd;
}

.avatar-preview-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #555;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
    border: 3px solid #ddd;
}

.upload-progress {
    display: none;
    margin-top: 1rem;
}

.upload-progress.active {
    display: block;
}

/* Уникальный прогресс-бар (только для загрузки аватаров) */
.upload-progress .progress-bar {
    width: 100%;
    height: 5px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress .progress-fill {
    width: 0%;
    height: 100%;
    background: #28a745;
    transition: width 0.3s;
}

.upload-message {
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.upload-message.success {
    background: #d4edda;
    color: #155724;
}

.upload-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   Основной контент
   ============================================ */

.main-content {
    min-height: 100vh;
    background: #f5f5f5;
    transition: margin-left 0.3s ease;
}

/* ФИКСАЦИЯ ШАПКИ */
.header {
    background: white;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
}

.knowledge-header-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #454545;
    text-decoration: none;
    font-size: 21px;
    font-weight: 300;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    padding: 6px 12px;
    border-radius: 6px;
    margin-left: 50px;
}

.knowledge-header-link i {
    font-size: 20px;
    color: #7ec8e0;
}

.knowledge-header-link span {
    font-weight: 300;
    font-size: 21px;
}

.knowledge-header-link:hover {
    background: rgba(126, 200, 224, 0.1);
    color: #a8e4ff;
}

.knowledge-header-link:hover i {
    color: #a8e4ff;
}

/* Дата и время - фиксированная ширина для устранения дергания */
.datetime-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.current-date,
.current-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.current-date i,
.current-time i {
    color: #888;
    width: 16px;
    flex-shrink: 0;
}

.current-date {
    min-width: 200px;
    white-space: nowrap;
}

.current-time {
    min-width: 95px;
    white-space: nowrap;
}

.time-bold {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    letter-spacing: 0.5px;
    display: inline-block;
    min-width: 70px;
    text-align: center;
}

.container {
    max-width: 70%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ============================================
   ФИКСАЦИЯ ЗАГОЛОВКОВ И ФИЛЬТРОВ
   ============================================ */

.sticky-header {
    position: sticky;
    top: 60px;
    z-index: 99;
    background: white;
}

.sticky-filters {
    position: sticky;
    top: 60px;
    z-index: 99;
    background: white;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e8e8e8;
}

.sticky-title {
    position: sticky;
    top: 60px;
    z-index: 99;
    background: white;
    padding-top: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e8e8e8;
}

.sticky-tabs {
    position: sticky;
    top: 60px;
    z-index: 98;
    background: white;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e8e8e8;
}

/* ============================================
   ПРОКРУТИВАЕМЫЕ КОНТЕЙНЕРЫ
   ============================================ */

.scrollable-table {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
}

.scrollable-cards {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 5px;
}

.scrollable-cards .users-cards,
.scrollable-cards .books-cards,
.scrollable-cards .tickets-cards {
    padding-bottom: 20px;
}

/* Стилизация скроллбара */
.scrollable-table::-webkit-scrollbar,
.scrollable-cards::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.scrollable-table::-webkit-scrollbar-track,
.scrollable-cards::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

.scrollable-table::-webkit-scrollbar-thumb:hover,
.scrollable-cards::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Для Firefox */
.scrollable-table,
.scrollable-cards {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.card {
    background: white;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: #fafafa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e8e8e8;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-header i {
    margin-right: 8px;

}

.card-body {
    padding: 1.5rem;
}

/* Формы */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #444;
    font-size: 0.875rem;
}

label i {
    margin-right: 6px;
    color: #888;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* Кнопки */
button,
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #555;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

button i,
.btn i {
    margin-right: 6px;
}

button:hover,
.btn:hover {
    background: #666;
}

.btn-sm {
    font-size: 0.75rem;
}

.btn-primary {
    background: #625959;
}

.btn-primary:hover {
    background: #444;
}

.btn-secondary {
    background: #666;
}

.btn-secondary:hover {
    background: #777;
}

/* Таблицы */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

th {
    background: #fafafa;
    font-weight: 600;
    color: #444;
    font-size: 0.875rem;
}

th i {
    margin-right: 6px;
    color: #888;
}

tr:hover {
    background: #f9f9f9;
}

/* Статусы */
.status,
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}


.status i,
.badge i {
    margin-right: 4px;
    font-size: 0.7rem;
}

.status-new,
.badge-client {
    background: #007bff;
    color: white;
}

.status-in_progress,
.badge-agent {
    background: #ffc107;
    color: #333;
    max-width: 100px;
    min-width: 95px;
}

.status-waiting {
    background: #fd7e14;
    color: white;
    max-width: 100px;
    min-width: 95px;
}

.status-closed,
.badge-admin {
    background: #28a745;
    color: white;
}

.priority {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.priority i {
    margin-right: 4px;
    font-size: 0.7rem;

}

.priority-low {
    background: #28a745;
    color: white;
    max-width: 100px;
    min-width: 95px;
}

.priority-medium {
    background: #28a745;
    color: #333;
    max-width: 100px;
    min-width: 95px;
}

.priority-high {

    color: white;

}

.priority-urgent {
    background: #dc3545;
    color: white;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card i {
    font-size: 1.5rem;
    color: #999;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-card h3 {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card .number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
}

/* Приветствие */
.welcome-section {
    margin-bottom: 1.5rem;
}

.welcome-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.welcome-title i {
    margin-right: 8px;
    color: #555;
}

.welcome-subtitle {
    font-size: 0.875rem;
    color: #888;
}

.welcome-subtitle i {
    margin-right: 6px;
}

/* Фильтры */
.filters {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-btn {
    padding: 0.4rem 0.8rem;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    color: #555;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.filter-btn i {
    margin-right: 4px;
}

.filter-btn.active {
    background: #333;
    color: white;
}

.filter-btn:hover {
    background: #ddd;
}

.filter-count {
    display: inline-block;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 0 6px;
    margin-left: 4px;
    font-size: 0.7rem;
}

.filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.2);
}

.search-box {
    flex: 1;
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Комментарии */
.comment {
    padding: 1rem;
    border-bottom: 1px solid #e8e8e8;
}

.comment:last-child {
    border-bottom: none;
}

.comment-internal {
    background: #f5f5f5;
    border-left: 3px solid #999;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #888;
}

.comment-author {
    font-weight: 600;
    color: #555;
}

.comment-author i {
    margin-right: 4px;
}

.comment-message {
    line-height: 1.5;
    font-size: 0.875rem;
    color: #444;
}

.comment-badge {
    display: inline-block;
    background: #999;
    color: white;
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

/* Иконки */
.fa-history,
.fa-list,
.fa-envelope,
.fa-bell,
.fa-cog,
.fa-telegram,
.fa-chart-line {
    margin-right: 8px;
}

.info_color {
    color: #007bff;
}

/* Уведомления */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert i {
    margin-right: 6px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 96vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e8e8e8;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header i {
    margin-right: 8px;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

/* Прогресс-бары общие */
.progress-bar {
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    height: 24px;
}

.progress-fill {
    background: #333;
    height: 100%;
    color: white;
    text-align: center;
    font-size: 0.7rem;
    line-height: 24px;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 1rem;
}

/* ============================================
   Карточки заявок (единый стиль для всех страниц)
   ============================================ */

.tickets-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-card {
    background: #fefefe;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: all 0.2s ease;
    width: 100%;
    cursor: pointer;
}

.ticket-card:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    background: #f8f8f8;
}

.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: #888;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ticket-id {
    font-weight: 600;
    color: #555;
}

.ticket-id i {
    margin-right: 4px;
}

.ticket-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ticket-card-title {
    font-size: 1.5rem;
    font-weight: bold;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.ticket-card-info {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ticket-card-client,
.ticket-card-agent,
.ticket-card-category {
    font-size: 0.8rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ticket-card-client i,
.ticket-card-agent i,
.ticket-card-category i {
    width: 16px;
    color: #888;
    font-size: 0.7rem;
}

.ticket-card-client strong,
.ticket-card-agent strong,
.ticket-card-category strong {
    font-weight: 600;
    color: #444;
    margin-right: 4px;
}

.ticket-card-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

/* Карточка с нарушением SLA */
.ticket-card-sla-violated {
    background: #fff0f0 !important;
    border-left: 4px solid #dc3545 !important;
}

.ticket-card-sla-violated:hover {
    background: #ffe8e8 !important;
}

.sla-badge {
    background: #dc3545;
    color: white;
    font-size: 0.6rem;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: normal;
}

.sla-info {
    font-size: 0.65rem;
    color: #888;
    margin-left: 6px;
}

/* Кнопка открытия заявки */
.ticket-card-actions {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #f0f0f0;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.btn-open {
    background: #555;
    padding: 0.35rem 0.9rem;
    font-size: 0.75rem;
    border-radius: 4px;
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-open:hover {
    background: #666;
}

/* ============================================
   Страница создания заявки
   ============================================ */

.form-container {
    max-width: 100%;
    margin: 0 auto;
}

.required-star {
    color: #dc3545;
    font-size: 1rem;
    margin-left: 2px;
}

.required-field i {
    margin-right: 6px;
}

/* ============================================
   Стили для страницы отчетов (admin/reports.php)
   ============================================ */

/* Сетка статистики */
.reports-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Карточки метрик */
.reports-stat-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.reports-stat-card:hover {
    transform: translateY(-2px);
}

.reports-stat-card i {
    font-size: 1.5rem;
    color: #999;
    margin-bottom: 0.5rem;
    display: block;
}

.reports-stat-card h3 {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.reports-stat-card .number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
}

/* Прогресс-бары */
.reports-progress-bar {
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    height: 24px;
}

.reports-progress-fill {
    background: #333;
    height: 100%;
    color: white;
    text-align: center;
    font-size: 0.7rem;
    line-height: 24px;
}

/* Сетка для двух колонок */
.reports-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Кнопки экспорта */
.reports-export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============================================
   Стили для бейджей (внутренние комментарии)
   ============================================ */

.internal-badge {
    font-size: 0.7rem;
    font-weight: normal;
    color: #888;
    background: #f0f0f0;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* ============================================
   Карточки пользователей (админка)
   ============================================ */

.users-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.user-card {
    background: #fefefe;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.user-card:hover {
    border-color: #ddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.user-card-title {
    flex: 1;
}

.user-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.current-user-badge {
    background: #28a745;
    color: white;
    font-size: 0.65rem;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.user-card-email {
    font-size: 0.8rem;
    color: #888;
}

.user-card-email i {
    margin-right: 4px;
    width: 14px;
}

.user-card-info {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-card-roles,
.user-card-department,
.user-card-date {
    font-size: 0.8rem;
    color: #555;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.user-card-roles i,
.user-card-department i,
.user-card-date i {
    width: 18px;
    color: #888;
}

.user-card-roles strong,
.user-card-department strong,
.user-card-date strong {
    font-weight: 600;
    color: #444;
    margin-right: 2px;
}

/* Убираем фон у бейджей ролей */
.user-card-roles .badge-admin,
.user-card-roles .badge-agent,
.user-card-roles .badge-client {
    background: none !important;
    padding: 0 !important;
    color: #555 !important;
    font-weight: normal !important;
}

.user-card-roles .badge-admin i,
.user-card-roles .badge-agent i,
.user-card-roles .badge-client i {
    color: #888;
    margin-right: 4px;
}

.user-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.btn-impersonate {
    background: #17a2b8;
}

.btn-impersonate:hover {
    background: #138496;
}

.btn-edit {
    background: #17a2b8;
    border-radius: 3px;
    padding-left: 10px;
    padding-right: 10px;
    text-decoration: none;
    color: white;
}

.btn-edit:hover {
    background: #138496;
}

.btn-password {
    background: #17a2b8;
}

.btn-password:hover {
    background: #138496;
}

.btn-delete {
    background: #dc3545;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* ============================================
   Стили для страницы просмотра заявки (ticket_view.php)
   ============================================ */

/* Карточка информации о заявке */
.ticket-info-card {
    margin-bottom: 1.5rem;
}

.btn-edit-ticket {
    background: #555;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-edit-ticket:hover {
    background: #666;
}

/* Сетка информации */
.ticket-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.info-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 4px;
    color: #333;
}

/* Кликабельные элементы */
.clickable-status,
.clickable-priority {
    cursor: pointer;
    display: inline-block;
}

.clickable-status:hover .edit-icon,
.clickable-priority:hover .edit-icon {
    opacity: 1;
}

.edit-icon {
    font-size: 0.7rem;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    color: #888;
}

.status:hover .edit-icon,
.priority:hover .edit-icon {
    opacity: 1;
}

/* Кнопка смены агента */
.btn-change-agent {
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    background: #555;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.btn-change-agent:hover {
    background: #666;
}

/* Описание заявки */
.ticket-description {
    background: #fafafa;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.ticket-subject {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

/* Формы редактирования - единый стиль */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-save {
    background: #333;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.btn-save:hover {
    background: #444;
}

.btn-cancel {
    background: #666;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #777;
}

/* Комментарии */
.comment-form {
    margin-top: 1rem;
}

.internal-checkbox {
    margin-bottom: 1rem;
}

.internal-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.btn-send {
    background: #333;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.btn-send:hover {
    background: #444;
}

/* Кнопка назад */
.back-link {
    text-align: center;
    margin-top: 1rem;
}

.btn-back {
    display: inline-block;
    background: #555;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
}

.btn-back:hover {
    background: #666;
}

/* Стили для модальных окон в ticket_view */
.btn-cancel-modal {
    background: #666;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-cancel-modal:hover {
    background: #777;
}

.btn-save-modal {
    background: #333;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-save-modal:hover {
    background: #444;
}

.status-select-modal,
.priority-select-modal {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ============================================
   Общие стили для административных таблиц (категории, подразделения)
   ============================================ */

.categories-container,
.departments-container {
    max-width: 100%;
    margin: 0 auto;
}

.form-add-category,
.form-add-department {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-add-category .form-group,
.form-add-department .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-add-category button,
.form-add-department button {
    padding: 0.6rem 1.5rem;
    white-space: nowrap;
}

.category-table,
.department-table {
    width: 100%;
    border-collapse: collapse;
}

.category-table th,
.category-table td,
.department-table th,
.department-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: middle;
}

.category-table th,
.department-table th {
    background: #fafafa;
    font-weight: 600;
    color: #444;
}

.category-table tr:hover,
.department-table tr:hover {
    background: #f9f9f9;
}

/* Общие стили для иконок действий */
.action-icons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.action-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    font-size: 1rem;
    padding: 4px;
    transition: color 0.2s;
}

.action-icon:hover {
    color: #333;
}

.action-icon-save:hover {
    color: #28a745;
}

.action-icon-delete:hover {
    color: #dc3545;
}

/* ============================================
   Стили для Markdown редактора (общие)
   ============================================ */

.EasyMDEContainer .editor-toolbar {
    border: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    background: #fafafa;
}

.EasyMDEContainer .editor-toolbar button {
    background: none;
    color: #555;
    padding: 0.5rem;
}

.EasyMDEContainer .editor-toolbar button:hover {
    background: #e8e8e8;
}

.EasyMDEContainer .CodeMirror {
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* ============================================
   Адаптивность
   ============================================ */

@media (min-width: 769px) {
    .main-content {
        margin-left: 300px;
    }

    .sidebar.collapsed+.main-content,
    .sidebar.collapsed~.main-content {
        margin-left: 80px;
    }

    .menu-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        left: -300px;
        width: 280px;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.collapsed {
        width: 280px;
    }

    .sidebar.collapsed .sidebar-logo span,
    .sidebar.collapsed .user-info-sidebar,
    .sidebar.collapsed .nav-item span,
    .sidebar.collapsed .logout-link span,
    .sidebar.collapsed .nav-group-header span,
    .sidebar.collapsed .nav-group-arrow {
        display: inline-block;
    }

    .sidebar.collapsed .nav-item,
    .sidebar.collapsed .logout-link,
    .sidebar.collapsed .nav-group-header {
        justify-content: flex-start;
        padding: 0.7rem 1rem;
    }

    .sidebar.collapsed .nav-item i,
    .sidebar.collapsed .logout-link i,
    .sidebar.collapsed .nav-group-header i:first-child {
        margin-right: 12px;
        font-size: 1rem;
    }

    .sidebar.collapsed .sidebar-user {
        flex-direction: column;
        padding: 1rem;
    }

    .sidebar.collapsed .user-info-sidebar {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .container {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .welcome-title {
        font-size: 1rem;
    }

    .welcome-subtitle {
        font-size: 0.75rem;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    /* Адаптация sticky элементов для мобильных */
    .sticky-header,
    .sticky-filters,
    .sticky-title,
    .sticky-tabs {
        top: 50px;
    }

    .scrollable-table {
        max-height: calc(100vh - 180px);
    }

    .scrollable-cards {
        max-height: calc(100vh - 240px);
    }

    th,
    td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .filter-btn {
        text-align: center;
    }

    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }

    /* Карточки заявок */
    .ticket-card {
        padding: 0.75rem 1rem;
    }

    .ticket-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-card-title {
        font-size: 0.9rem;
    }

    .ticket-card-info {
        gap: 0.3rem;
    }

    .ticket-card-client,
    .ticket-card-agent,
    .ticket-card-category {
        font-size: 0.7rem;
    }

    /* Форма создания заявки */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Карточки пользователей */
    .users-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .user-card {
        padding: 1rem;
    }

    .user-card-header {
        flex-direction: column;
        text-align: center;
    }

    .user-card-name {
        justify-content: center;
    }

    .user-card-actions {
        justify-content: center;
    }

    /* Административные таблицы (категории, подразделения) */
    .form-add-category,
    .form-add-department {
        flex-direction: column;
        align-items: stretch;
    }

    .form-add-category button,
    .form-add-department button {
        width: 100%;
    }

    .category-table,
    .category-table thead,
    .category-table tbody,
    .category-table tr,
    .category-table td,
    .department-table,
    .department-table thead,
    .department-table tbody,
    .department-table tr,
    .department-table td {
        display: block;
    }

    .category-table thead,
    .department-table thead {
        display: none;
    }

    .category-table tr,
    .department-table tr {
        margin-bottom: 1rem;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        padding: 0.5rem;
    }

    .category-table td,
    .department-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        border-bottom: 1px solid #f0f0f0;
    }

    .category-table td:last-child,
    .department-table td:last-child {
        border-bottom: none;
    }

    .category-table td::before,
    .department-table td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 40%;
        color: #666;
    }

    .category-table input[type="number"] {
        width: 100%;
    }

    .action-icons {
        justify-content: flex-end;
        width: 100%;
    }

    /* Ссылка на базу знаний */
    .knowledge-header-link {
        font-size: 14px;
        margin-left: 0;
        gap: 6px;
        padding: 4px 8px;
    }

    .knowledge-header-link span {
        font-size: 14px;
        display: inline;
    }

    .knowledge-header-link i {
        font-size: 16px;
    }

    /* Дата и время - адаптивность */
    .datetime-info {
        gap: 0.75rem;
    }

    .current-date {
        min-width: auto;
        white-space: normal;
        font-size: 0.7rem;
    }

    .current-time {
        min-width: auto;
        font-size: 0.7rem;
    }

    .time-bold {
        min-width: 55px;
        font-size: 0.8rem;
    }

    /* Адаптивность для ticket_view */
    .ticket-info-grid {
        grid-template-columns: 1fr;
    }

    .clickable-status,
    .clickable-priority {
        display: block;
        width: 100%;
    }

    .edit-icon {
        opacity: 1;
    }

    /* Бейдж внутренних комментариев на мобильных */
    .internal-badge {
        white-space: normal;
        font-size: 0.65rem;
        display: inline-block;
    }

    /* Адаптивность для отчетов */
    .reports-row {
        grid-template-columns: 1fr;
    }

    .reports-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card .number {
        font-size: 1.25rem;
    }

    .stat-card h3 {
        font-size: 0.6rem;
    }

    .user-name {
        font-size: 0.7rem;
    }

    .user-role {
        font-size: 0.6rem;
    }

    .user-avatar {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .nav-item {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .nav-item i {
        width: 18px;
        font-size: 0.9rem;
    }

    .knowledge-header-link span {
        display: none;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Стили для уведомлений
   ============================================ */

/* Иконка уведомлений */
.notification-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 15px;
}

.notification-icon-wrapper {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notification-icon-wrapper:hover {
    background: rgba(0, 0, 0, 0.05);
}

.notification-icon-wrapper i {
    font-size: 1.2rem;
    color: #555;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 5px;
    font-size: 0.7rem;
    min-width: 18px;
    text-align: center;
    font-weight: bold;
}

/* Выпадающее меню уведомлений */
.notification-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 380px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    margin-top: 10px;
}

.notification-dropdown-menu.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-header {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.mark-all-read {
    font-size: 0.75rem;
    color: #667eea;
    text-decoration: none;
}

.dropdown-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item-dropdown {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    cursor: pointer;
}

.notification-item-dropdown:hover {
    background: #f8f9fa;
}

.notification-item-dropdown.unread {
    background: #f0f7ff;
}

.notification-item-dropdown .title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.notification-item-dropdown .title i {
    margin-right: 8px;
    color: #667eea;
}

.notification-item-dropdown .message {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
}

.notification-item-dropdown .time {
    font-size: 0.7rem;
    color: #999;
}

.dropdown-footer {
    padding: 10px 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.view-all-link {
    color: #667eea;
    text-decoration: none;
    font-size: 0.85rem;
}

.view-all-link i {
    margin-right: 5px;
}

.loading-notifications {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* Адаптивность для уведомлений */
@media (max-width: 768px) {
    .notification-dropdown-menu {
        width: 300px;
        right: -50px;
    }
}

/* ============================================
   Пагинация
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination__item,
.pagination__prev,
.pagination__next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.pagination__item:hover,
.pagination__prev:hover,
.pagination__next:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #333;
    transform: translateY(-1px);
}

.pagination__item--active {
    background: #333;
    border-color: #333;
    color: white;
}

.pagination__item--active:hover {
    background: #444;
    border-color: #444;
    transform: translateY(-1px);
}

.pagination__prev.disabled,
.pagination__next.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination__prev.disabled:hover,
.pagination__next.disabled:hover {
    background: white;
    transform: none;
}

.pagination__dots {
    display: inline-flex;
    align-items: center;
    padding: 0 0.25rem;
    color: #999;
    font-size: 0.9rem;
}

.pagination__info {
    margin-left: 1rem;
    padding: 0 0.75rem;
    color: #888;
    font-size: 0.8rem;
    border-left: 1px solid #e0e0e0;
}

/* Компактная пагинация для мобильных */
@media (max-width: 768px) {

    .pagination__item,
    .pagination__prev,
    .pagination__next {
        min-width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }

    .pagination__info {
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 0.5rem;
        border-left: none;
        padding-top: 0.5rem;
        border-top: 1px solid #e0e0e0;
    }
}

/* Пагинация с иконками */
.pagination__prev i,
.pagination__next i {
    font-size: 0.8rem;
}

/* Анимация загрузки для AJAX пагинации */
.pagination-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s;
}

.pagination-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #333;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Стили для вложений
   ============================================ */

.attachments-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s;
}

.attachment-item:hover {
    background: #e9ecef;
}

.attachment-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.attachment-name a {
    color: #333;
    text-decoration: none;
}

.attachment-name a:hover {
    color: #007bff;
    text-decoration: underline;
}

.attachment-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    color: #888;
    flex-wrap: wrap;
}

.attachment-meta i {
    margin-right: 4px;
}

.attachment-actions {
    flex-shrink: 0;
}

.btn-delete-attachment {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-delete-attachment:hover {
    background: #dc3545;
    color: white;
}

/* Область загрузки файлов */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: #999;
    background: #f8f9fa;
}

.upload-area.highlight {
    border-color: #28a745;
    background: #e8f5e9;
}

.upload-area i {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 1rem;
}

.upload-area p {
    margin-bottom: 0.5rem;
    color: #666;
}

.upload-hint {
    font-size: 0.75rem;
    color: #999;
}

.upload-progress-item {
    padding: 0.5rem;
    background: #e3f2fd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.upload-progress-item.error {
    background: #ffebee;
    color: #dc3545;
}

/* Адаптивность для вложений */
@media (max-width: 768px) {
    .attachment-item {
        flex-wrap: wrap;
    }

    .attachment-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .upload-area {
        padding: 1rem;
    }
}

/* ============================================
   Стили для вкладок пользователей (как в ldap_settings)
   ============================================ */

/* Стили для вкладок пользователей - единый стиль с ldap_settings */
.users-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.users-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.2s;
    font-family: inherit;
}

.users-tab:hover {
    color: #333;
}

.users-tab.active {
    color: #333;
    border-bottom: 2px solid #333;
    font-weight: 600;
}

.users-tab .tab-count {
    display: inline-block;
    background: #e0e0e0;
    border-radius: 20px;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    margin-left: 0.5rem;
    color: #666;
    transition: all 0.2s;
}

.users-tab.active .tab-count {
    background: #333;
    color: white;
}

/* Стили для поиска пользователей */
.users-search {
    margin-bottom: 1.5rem;
}

.users-search form {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.users-search input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.users-search input:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* Адаптивность для вкладок пользователей */
@media (max-width: 768px) {
    .users-tab {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .users-search form {
        flex-direction: column;
    }

    .users-search button {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .users-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    .users-tab .tab-count {
        font-size: 0.6rem;
        padding: 0.1rem 0.35rem;
    }
}

/* ============================================
   Выравнивание агентов в отчетах
   ============================================ */

/* Стили для строки агента в таблице */
.agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Аватары в таблицах отчетов */
.agent-info .user-avatar-small,
.agent-info img {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.agent-info span {
    flex: 1;
    color: #333;
    font-size: 0.85rem;
}

/* Выравнивание текста в ячейках таблиц отчетов */
.data-table td {
    vertical-align: middle;
}

.data-table .text-center {
    text-align: center;
    vertical-align: middle;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Аватар в свёрнутом сайдбаре */
.sidebar.collapsed .user-avatar {
    width: 50px !important;
    height: 50px !important;
    margin: 0 auto;
}

.sidebar.collapsed .user-avatar .user-avatar-img,
.sidebar.collapsed .user-avatar .default-avatar {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.2rem !important;
}

.sidebar.collapsed .sidebar-user {
    padding: 1rem 0;
}

.sidebar.collapsed .user-info-sidebar {
    display: none;
}

/* ============================================
   Дополнительные стили для сайдбара - прокрутка и компактность
   ============================================ */

/* Скролл для сайдбара */
.sidebar {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Кастомизация скроллбара */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: #3c3c3c;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Компактные подпункты меню */
.nav-subitem {
    padding-left: 2rem !important;
    font-size: 0.8rem !important;
}

.nav-group-header {
    padding: 0.6rem 1rem !important;
    font-size: 0.85rem !important;
}

.nav-item {
    padding: 0.6rem 1rem !important;
    font-size: 0.85rem !important;
}

/* Уменьшенные отступы в сайдбаре */
.sidebar-user {
    padding: 0.8rem 1rem !important;
}

.user-avatar {
    width: 80px !important;
    height: 80px !important;
}

.user-name {
    font-size: 0.8rem !important;
}

.user-role {
    font-size: 0.65rem !important;
}

/* Увеличенная максимальная высота группы меню */
.nav-group.open .nav-group-items {
    max-height: 500px !important;
}

/* Для Firefox */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: #666 #3c3c3c;
}