.stats-container {
    padding: 25px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    background: #f0f2f5;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* KPI */
.stats-container .kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stats-container .kpi-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #e5e5e5;
}

.stats-container .kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: #4B70C3;
}

.stats-container .kpi-label {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    margin-top: 5px;
}

/* ПОИСК */
.stats-container .stats-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.stats-container .search-box {
    flex: 1;
}

.stats-container .search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
}

.stats-container .refresh-btn {
    padding: 0 25px;
    background: #4B70C3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.stats-container .refresh-btn:hover {
    background: #3a5aa0;
}

/* ДИАЛОГИ */
.stats-container .dialogs-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 30px;
}

.stats-container .dialog-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

.stats-container .dialog-header {
    background: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-container .dialog-id {
    font-family: monospace;
    font-size: 14px;
    color: #555;
    background: #eee;
    padding: 4px 8px;
    border-radius: 4px;
}

.stats-container .dialog-body {
    padding: 20px;
    background: #fff;
}

/* СООБЩЕНИЯ */
.dialogs-list .msg-row {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #f0f0f0;
}

.dialogs-list .msg-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dialogs-list .role-badge {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

.dialogs-list .role-badge.user {
    background: #e3f2fd;
    color: #1565c0;
}

.dialogs-list .msg-row-user .msg-text {
    color: #111;
}

.dialogs-list .role-badge.bot {
    background: #f3e5f5;
    color: #7b1fa2;
}

.dialogs-list .msg-row-bot .msg-text {
    color: #4a148c;
}

.dialogs-list .role-badge.operator {
    background: #e8f5e9;
    color: #2e7d32;
}

.dialogs-list .msg-row-operator .msg-text {
    color: #1b5e20;
    font-weight: 500;
}

.dialogs-list .msg-text {
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* 🔥 КАРТИНКИ И ФАЙЛЫ 🔥 */
.dialogs-list .stat-img {
    display: block;
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #eee;
    margin-top: 8px;
}

.dialogs-list .stat-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f3f5;
    padding: 8px 14px;
    border-radius: 6px;
    color: #333 !important;
    text-decoration: none !important;
    font-weight: 500;
    border: 1px solid #ddd;
    margin-top: 6px;
}

.dialogs-list a {
    color: #0066cc;
    text-decoration: underline;
}

.dialogs-list a:hover {
    text-decoration: none;
}

/* 🔥 ПАГИНАЦИЯ 🔥 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 20px 0 50px 0;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
}

.page-btn:hover {
    background: #f0f0f0;
}

.page-btn.active {
    background: #4B70C3;
    color: white;
    border-color: #4B70C3;
    font-weight: bold;
}

/* === РЕЙТИНГ В СТАТИСТИКЕ (1-5 ЗВЕЗД) === */

/* Запрос оценки */
.stat-rating-request {
    display: inline-block;
    padding: 6px 12px;
    background: #fff9c4;
    color: #fbc02d;
    border: 1px solid #fff176;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    font-style: italic;
}

/* Базовый стиль бейджа оценки */
.rating-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    margin-top: 4px;
    white-space: nowrap;
    border: 1px solid transparent;
}

/* ★★★★★ - Отлично (Насыщенный зеленый) */
.rating-5 {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #c8e6c9;
}

/* ★★★★☆ - Хорошо (Светло-зеленый) */
.rating-4 {
    background: #f1f8e9;
    color: #558b2f;
    border-color: #dcedc8;
}

/* ★★★☆☆ - Нормально (Желтый) */
.rating-3 {
    background: #fffde7;
    color: #f9a825;
    border-color: #fff59d;
}

/* ★★☆☆☆ - Плохо (Оранжевый) */
.rating-2 {
    background: #fff3e0;
    color: #ef6c00;
    border-color: #ffe0b2;
}

/* ★☆☆☆☆ - Ужасно (Красный) */
.rating-1 {
    background: #ffebee;
    color: #c62828;
    border-color: #ffcdd2;
}

/* Сами звезды внутри */
.rating-stars-icon {
    color: #FFD700;
    /* Золото */
    font-size: 16px;
    margin-right: 6px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* === ОБНОВЛЕННАЯ ПАНЕЛЬ ФИЛЬТРОВ === */
.stats-container .stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    /* Чтобы на мобилке не ломалось */
    gap: 15px;
    margin-bottom: 25px;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #e5e5e5;
}

/* Группа фильтров (Даты, Рейтинг, Оператор) */
.filters-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-container .filter-input,
.stats-container .filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    height: 38px;
    /* Фиксируем высоту чтобы было ровно */
    box-sizing: border-box;
}

.stats-container .filter-input:focus,
.stats-container .filter-select:focus {
    border-color: #4B70C3;
}

/* Поле поиска растягиваем */
.stats-container .search-box {
    flex: 1;
    min-width: 200px;
}

.stats-container .search-box input {
    height: 38px;
    /* Подгоняем высоту под фильтры */
    padding: 0 15px;
}

/* Группа кнопок */
.actions-group {
    display: flex;
    gap: 10px;
}

/* Кнопка Excel */
.stats-container .excel-btn {
    padding: 0 20px;
    height: 38px;
    background: #217346;
    /* Цвет Excel */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.stats-container .excel-btn:hover {
    background: #1a5c38;
}

/* Кнопка Обновить (подгоняем стиль) */
.stats-container .refresh-btn {
    height: 38px;
    padding: 0 15px;
    border-radius: 6px;
    font-size: 18px;
    /* Иконка покрупнее */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Кнопка Сброса */
.stats-container .reset-btn {
    width: 38px;
    height: 38px;
    background: #d32f2f;
    /* Красный */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.stats-container .reset-btn:hover {
    background: #b71c1c;
}

/* Остальные стили для панели (если не добавлял ранее) */
.stats-container .stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #e5e5e5;
    margin-bottom: 25px;
}

.filters-group,
.actions-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-container .filter-input,
.stats-container .filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    height: 38px;
    box-sizing: border-box;
}

.stats-container .search-box {
    flex: 1;
    min-width: 200px;
}

.stats-container .search-box input {
    height: 38px;
    width: 100%;
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.stats-container .excel-btn {
    padding: 0 20px;
    height: 38px;
    background: #217346;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}