* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: #2F2F2F;
    background: #F5F7F7;
}

/* ===== Шапка ===== */
.header {
    background: #1E6F5C;
    color: white;
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    max-width: 1400px;
    margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
    max-height: 46px;
    max-width: 120px;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
}
.brand-name { font-size: 20px; font-weight: 700; }
.brand-sub { font-size: 12px; color: #B8E8E5; margin-top: 2px; }
.header-right { text-align: right; }
.company { font-weight: 700; font-size: 13px; }
.version { font-size: 11px; color: #8FCFCA; margin-top: 2px; }

.accent-bar { height: 3px; background: #28A8A8; }

/* ===== Навигация ===== */
.nav {
    display: flex;
    gap: 4px;
    padding: 12px 28px 0;
    max-width: 1400px;
    margin: 0 auto;
}
.nav-item {
    padding: 10px 20px;
    border-radius: 6px 6px 0 0;
    color: #5F6B6A;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s;
    position: relative;
}
.nav-item:hover { background: #DEF2F2; color: #1E6F5C; }
.nav-item.active { background: #1E6F5C; color: white; }
.badge {
    display: inline-block;
    background: #FF5E5E;
    color: white;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    margin-left: 6px;
}

/* ===== Контейнер ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 28px 40px;
}

/* ===== Заголовки ===== */
.page-title { font-size: 22px; color: #1E6F5C; margin: 0 0 16px; }
.subtitle { color: #94A0A0; margin: -8px 0 20px; }

/* ===== Кнопки ===== */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: #1E6F5C; color: white; }
.btn-primary:hover { background: #155347; }
.btn-secondary {
    background: white;
    color: #1E6F5C;
    border: 1px solid #1E6F5C;
}
.btn-secondary:hover { background: #EDF7F6; }
.btn-accent { background: #28A8A8; color: white; }
.btn-accent:hover { background: #1F8A8A; }
.btn-danger {
    background: white;
    color: #FF5E5E;
    border: 1px solid #FFD1D1;
}
.btn-danger:hover { background: #FFE5E5; border-color: #FF5E5E; }
.btn-ghost { background: transparent; color: #5F6B6A; padding: 5px 10px; }
.btn[type="button"] { cursor: pointer; }

/* ===== Тулбар ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar > div {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.search-form { display: flex; gap: 6px; align-items: center; }

/* ===== Поля ввода ===== */
input[type="text"],
input[type="number"],
input[type="file"],
textarea,
select {
    padding: 8px 12px;
    border: 1px solid #E5E9E8;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #2F2F2F;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #28A8A8;
    box-shadow: 0 0 0 3px rgba(40, 168, 168, 0.15);
}
.input-search { width: 320px; }
.input-qty { width: 75px; text-align: right; }

/* ===== Таблица ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.data-table thead {
    background: #1E6F5C;
    color: white;
}
.data-table th {
    padding: 11px 10px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
}
.data-table td {
    padding: 9px 10px;
    border-top: 1px solid #EEF2F1;
}
.data-table tbody tr:nth-child(even) { background: #FAFBFB; }
.data-table tbody tr:hover { background: #F0F7F6; }
.data-table .center { text-align: center; }
.data-table .right { text-align: right; }
.data-table .actions { text-align: right; white-space: nowrap; }

.inline-form { display: inline-block; }

/* ===== Флеш-уведомления ===== */
.flash {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 14px;
}
.flash-success { background: #DEF2F2; color: #1E6F5C; border-left: 4px solid #28A8A8; }
.flash-error { background: #FFE5E5; color: #CC3D3D; border-left: 4px solid #FF5E5E; }

/* ===== Пустое состояние ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94A0A0;
    background: white;
    border-radius: 8px;
}
.empty-state a { color: #1E6F5C; }
.empty-state .btn { margin: 4px; }

.hint { color: #94A0A0; font-size: 12px; margin-top: 10px; }
.hint a { color: #28A8A8; }

/* ===== Итоги ===== */
.totals {
    margin-top: 20px;
    padding: 16px 24px;
    background: white;
    border-radius: 8px;
    text-align: right;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.totals div { margin: 4px 0; }
.totals strong { color: #1E6F5C; font-size: 16px; }
.total-grand {
    font-size: 18px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #EEF2F1;
}

/* ===== Форма ===== */
.form {
    background: white;
    padding: 24px 28px;
    border-radius: 8px;
    max-width: 640px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.form-row { margin-bottom: 14px; }
.form-row label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #5F6B6A;
    font-size: 13px;
}
.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea { width: 100%; }
.form-row.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    color: #2F2F2F;
    cursor: pointer;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ===== Inline-форма ===== */
.form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.form-inline label {
    font-weight: 600;
    color: #5F6B6A;
    font-size: 13px;
}

/* ===== Логотип ===== */
.logo-preview {
    margin: 8px 0;
    padding: 10px;
    background: #FAFBFB;
    border-radius: 6px;
    display: inline-block;
}

/* ===== Карточка ===== */
.card {
    background: white;
    padding: 24px 28px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card h2 { color: #1E6F5C; margin-top: 0; }
.card h3 { color: #28A8A8; margin-bottom: 8px; }
.card p, .card li { line-height: 1.6; }
.card ul, .card ol { padding-left: 22px; }
.card ol li { margin-bottom: 6px; }
.card a { color: #28A8A8; }
.contacts { background: #DEF2F2; }

/* ===== Код в тексте ===== */
code {
    background: #F0F5F2;
    padding: 2px 6px;
    border-radius: 3px;
    color: #1E6F5C;
    font-family: 'Consolas', monospace;
    font-size: 13px;
}

/* ===== Футер ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: #94A0A0;
    font-size: 12px;
}
/* Бейдж "Черновик" */
.badge-draft {
    background: #F59E0B;
    color: white;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}
/* Дашборд */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #ffffff;
    padding: 30px 20px;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #e2e8e5;
    transition: all 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(30, 111, 92, 0.15);
    border-color: #1E6F5C;
}

.card-icon {
    font-size: 42px;
    margin-bottom: 15px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1E6F5C;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
}

/* ==================== МЕССЕНДЖЕР ==================== */
.chat-sidebar {
    position: fixed;
    top: 160px; /* Опустили ниже, чтобы не перекрывать шапку */
    right: 15px;
    z-index: 990;
}

.chat-sidebar-inner {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 6px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    
    /* Добавили прокрутку, если сотрудников много */
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* Прячем некрасивый скроллбар у панели */
.chat-sidebar-inner::-webkit-scrollbar {
    display: none;
}
.chat-sidebar-inner {
    -ms-overflow-style: none;  /* IE и Edge */
    scrollbar-width: none;  /* Firefox */
}

.chat-sidebar-inner {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px 6px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-decoration: none;
}
.chat-avatar:hover { transform: scale(1.1); }
.chat-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    border: 2px solid #fff;
    display: none; /* По умолчанию скрыт */
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

.chat-window {
    position: fixed;
    bottom: 20px;
    right: 80px;
    width: 320px;
    height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #e2e8e5;
}

.chat-header {
    padding: 12px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}
.chat-mine {
    align-self: flex-end;
    background: #DEF2F2;
    color: #1E6F5C;
    border-bottom-right-radius: 2px;
}
.chat-theirs {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8e5;
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    display: flex;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e2e8e5;
    gap: 8px;
}
.chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8e5;
    border-radius: 20px;
    outline: none;
    font-size: 13px;
}
.chat-input-area input:focus { border-color: #1E6F5C; }

/* Чтобы контент не залезал под панель справа */
.container {
    padding-right: 80px !important;
}

/* ==================== ПОЛНОЭКРАННЫЙ МЕССЕНДЖЕР ==================== */
.messenger-container {
    display: flex;
    height: calc(100vh - 160px); /* Занимает почти весь экран */
    min-height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #e2e8e5;
    overflow: hidden;
    margin-top: 10px;
}

/* Левая колонка */
.messenger-sidebar {
    width: 320px;
    background: #f8fafc;
    border-right: 1px solid #e2e8e5;
    display: flex;
    flex-direction: column;
}

.messenger-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8e5;
    background: #fff;
}

.messenger-search {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e2e8e5;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    box-sizing: border-box;
    background: #f8fafc;
}
.messenger-search:focus { border-color: #1E6F5C; background: #fff; }

.contact-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}
.contact-item:hover { background: #f0fdf4; }
.contact-item.active { background: #DEF2F2; }

.contact-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.contact-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.contact-info { flex: 1; overflow: hidden; }
.contact-name { font-weight: bold; font-size: 14px; color: #1E293B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-status { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Правая колонка */
.messenger-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f4f7f6;
}

.messenger-chat-header {
    padding: 15px 25px;
    background: #fff;
    border-bottom: 1px solid #e2e8e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.messenger-chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="1.5" fill="%23e2e8e5" /></svg>');
}

.messenger-bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    position: relative;
}
.messenger-bubble.mine {
    align-self: flex-end;
    background: #DEF2F2;
    color: #1E6F5C;
    border-bottom-right-radius: 2px;
}
.messenger-bubble.theirs {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8e5;
    border-bottom-left-radius: 2px;
}
.bubble-time {
    font-size: 10px;
    color: #94a0a0;
    text-align: right;
    margin-top: 5px;
}

.messenger-chat-input {
    padding: 15px 25px;
    background: #fff;
    border-top: 1px solid #e2e8e5;
    display: flex;
    gap: 15px;
}
.messenger-chat-input input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #e2e8e5;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    background: #f8fafc;
}
.messenger-chat-input input:focus { border-color: #1E6F5C; background: #fff; }
/* Кнопка Назад/Закрыть в стиле Битрикс24 */
.bitrix-close-btn {
    position: fixed;
    top: 140px; /* Опускаем чуть ниже шапки */
    left: 20px; /* Прижимаем к левому краю */
    width: 48px;
    height: 48px;
    border-radius: 50%; /* Делаем идеальный круг */
    background: #2E8BEF; /* Яркий синий цвет */
    color: white;
    border: none;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(46, 139, 239, 0.4); /* Легкая тень */
    z-index: 1000;
    transition: all 0.2s ease;
}

.bitrix-close-btn:hover {
    background: #1C6ED5; /* Темнеет при наведении */
    transform: scale(1.05); /* Чуть-чуть увеличивается */
}

/* Чтобы кнопка не перекрывала список чатов, сдвинем контейнер мессенджера вправо */
.messenger-container {
    margin-left: 70px; /* Освобождаем место для кнопки */
}

/* --- ИСПРАВЛЕНИЕ МЕССЕНДЖЕРА --- */

/* 1. Переопределяем кнопку, чтобы она была аккуратной и внутри блока */
.bitrix-close-btn {
    position: static !important; /* Убираем намертво прибитое положение */
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    background: #2E8BEF !important;
    box-shadow: 0 2px 5px rgba(46, 139, 239, 0.3) !important;
    margin: 0 !important;
}

/* 2. Убираем сдвиг контейнера влево */
.messenger-container {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* 3. Заставляем правую часть (сам чат) растянуться на всё оставшееся место */
.messenger-main {
    flex: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* --- ПОЛНАЯ ОЧИСТКА И ФИКС МЕССЕНДЖЕРА --- */
.messenger-container {
    display: flex !important;
    height: calc(100vh - 160px) !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #f4f7f6 !important; /* Серый фон для всего окна */
    border-radius: 8px !important;
    overflow: hidden !important;
    border: 1px solid #e2e8e5 !important;
}

.messenger-sidebar {
    background: #fff !important;
    width: 320px !important;
    flex-shrink: 0 !important;
    border-right: 1px solid #e2e8e5 !important;
    display: flex !important;
    flex-direction: column !important;
}

.messenger-sidebar-header {
    padding: 15px 20px !important;
    background: #fff !important;
    border-bottom: 1px solid #e2e8e5 !important;
    margin: 0 !important;
}

.messenger-main {
    flex: 1 !important;
    background: #f4f7f6 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    margin: 0 !important;
}

#chatPlaceholder {
    background: #f4f7f6 !important;
    flex: 1 !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Убираем лишние отступы у заголовка страницы, если он мешает */
.messenger-container + * {
    display: none;
}

/* --- ЖЕСТКИЙ ФИКС СЪЕЗЖАЮЩЕГО ЧАТА --- */
#chatPlaceholder {
    display: flex; /* Без !important, чтобы JS мог его скрыть */
}
#activeChatArea {
    flex: 1;
    height: 100%;
    overflow: hidden;
}
.messenger-chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Заставляет скроллиться только сообщения, а не весь экран */
}
.messenger-chat-input {
    flex-shrink: 0; /* Поле ввода всегда прижато к низу */
}

/* Синий индикатор онлайна */
.online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background-color: #3b82f6; /* Ярко-синий цвет */
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 5;
}

/* Кнопка "Новое сообщение" */
.messenger-main {
    position: relative; /* Чтобы кнопка позиционировалась относительно чата */
}

.scroll-btn {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #1E6F5C;
    border: 1px solid #e2e8e5;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    z-index: 100;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.2s;
}
.scroll-btn:hover {
    background: #f8fafc;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* ==================================================== */
/* ========== ГЛОБАЛЬНОЕ ОБНОВЛЕНИЕ ДИЗАЙНА ========== */
/* ==================================================== */

/* 1. Градиентная шапка сайта */
.header {
    background: linear-gradient(135deg, #1E6F5C 0%, #155E4B 100%) !important;
    box-shadow: 0 4px 15px rgba(30, 111, 92, 0.2);
}
.accent-bar {
    background: linear-gradient(90deg, #1E6F5C, #2E8BEF, #1E6F5C) !important;
    background-size: 200% 100%;
    animation: gradientMove 5s linear infinite;
}
@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* 2. Красивые кнопки с градиентом и анимацией */
.btn {
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    border: none !important;
    font-weight: 600 !important;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15) !important;
}

.btn-primary {
    background: linear-gradient(135deg, #1E6F5C 0%, #2E8BEF 100%) !important;
    color: white !important;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #155E4B 0%, #1C6ED5 100%) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}

/* 3. Плитки на Дашборде (эффект при наведении) */
.dashboard-card {
    background: #ffffff !important;
    border: 1px solid #e2e8e5 !important;
    border-radius: 16px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}
.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #1E6F5C, #2E8BEF);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 30px rgba(30, 111, 92, 0.15) !important;
    border-color: #DEF2F2 !important;
}
.dashboard-card:hover::before {
    opacity: 1;
}
.card-icon {
    font-size: 46px !important;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

/* 4. Таблицы (База, Пользователи, История) */
.data-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e2e8e5;
    background: #fff;
}
.data-table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #1E6F5C !important;
    font-weight: 700;
    border-bottom: 2px solid #e2e8e5 !important;
    padding: 15px 12px !important;
}
.data-table tbody tr {
    transition: background 0.2s;
}
.data-table tbody tr:hover {
    background: #f8fafc !important;
}

/* 5. Карточки (формы, профили) */
.card {
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04) !important;
    border: 1px solid #e2e8e5 !important;
}

/* 6. Поля ввода */
.form-row input, .form-row select, .form-row textarea {
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    transition: all 0.2s;
    background: #f8fafc !important;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    background: #fff !important;
    border-color: #1E6F5C !important;
    box-shadow: 0 0 0 4px rgba(30, 111, 92, 0.1) !important;
    outline: none;
}

/* 7. Панель "Главная / Назад" */
.sub-nav {
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    z-index: 10;
    position: relative;
}

/* 8. Мессенджер (сайдбар и контакты) */
.contact-item.active {
    background: linear-gradient(135deg, #f0fdf4 0%, #DEF2F2 100%) !important;
    border-left: 4px solid #1E6F5C;
}
.chat-sidebar-inner {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.messenger-bubble.mine {
    background: linear-gradient(135deg, #DEF2F2 0%, #ccf0e8 100%) !important;
}

/* ==================================================== */
/* ========== СОВРЕМЕННЫЙ ДИЗАЙН ВЕРХНЕЙ ПАНЕЛИ ======= */
/* ==================================================== */

/* Сама белая панель: эффект матового стекла */
.sub-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.85) !important; /* Полупрозрачный белый */
    backdrop-filter: blur(12px) !important; /* Размытие фона (эффект стекла) */
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03) !important;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Кнопки в виде пилюль (Назад, Главная) */
.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8e5;
    border-radius: 20px; /* Форма пилюли */
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.nav-pill:hover {
    background: #fff;
    border-color: #1E6F5C;
    color: #1E6F5C;
    box-shadow: 0 4px 10px rgba(30, 111, 92, 0.1);
    transform: translateY(-1px);
}

/* Профиль пользователя (Аватар + Имя + Роль) */
.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 15px 5px 5px;
    background: #f8fafc;
    border: 1px solid #e2e8e5;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.2s;
}
.user-chip:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}
.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-name {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
}
.user-role {
    font-size: 11px;
    color: #64748b;
}

/* Кнопки справа (Ключ и Выход) */
.nav-actions {
    display: flex;
    gap: 8px;
    margin-left: 10px;
    padding-left: 15px;
    border-left: 1px solid #e2e8e5;
}
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    text-decoration: none;
    font-size: 18px;
    transition: background 0.2s;
}
.btn-icon:hover {
    background: #f1f5f9;
}

/* ==================================================== */
/* ========== ОБЪЕМНАЯ 3D ШАПКА САЙТА ================= */
/* ==================================================== */
.header {
    background: linear-gradient(135deg, #1b6352 0%, #124235 100%) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    position: relative;
    z-index: 10;
}

/* Легкий блик сверху для эффекта объема */
.header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.header-inner {
    position: relative;
    z-index: 2; /* Чтобы текст был поверх блика */
}

/* ==================================================== */
/* ========== ФИКС КНОПОК (УДАЛИТЬ И ОТМЕНА) ========== */
/* ==================================================== */

/* Красная кнопка "Удалить" */
.btn-danger {
    background: #ef4444 !important; /* Яркий красный */
    color: #ffffff !important; /* Чистый белый текст */
    border: 1px solid #dc2626 !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3) !important;
}
.btn-danger:hover {
    background: #dc2626 !important; /* Темнеет при наведении */
    color: #ffffff !important;
}

/* Серая кнопка "Отмена" / "Назад" */
.btn-secondary {
    background: #f1f5f9 !important; /* Светло-серый */
    color: #334155 !important; /* Темно-серый текст */
    border: 1px solid #cbd5e1 !important;
}
.btn-secondary:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Исправление: аватары без фотографии тоже должны быть круглыми */
.chat-avatar,
.contact-avatar,
.nav-avatar {
    border-radius: 50% !important;
    overflow: hidden;
    box-sizing: border-box;
}

.chat-avatar > div,
.contact-avatar > div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.chat-avatar img,
.contact-avatar img,
.nav-avatar img {
    border-radius: 50%;
    object-fit: cover;
}

/* CRM: увеличенные карточки разделов */
.crm-module-grid {
    gap: 20px !important;
}

.crm-module-card {
    min-height: 125px !important;
    padding: 25px 22px !important;
    gap: 18px !important;
    border-radius: 14px !important;
    box-sizing: border-box;
}

.crm-module-icon {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    font-size: 28px !important;
    border-radius: 13px !important;
}

.crm-module-name {
    font-size: 18px !important;
    margin-bottom: 8px !important;
}

.crm-module-description {
    font-size: 14px !important;
    line-height: 1.5;
}

@media (max-width: 850px) {
    .crm-module-card {
        min-height: 100px !important;
        padding: 18px !important;
    }
}


/* CRM: полноширинная рабочая область */
main.container.crm-wide-container {
    max-width: none !important;
    width: 100%;
    margin: 0 !important;
    padding: 12px 80px 32px 8px !important;
    box-sizing: border-box;
}

.crm-wide-container > .crm-shell {
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    box-sizing: border-box;
}

.crm-wide-container .crm-main-area {
    min-width: 0;
}





/* Hide the global footer only on the full-height CRM contacts workspace. */
.crm-contacts-footer-hidden { display: none !important; }

/* EKOTERM GLOBAL DANGER BUTTONS V1 */

/* Единый яркий стиль опасных действий на всём сайте */
.btn-danger {
    background: linear-gradient(135deg, #FF5E5E 0%, #FF7770 100%) !important;
    background-color: #FF5E5E !important;
    color: #FFFFFF !important;
    border: 1px solid #F04444 !important;
    box-shadow: 0 4px 11px rgba(255, 94, 94, .24) !important;
    transition: background .2s ease, box-shadow .2s ease,
                transform .2s ease, border-color .2s ease !important;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #F04444 0%, #E53E3E 100%) !important;
    background-color: #F04444 !important;
    color: #FFFFFF !important;
    border-color: #E53E3E !important;
    box-shadow: 0 6px 15px rgba(255, 94, 94, .34) !important;
}

.btn-danger:active {
    transform: translateY(0) scale(.98);
}

.btn-danger:focus-visible {
    outline: 3px solid rgba(255, 94, 94, .28) !important;
    outline-offset: 2px;
}

.btn-danger:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none !important;
}



/* EKOTERM HEADER AND NAVIGATION THEME V1 */

.header {
    background: linear-gradient(115deg,#125D4D,#147C67,#20A596) !important;
    border-bottom: 1px solid rgba(255,255,255,.18) !important;
    box-shadow: 0 7px 24px rgba(16,91,73,.20) !important;
}

.header-inner {
    min-height: 76px;
    max-width: 1600px !important;
    padding: 14px 30px !important;
    box-sizing: border-box;
}

.brand-name {
    color: #fff !important;
    font-size: 23px !important;
    font-weight: 800 !important;
    letter-spacing: .35px;
}

.brand-sub { color: #D1F6E9 !important; }
.header-right .company { color: #fff !important; }
.header-right .version { color: #C5EEE2 !important; }

.brand-logo {
    border-radius: 10px !important;
    box-shadow: 0 3px 12px rgba(0,0,0,.14);
}

.accent-bar {
    height: 4px !important;
    background: linear-gradient(90deg,#27B7B2,#B8F1DF,#69D7B6,#27B7B2) !important;
}

.sub-nav {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 10px 30px !important;
    background: rgba(249,255,252,.97) !important;
    border-bottom: 1px solid #D9EEE5 !important;
    box-shadow: 0 5px 18px rgba(24,91,72,.07) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.nav-left,.nav-right {
    display: flex;
    align-items: center;
    gap: 10px !important;
    min-width: 0;
}

.sub-nav .nav-pill {
    min-height: 38px;
    padding: 8px 16px !important;
    border: 1px solid #C9E7DB !important;
    border-radius: 11px !important;
    background: linear-gradient(135deg,#fff,#EFF9F4) !important;
    color: #176B59 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-decoration: none;
    transition: .2s ease;
}

.sub-nav .nav-pill:hover {
    background: linear-gradient(135deg,#DDF8EC,#C7F0E3) !important;
    border-color: #72CDB4 !important;
    color: #105D4B !important;
    box-shadow: 0 5px 13px rgba(25,132,101,.14);
    transform: translateY(-1px);
}

.sub-nav .nav-pill[href*="logout"] {
    background: linear-gradient(135deg,#FF5E5E,#FF7770) !important;
    border-color: #F04444 !important;
    color: #fff !important;
}

.sub-nav .nav-pill[href*="logout"]:hover {
    background: linear-gradient(135deg,#F04444,#E53E3E) !important;
}

.sub-nav .user-chip {
    gap: 11px;
    padding: 5px 16px 5px 6px !important;
    border: 1px solid #CDE9DD !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg,#fff,#EFFAF5) !important;
    box-shadow: 0 3px 10px rgba(24,103,78,.06);
    transition: .2s ease;
}

.sub-nav .user-chip:hover {
    background: linear-gradient(135deg,#fff,#DDF6EA) !important;
    border-color: #7ACDB0 !important;
    box-shadow: 0 5px 15px rgba(24,103,78,.12);
}

.sub-nav .nav-avatar {
    width: 39px !important;
    height: 39px !important;
    border: 2px solid #fff;
}

.sub-nav .user-name {
    color: #185C4D !important;
    font-size: 13px !important;
    font-weight: 750 !important;
}

.sub-nav .user-role {
    color: #719187 !important;
    font-size: 11px !important;
}

@media (max-width: 850px) {
    .header-inner { padding: 13px 18px !important; }
    .sub-nav {
        padding: 10px 18px !important;
        flex-wrap: wrap;
    }
    .nav-left,.nav-right {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .nav-right > div { margin-left: 0 !important; }
}

@media (max-width: 560px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px !important;
    }
    .brand-name { font-size: 20px !important; }
    .header-right { text-align: left !important; }
    .sub-nav {
        flex-direction: column;
        align-items: stretch !important;
        padding: 10px 12px !important;
    }
    .nav-left,.nav-right {
        width: 100%;
        justify-content: space-between;
    }
    .sub-nav .user-chip { flex: 1 1 auto; min-width: 0; }
    .sub-nav .nav-pill {
        padding: 8px 11px !important;
        font-size: 12px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sub-nav *,
    .accent-bar {
        animation: none !important;
        transition: none !important;
    }
}


/* PERMANENT PROFILE AVATAR BUTTON STYLE */
.profile-avatar-upload label.profile-avatar-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    min-height: 36px !important;
    padding: 8px 14px !important;
    border: 1px solid #1E6F5C !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #1E6F5C 0%, #2E8BEF 100%) !important;
    background-image: linear-gradient(135deg, #1E6F5C 0%, #2E8BEF 100%) !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transition: filter .2s ease, transform .2s ease !important;
}

.profile-avatar-upload label.profile-avatar-button:hover {
    background: linear-gradient(135deg, #155E4B 0%, #1C6ED5 100%) !important;
    background-image: linear-gradient(135deg, #155E4B 0%, #1C6ED5 100%) !important;
    color: #fff !important;
    filter: brightness(1.04);
}

.profile-avatar-upload label.profile-avatar-button:active {
    transform: scale(.98);
}
