/* ===== ПЕРЕМЕННЫЕ ===== */
:root {
    --bg-body: #0a0a1a;
    --bg-container: #12122a;
    --bg-card: #0f0f23;
    --bg-input: #1a1a3a;
    --border-color: #2a2a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #8888aa;
    --text-accent: #00ff88;
    --text-accent2: #4488ff;
    --shadow: 0 8px 40px rgba(0,0,0,0.6);
    --btn-bg: #2a2a4a;
    --btn-hover: #00ff88;
    --btn-hover-text: #0a0a1a;

    /* ===== ДОБАВИТЬ ДЛЯ ГРАФИКА ===== */
    --chart-bar-active: #00ff88;
    --chart-bar-inactive: #4a6cf7;
    --chart-bar-inactive-opacity: 0.4;
    --chart-bar-empty: #1a1a2e;
    --chart-tooltip-bg: #1a1a2e;
    --chart-tooltip-text: #e0e0e0;
    --chart-tooltip-border: #2a2a4a;

    --chart-bg: var(--bg-secondary, #0d0d1a);
    --chart-bar-empty: var(--bg-tertiary, #1a1a2e);
    --chart-bar-active: #00ff88;
    --chart-bar-inactive: #4a6cf7;
    --chart-tooltip-bg: var(--bg-secondary, #1a1a2e);
    --chart-tooltip-color: var(--text-primary, #e0e0e0);
    --chart-tooltip-border: var(--border-color, #2a2a4a);
    --chart-marker-color: var(--text-tertiary, #333);
    --chart-marker-active: var(--accent-color, #4a6cf7);
    --chart-marker-inactive: var(--bg-tertiary, #1a1a2e);
    --chart-label-color: var(--text-tertiary, #2a2a3a);
    --chart-toast-bg: rgba(0, 255, 136, 0.2);
    --chart-toast-border: rgba(0, 255, 136, 0.4);
    --chart-toast-color: #00ff88;
}

/* ===== СВЕТЛАЯ ТЕМА ===== */
body.light-theme {
    --bg-body: #f0f2f5;
    --bg-container: #ffffff;
    --bg-card: #f8f9fa;
    --bg-input: #ffffff;
    --bg-hover: #e9ecef;
    --border-color: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-accent: #00b86b;
    --text-accent2: #0d6efd;
    --shadow: 0 8px 40px rgba(0,0,0,0.1);
    --modal-bg: rgba(0,0,0,0.5);
    --scrollbar-track: #e9ecef;
    --scrollbar-thumb: #adb5bd;
    --scrollbar-thumb-hover: #6c757d;
    --btn-bg: #e9ecef;
    --btn-hover: #00b86b;
    --btn-hover-text: #ffffff;
    --toast-bg: #ffffff;
    --toast-border: #00b86b;
    --toast-text: #00b86b;
    --post-item-bg: #f8f9fa;
    --post-item-hover: #e9ecef;
}
/* ===== СВЕТЛАЯ ТЕМА ДЛЯ ГРАФИКА ===== */
body.light-theme {
    --chart-bg: #f0f0f8;
    --chart-bar-empty: #e8e8f0;
    --chart-bar-active: #2d7a4a;
    --chart-bar-inactive: #4a6cf7;
    --chart-tooltip-bg: #f0f0f8;
    --chart-tooltip-color: #1a1a2e;
    --chart-tooltip-border: #d0d0e0;
    --chart-marker-color: #888;
    --chart-marker-active: #4a6cf7;
    --chart-marker-inactive: #ccc;
    --chart-label-color: #888;
    --chart-toast-bg: rgba(45, 122, 74, 0.15);
    --chart-toast-border: rgba(45, 122, 74, 0.3);
    --chart-toast-color: #2d7a4a;
}

/* Применяем переменные к элементам графика */
.chart-block {
    background: var(--chart-bg) !important;
}

.chart-block .bar {
    background: var(--chart-bar-empty) !important;
}

.chart-block .bar.active {
    background: var(--chart-bar-active) !important;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.chart-block .bar.inactive {
    background: var(--chart-bar-inactive) !important;
    opacity: 0.4;
}

.chart-block .bar-tooltip {
    background: var(--chart-tooltip-bg) !important;
    color: var(--chart-tooltip-color) !important;
    border-color: var(--chart-tooltip-border) !important;
}

.chart-block .year-marker {
    color: var(--chart-marker-color) !important;
}

.chart-block .year-marker.active {
    color: var(--chart-marker-active) !important;
}

.chart-block .year-marker.inactive {
    color: var(--chart-marker-inactive) !important;
}

.chart-block .bar-label {
    color: var(--chart-label-color) !important;
}

.chart-bar-toast {
    background: var(--chart-toast-bg) !important;
    border-color: var(--chart-toast-border) !important;
    color: var(--chart-toast-color) !important;
}

.chart-bar-toast::after {
    border-top-color: var(--chart-toast-border) !important;
}
/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    padding: 16px;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-container);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    position: relative;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title h1 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-accent), var(--text-accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-title .badge {
    font-size: 12px;
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 2px 12px;
    border-radius: 20px;
    -webkit-text-fill-color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-actions .btn-icon {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-actions .btn-icon:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
}

.header-actions .btn-icon .label {
    font-size: 12px;
    font-weight: 500;
}

.header-actions .btn-music.playing {
    border-color: var(--text-accent);
    color: var(--text-accent);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== FILTERS ===== */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: background 0.3s, border-color 0.3s;
}

.filters label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.filters select,
.filters input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    min-width: 100px;
}

.filters select:focus,
.filters input:focus {
    outline: none;
    border-color: var(--text-accent);
    box-shadow: 0 0 20px rgba(0,255,136,0.1);
}

.filters select option {
    background: var(--bg-input);
}

.filters .btn {
    background: var(--btn-bg);
    color: var(--text-accent);
    border: 1px solid var(--text-accent);
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    font-weight: 500;
}

.filters .btn:hover {
    background: var(--btn-hover);
    color: var(--btn-hover-text);
    box-shadow: 0 0 25px rgba(0,255,136,0.3);
}

.filters .btn-secondary {
    border-color: var(--text-accent2);
    color: var(--text-accent2);
}

.filters .btn-secondary:hover {
    background: var(--text-accent2);
    color: #ffffff;
    box-shadow: 0 0 25px rgba(68,136,255,0.3);
}

.filters .btn-year {
    border-color: var(--border-color);
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 13px;
}

.filters .btn-year:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
}

.filters .btn-year.active {
    border-color: var(--text-accent);
    color: var(--text-accent);
    background: var(--text-accent);
    color: var(--btn-hover-text);
}

.filters .date-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters .date-group input[type="date"] {
    min-width: 140px;
    padding: 8px 12px;
}

.filters .quick-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filters .quick-btns .btn-small {
    padding: 5px 14px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.filters .quick-btns .btn-small:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
}

.filters .quick-btns .btn-small.active {
    border-color: var(--text-accent);
    color: var(--text-accent);
    background: var(--text-accent);
    color: var(--btn-hover-text);
}

.filters .year-btns {
    display: flex;
    gap: 6px;
}

.filters .year-btns .btn-year {
    padding: 5px 14px;
    font-size: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.filters .year-btns .btn-year:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
}

.filters .year-btns .btn-year.active {
    border-color: var(--text-accent);
    color: var(--text-accent);
    background: var(--text-accent);
    color: var(--btn-hover-text);
}

.filters .btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ===== SEARCH ===== */
.search-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-container);
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s, border-color 0.3s;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 12px 6px 16px;
    transition: all 0.3s;
    max-width: 500px;  /* ← было 400px */
    min-width: 300px;  /* ← добавить */
}

.search-container:focus-within {
    border-color: var(--text-accent);
    box-shadow: 0 0 20px rgba(0,255,136,0.1);
}

.search-container .search-icon {
    color: var(--text-secondary);
    font-size: 16px;
    flex-shrink: 0;
}

.search-container input[type="text"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 0;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    min-width: 250px;
    outline: none;
}

.search-container input[type="text"]::placeholder {
    color: var(--text-secondary);
}

.search-container .clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    transition: color 0.3s;
    display: none;
    flex-shrink: 0;
}

.search-container .clear-btn:hover {
    color: #ff4444;
}

.search-container .clear-btn.visible {
    display: block;
}

.search-container .search-count {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== STATS BAR ===== */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: var(--bg-card);
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: background 0.3s, border-color 0.3s;
}

.stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.stats-bar .stat-item .num {
    font-weight: 700;
    font-size: 20px;
    color: var(--text-accent);
}

.stats-bar .stat-item .label {
    color: var(--text-secondary);
}
/* ===== TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 420px;
    position: relative;

}

.table-wrapper .loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 12px;
    min-height: 350px;
    padding: 40px 20px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

/* 🔥 ГЛАВНОЕ: фиксируем высоту tbody */
#tableBody {
    display: table-row-group;
    min-height: 350px;
}

#tableBody tr {
    display: table-row;
}

#tableBody td {
    display: table-cell;
}

thead {
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.3s;
}

thead th.sortable:hover {
    color: var(--text-accent);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody td {
    padding: 12px 16px;
    vertical-align: middle;
}
tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody td {
    padding: 12px 16px;
    vertical-align: middle;
}

tbody td.helper-name {
    font-weight: 600;
    color: var(--text-accent);
}

tbody td .count {
    display: inline-block;
    background: var(--text-accent);
    color: var(--btn-hover-text);
    padding: 2px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 16px;
    min-width: 30px;
    text-align: center;
}




/* ===== ФИКСАЦИЯ ВЫСОТЫ ТАБЛИЦЫ ===== */
#tableBody {
    display: table-row-group;
    min-height: 400px !important;
    height: auto !important;
}

#tableBody tr {
    display: table-row;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
}

#tableBody td {
    display: table-cell;
    height: 38px !important;
    padding: 4px 6px !important;
    vertical-align: middle !important;
}

/* Заглушка при загрузке */
#placeholderRow td {
    height: 400px !important;
    min-height: 400px !important;
}

/* Строки данных */
#tableBody tr:not(#placeholderRow) {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
}

/* Убираем моргание при сортировке */
#tableBody {
    transition: none !important;
}

.table-wrapper {
    position: relative;
    overflow-x: auto;
    min-height: 420px;
}

/* Спиннер поверх таблицы */
.table-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-card, rgba(15, 15, 35, 0.9));
    padding: 20px 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #2a2a4a);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    pointer-events: none;
}

.table-loader.show {
    display: flex;
}

.table-loader .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, #2a2a4a);
    border-top-color: var(--text-accent, #00ff88);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.table-loader .label {
    color: var(--text-secondary, #8888aa);
    font-size: 13px;
    font-weight: 500;
}


tbody td .count.gold {
    background: #FF7800 !important;
    color: #1a1a2e !important;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.3);
}

tbody td .count.silver {
    background: #c0c0c0 !important;
    color: #1a1a2e !important;
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.2);
}

tbody td .count.bronze {
    background: #A4794E !important;
    color: #1a1a2e !important;
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.2);
}

/* 4+ место - СПОКОЙНЫЙ СИНЕ-СЕРЫЙ */
tbody td .count.default {
    background: #3A4A6B !important;
    color: #C8D0E0 !important;
    box-shadow: none;
}


/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-container);
    color: var(--text-accent);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--text-accent);
    cursor: pointer;
    font-size: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    z-index: 999;
}

.back-to-top:hover {
    background: var(--text-accent);
    color: var(--btn-hover-text);
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(0,255,136,0.3);
}

.back-to-top.show {
    display: flex;
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading .spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    backdrop-filter: blur(8px);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    justify-content: center;
    align-items: flex-start;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-container);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    margin: 40px auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    animation: modalIn 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-accent);
}

.modal-header .close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0 8px;
}

.modal-header .close-btn:hover {
    color: #ff4444;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .helper-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-body .helper-stats .stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.modal-body .helper-stats .stat .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-accent);
}

.modal-body .helper-stats .stat .label {
    color: var(--text-secondary);
    font-size: 13px;
}

.modal-body .post-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-body .post-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 16px;
    background: var(--post-item-bg);
    border-radius: 8px;
    border-left: 3px solid var(--text-accent);
    transition: background 0.2s;
}

.modal-body .post-item:hover {
    background: var(--post-item-hover);
}

.modal-body .post-item .post-id {
    color: var(--text-accent2);
    font-weight: 600;
    font-size: 13px;
    min-width: 60px;
}

.modal-body .post-item .post-id a {
    color: var(--text-accent2);
    text-decoration: none;
}

.modal-body .post-item .post-id a:hover {
    text-decoration: underline;
}

.modal-body .post-item .post-date {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 80px;
}

.modal-body .post-item .post-trigger {
    color: var(--text-primary);
    font-size: 13px;
    flex: 1;
    min-width: 150px;
    word-break: break-word;
}

.modal-body .post-item .post-type {
    font-size: 11px;
    background: var(--border-color);
    color: var(--text-secondary);
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.modal-body .helper-link {
    display: inline-block;
    margin-bottom: 16px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    color: var(--text-accent2);
    text-decoration: none;
    font-size: 13px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.modal-body .helper-link:hover {
    border-color: var(--text-accent2);
    background: var(--bg-hover);
}

.modal-body .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* ===== MODAL SEARCH ===== */
.modal-search {
    position: sticky;
    top: 0;
    background: var(--bg-container);
    z-index: 20;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.modal-search .search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 12px 6px 16px;
    transition: all 0.3s;
    max-width: 100% !important;
}

.modal-search .search-container:focus-within {
    border-color: var(--text-accent);
    box-shadow: 0 0 20px rgba(0,255,136,0.1);
}

.modal-search .search-container .search-icon {
    color: var(--text-secondary);
    font-size: 16px;
    flex-shrink: 0;
}

.modal-search .search-container input {
    background: transparent !important;
    border: none !important;
    color: var(--text-primary) !important;
    padding: 8px 0 !important;
    font-size: 14px !important;
    font-family: inherit !important;
    width: 100% !important;
    outline: none !important;
    min-width: 100px !important;
}

.modal-search .search-container input::placeholder {
    color: var(--text-secondary);
}

.modal-search .search-container .clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    transition: color 0.3s;
    display: none;
    flex-shrink: 0;
}

.modal-search .search-container .clear-btn:hover {
    color: #ff4444;
}

.modal-search .search-container .clear-btn.visible {
    display: block;
}

.modal-search .search-container .search-count {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== INFO BANNER ===== */
.info-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: var(--shadow);
    font-size: 13px;
    color: var(--text-secondary);
    z-index: 500;
    max-width: 280px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-banner .icon {
    font-size: 20px;
}

.info-banner .close-banner {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    transition: color 0.3s;
}

.info-banner .close-banner:hover {
    color: #ff4444;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--toast-bg);
    color: var(--toast-text);
    padding: 12px 24px;
    border-radius: 10px;
    border: 1px solid var(--toast-border);
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    box-shadow: var(--shadow);
}

.toast.show {
    opacity: 1;
}

.toast.error {
    border-color: #ff4444;
    color: #ff4444;
}

/* ===== NO DATA ===== */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-data .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ===== MUSIC PLAYER HIDDEN ===== */
#bgMusic {
    display: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 12px;
        border-radius: 12px;
    }
    .header-title h1 {
        font-size: 17px;
    }
    .header-actions .btn-icon .label {
        display: none;
    }
    .filters {
        padding: 12px 14px;
        gap: 8px;
    }
    .filters label {
        font-size: 12px;
    }
    .filters select,
    .filters input {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 80px;
        width: 100%;
        max-width: 100%;
    }
    .filters .date-group {
        flex-wrap: wrap;
        width: 100%;
    }
    .filters .date-group input[type="date"] {
        min-width: 120px;
        flex: 1;
    }
    .filters .quick-btns .btn-small {
        padding: 4px 10px;
        font-size: 11px;
    }
    .filters .year-btns .btn-year {
        padding: 4px 10px;
        font-size: 11px;
    }
    .filters .btn {
        padding: 6px 14px;
        font-size: 13px;
        width: 100%;
    }
    .filters .btn-group {
        display: flex;
        gap: 6px;
        width: 100%;
    }
    .filters .btn-group .btn {
        flex: 1;
        text-align: center;
    }
    .search-container {
        max-width: 100%;
    }
    .search-container input[type="text"] {
        font-size: 13px;
        min-width: 100px;
    }
    .stats-bar {
        gap: 12px;
        padding: 10px 14px;
    }
    .stats-bar .stat-item {
        font-size: 12px;
    }
    .stats-bar .stat-item .num {
        font-size: 16px;
    }
    table {
        font-size: 12px;
        min-width: 420px;
    }
    thead th,
    tbody td {
        padding: 8px 10px;
    }
    tbody td .count {
        font-size: 13px;
        padding: 1px 10px;
        min-width: 24px;
    }
    .modal {
        margin: 20px auto;
        max-height: 95vh;
        border-radius: 12px;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-header h2 {
        font-size: 17px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-body .helper-stats {
        gap: 16px;
    }
    .modal-body .post-item {
        padding: 10px 12px;
        gap: 6px 10px;
    }
    .modal-body .post-item .post-trigger {
        font-size: 12px;
        min-width: 100px;
        width: 100%;
        order: 10;
    }
    .modal-body .post-item .post-id {
        font-size: 12px;
        min-width: 50px;
    }
    .modal-body .post-item .post-date {
        font-size: 11px;
        min-width: 60px;
    }
    .info-banner {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 12px;
        padding: 10px 14px;
    }
    .back-to-top {
        bottom: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    .header-title h1 {
        font-size: 15px;
    }
    .filters select,
    .filters input {
        font-size: 12px;
        padding: 5px 8px;
    }
    table {
        font-size: 11px;
        min-width: 340px;
    }
    thead th,
    tbody td {
        padding: 6px 8px;
    }
}
/* ===== ЭФФЕКТ СЛЕДОВ ПРОТЕКТОРОВ ===== */
.tire-track-effect {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    will-change: transform, opacity;
    filter: blur(0.5px);
    user-select: none;
}

/* Для светлой темы - более заметные следы */
body.light-theme .tire-track-effect {
    opacity: 0.3 !important;
}

/* Адаптация для мобильных - меньше следы */
@media (max-width: 768px) {
    .tire-track-effect {
        transform: scale(0.6) !important;
    }
}
/* ===== БЛОК ПОСЛЕДНИХ ДОБАВЛЕННЫХ СПАСАТЕЛЕЙ ===== */
.recent-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.recent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.recent-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.recent-badge {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 2px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.recent-info-badge {
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 2px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.recent-info-badge:hover {
    opacity: 1;
    border-color: var(--text-accent);
}

.recent-refresh {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    transition: all 0.3s;
    margin-left: auto;
}

.recent-refresh:hover {
    color: var(--text-accent);
    transform: rotate(45deg);
}

.recent-refresh.spinning {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: 6px;
    border-left: 3px solid var(--text-accent);
    transition: all 0.2s;
    flex-wrap: wrap;
}

.recent-item:hover {
    background: var(--bg-hover);
}

.recent-item .time {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 70px;
    font-weight: 500;
}

.recent-item .name {
    font-weight: 600;
    color: var(--text-accent);
    font-size: 13px;
    min-width: 100px;
}

.recent-item .name a {
    color: var(--text-accent);
    text-decoration: none;
}

.recent-item .name a:hover {
    text-decoration: underline;
}

.recent-item .post-link {
    color: var(--text-accent2);
    text-decoration: none;
    font-size: 12px;
    min-width: 60px;
}

.recent-item .post-link:hover {
    text-decoration: underline;
}

.recent-item .trig {
    color: var(--text-secondary);
    font-size: 12px;
    flex: 1;
    min-width: 150px;
    word-break: break-word;
}

.recent-item .badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.recent-item .badge-tag {
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
}

.recent-item .badge-tag.confirmed {
    background: #00ff8822;
    color: #00ff88;
    border: 1px solid #00ff88;
}

.recent-item .badge-tag.specified {
    background: #4488ff22;
    color: #4488ff;
    border: 1px solid #4488ff;
}

.recent-item .badge-tag.suspected {
    background: #ffcc0022;
    color: #ffcc00;
    border: 1px solid #ffcc00;
}

.recent-item .badge-tag.category {
    background: #ff880022;
    color: #ff8800;
    border: 1px solid #ff8800;
}

.recent-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.recent-empty {
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

@media (max-width: 768px) {

    .recent-item .trig {
        min-width: 100px;
        width: 100%;
    }
    .recent-item .time {
        min-width: 50px;
        font-size: 10px;
    }
    .recent-item .name {
        font-size: 12px;
        min-width: 80px;
    }
    .recent-header {
        flex-wrap: wrap;
    }
    .recent-refresh {
        margin-left: 0;
    }
    .recent-info-badge {
        font-size: 9px;
        padding: 1px 8px;
        width: 100%;
        text-align: center;
    }
}
.recent-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
    min-height: 180px; /* 👈 ФИКСИРОВАННАЯ МИНИМАЛЬНАЯ ВЫСОТА */
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 120px; /* 👈 МИНИМАЛЬНАЯ ВЫСОТА ДЛЯ СПИСКА */
}

.recent-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    min-height: 100px; /* 👈 ЧТОБЫ СПИННЕР НЕ ПРЫГАЛ */
    justify-content: center;
}



/* ===== РАНГИ СПАСАТЕЛЕЙ (АЛЬТЕРНАТИВНАЯ СХЕМА) ===== */

/* 🥇 1 место - ЗОЛОТО */
.rank-gold td {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.03)) !important;
    border-left: 4px solid #FF7800 !important;
    position: relative;
}
.rank-gold .rank-number {
    color: #FF7800 !important;
    font-weight: 900 !important;
    font-size: 18px !important;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}
.rank-gold .helper-count {
    color: #FF7800 !important;
    font-weight: 800 !important;
    font-size: 18px !important;
}
.rank-gold .rank-number::before {
    content: "🥇 ";
    font-size: 18px;
}
.rank-gold .helper-name a {
    color: #FF7800 !important;
}

/* 🥈 2 место - СЕРЕБРО */
.rank-silver td {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.15), rgba(192, 192, 192, 0.02)) !important;
    border-left: 4px solid #C0C0C0 !important;
}
.rank-silver .rank-number {
    color: #C0C0C0 !important;
    font-weight: 800 !important;
    font-size: 17px !important;
}
.rank-silver .helper-count {
    color: #C0C0C0 !important;
    font-weight: 700 !important;
    font-size: 17px !important;
}
.rank-silver .rank-number::before {
    content: "🥈 ";
    font-size: 17px;
}
.rank-silver .helper-name a {
    color: #C0C0C0 !important;
}

/* 🥉 3 место - БРОНЗА */
.rank-bronze td {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.02)) !important;
    border-left: 4px solid #A4794E !important;
}
.rank-bronze .rank-number {
    color: #A4794E !important;
    font-weight: 800 !important;
    font-size: 16px !important;
}
.rank-bronze .helper-count {
    color: #A4794E !important;
    font-weight: 700 !important;
    font-size: 16px !important;
}
.rank-bronze .rank-number::before {
    content: "🥉 ";
    font-size: 16px;
}
.rank-bronze .helper-name a {
    color: #A4794E !important;
}

/* 4-10 место - СИНИЙ */
.rank-top10 td {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.12), rgba(52, 152, 219, 0.02)) !important;
    border-left: 4px solid #3498DB !important;
}
.rank-top10 .rank-number {
    color: #3498DB !important;
    font-weight: 700 !important;
    font-size: 15px !important;
}
.rank-top10 .helper-count {
    color: #3498DB !important;
    font-weight: 600 !important;
    font-size: 15px !important;
}
.rank-top10 .helper-name a {
    color: #3498DB !important;
}

/* 11-50 место - БИРЮЗОВЫЙ */
.rank-top50 td {
    background: linear-gradient(90deg, rgba(26, 188, 156, 0.1), rgba(26, 188, 156, 0.02)) !important;
    border-left: 4px solid #1ABC9C !important;
}
.rank-top50 .rank-number {
    color: #1ABC9C !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}
.rank-top50 .helper-count {
    color: #1ABC9C !important;
    font-weight: 500 !important;
    font-size: 14px !important;
}
.rank-top50 .helper-name a {
    color: #1ABC9C !important;
}

/* 51-100 место - ЗЕЛЕНЫЙ */
.rank-top100 td {
    background: linear-gradient(90deg, rgba(46, 204, 113, 0.08), rgba(46, 204, 113, 0.01)) !important;
    border-left: 4px solid #2ECC71 !important;
}
.rank-top100 .rank-number {
    color: #2ECC71 !important;
    font-weight: 500 !important;
    font-size: 13px !important;
}
.rank-top100 .helper-count {
    color: #2ECC71 !important;
    font-weight: 400 !important;
    font-size: 13px !important;
}
.rank-top100 .helper-name a {
    color: #2ECC71 !important;
}

/* 101+ место - СЕРЫЙ */
.rank-other td {
    background: transparent !important;
    border-left: 4px solid transparent !important;
}
.rank-other .rank-number {
    color: #666688 !important;
    font-weight: 400 !important;
    font-size: 13px !important;
}
.rank-other .helper-count {
    color: #8888AA !important;
    font-weight: 400 !important;
    font-size: 13px !important;
}
.rank-other .helper-name a {
    color: #8888AA !important;
}

/* ===== ОБЩИЕ СТИЛИ ДЛЯ ТАБЛИЦЫ ===== */
.rank-number {
    font-size: 15px;
    text-align: center;
    padding: 8px 12px !important;
    width: 55px;
    font-weight: 600;
}

.helper-name {
    padding: 8px 12px !important;
    font-weight: 500;
}
.helper-name a {
    text-decoration: none;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    transition: all 0.3s;
}
.helper-name a:hover {
    border-bottom-color: var(--text-accent);
}

.helper-count {
    font-size: 16px;
    text-align: center;
    padding: 8px 12px !important;
    width: 70px;
    font-weight: 600;
}

.helper-categories {
    font-size: 12px;
    padding: 8px 12px !important;
    text-align: center;
    color: #8888AA;
}

.helper-last {
    font-size: 12px;
    color: #666688;
    padding: 8px 12px !important;
    text-align: center;
}

/* ===== ХОВЕР ЭФФЕКТЫ ===== */
tr[class^="rank-"]:hover td {
    background: rgba(255, 255, 255, 0.05) !important;
    transition: background 0.3s ease;
}

.rank-gold:hover td {
    background: rgba(255, 215, 0, 0.15) !important;
}
.rank-silver:hover td {
    background: rgba(192, 192, 192, 0.12) !important;
}
.rank-bronze:hover td {
    background: rgba(205, 127, 50, 0.12) !important;
}
.rank-top10:hover td {
    background: rgba(52, 152, 219, 0.1) !important;
}
.rank-top50:hover td {
    background: rgba(26, 188, 156, 0.08) !important;
}
.rank-top100:hover td {
    background: rgba(46, 204, 113, 0.06) !important;
}

/* ===== ЛЕГЕНДА ===== */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.legend-color {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}
.legend-gold { background: #FFD700; }
.legend-silver { background: #C0C0C0; }
.legend-bronze { background: #CD7F32; }
.legend-top10 { background: #3498DB; }
.legend-top50 { background: #1ABC9C; }
.legend-top100 { background: #2ECC71; }
.legend-other { background: #8888AA; }


/* ===== БЛОК ПОСЛЕДНИХ ДОБАВЛЕННЫХ СПАСАТЕЛЕЙ (ОБНОВЛЕНИЕ) ===== */
.recent-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
    min-height: 200px;  /* ← ФИКСИРОВАННАЯ ВЫСОТА */
    display: flex;
    flex-direction: column;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-height: 120px;  /* ← МИНИМАЛЬНАЯ ВЫСОТА ДЛЯ СПИСКА */
    overflow-y: auto;   /* ← СКРОЛЛ, ЕСЛИ МНОГО ЗАПИСЕЙ */
}

.recent-item .trig {
    color: var(--text-secondary);
    font-size: 12px;
    flex: 1;
    min-width: 150px;
    word-break: break-word;
    max-width: 400px;   /* ← ОГРАНИЧЕНИЕ ШИРИНЫ */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;  /* ← ОБРЕЗКА В ОДНУ СТРОКУ */
}


/* ===== ОБЪЕДИНЁННЫЕ ФИЛЬТРЫ + ПОИСК ===== */
.filters {
    padding: 12px 16px;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filters-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.filters-group-left {
    flex: 1 1 auto;
}

.filters-group-right {
    flex: 0 1 auto;
    min-width: 200px;
}

/* Поиск внутри фильтров */
.filters .search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 10px 4px 14px;
    transition: all 0.3s;
    min-width: 200px;
    width: 100%;
}

.filters .search-container:focus-within {
    border-color: var(--text-accent);
    box-shadow: 0 0 20px rgba(0,255,136,0.1);
}

.filters .search-container .search-icon {
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.filters .search-container input[type="text"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 6px 0;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    min-width: 100px;
    outline: none;
}

.filters .search-container input[type="text"]::placeholder {
    color: var(--text-secondary);
}

.filters .search-container .clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    transition: color 0.3s;
    display: none;
    flex-shrink: 0;
}

.filters .search-container .clear-btn:hover {
    color: #ff4444;
}

.filters .search-container .clear-btn.visible {
    display: block;
}

.filters .search-container .search-count {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== АДАПТИВ ДЛЯ ТЕЛЕФОНА ===== */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filters-group-left {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .filters-group-left .date-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .filters-group-left .date-group input[type="date"] {
        flex: 1;
        min-width: 120px;
    }

    .filters-group-left .quick-btns {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters-group-left .year-btns {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters-group-right {
        width: 100%;
        min-width: unset;
    }

    .filters .search-container {
        min-width: unset;
        width: 100%;
    }

    .filters .search-container input[type="text"] {
        font-size: 14px; /* лучше для тапов */
        min-width: 80px;
    }

    .filters label {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .filters {
        padding: 10px 12px;
    }

    .filters-group-left .date-group input[type="date"] {
        min-width: 100px;
        font-size: 12px;
        padding: 6px 8px;
    }

    .filters .search-container {
        padding: 4px 8px 4px 12px;
    }

    .filters .search-container input[type="text"] {
        font-size: 13px;
        min-width: 60px;
    }

    .quick-btns .btn-small,
    .year-btns .btn-year {
        font-size: 11px;
        padding: 4px 10px;
    }
}


/* ===== ОБЪЕДИНЁННЫЕ ФИЛЬТРЫ + ПОИСК ===== */
.filters {
    padding: 12px 16px;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filters-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.filters-group-left {
    flex: 1 1 auto;
}

.filters-group-right {
    flex: 0 1 auto;
    min-width: 200px;
}

/* Поиск внутри фильтров */
.filters .search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 10px 4px 14px;
    transition: all 0.3s;
    min-width: 200px;
    width: 100%;
}

.filters .search-container:focus-within {
    border-color: var(--text-accent);
    box-shadow: 0 0 20px rgba(0,255,136,0.1);
}

.filters .search-container .search-icon {
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.filters .search-container input[type="text"] {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 6px 0;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    min-width: 100px;
    outline: none;
}

.filters .search-container input[type="text"]::placeholder {
    color: var(--text-secondary);
}

.filters .search-container .clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    transition: color 0.3s;
    display: none;
    flex-shrink: 0;
}

.filters .search-container .clear-btn:hover {
    color: #ff4444;
}

.filters .search-container .clear-btn.visible {
    display: block;
}

.filters .search-container .search-count {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== АДАПТИВ ДЛЯ ТЕЛЕФОНА ===== */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filters-group-left {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        width: 100%;
        gap: 6px;
    }

    .filters-group-left .quick-btns {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .filters-group-left .year-btns {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .filters-group-right {
        width: 100%;
        min-width: unset;
    }

    .filters .search-container {
        min-width: unset;
        width: 100%;
    }

    .filters .search-container input[type="text"] {
        font-size: 14px;
        min-width: 80px;
    }

    .filters label {
        display: none; /* Скрываем "Период:" на телефоне */
    }

    .date-group {
        display: none !important; /* Скрываем даты на телефоне */
    }
}

@media (max-width: 480px) {
    .filters {
        padding: 8px 10px;
    }

    .filters-group-left .quick-btns .btn-small,
    .filters-group-left .year-btns .btn-year {
        font-size: 11px;
        padding: 4px 10px;
    }

    .filters .search-container {
        padding: 4px 8px 4px 12px;
    }

    .filters .search-container input[type="text"] {
        font-size: 13px;
        min-width: 60px;
    }
}

/* ===== ДЕСКТОП: скрываем лишние надписи ===== */
@media (min-width: 769px) {
    .filters label {
        display: inline-block;
    }
    .date-group {
        display: flex !important;
    }
}
/* ===== КУРСОР ДЛЯ ВСЕХ ЭКРАНОВ ===== */
.recent-item {
    cursor: pointer !important;
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ: ПОСЛЕДНИЕ СПАСАТЕЛИ В 2 СТРОКИ ===== */
@media (max-width: 768px) {
    .recent-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 2px !important;
        padding: 8px 12px !important;
        cursor: pointer !important;
        transition: background 0.2s !important;
    }

    .recent-item:active {
        background: var(--bg-hover) !important;
    }

    .recent-item .recent-row-top {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 4px 8px !important;
        overflow: hidden !important;
    }

    .recent-item .time {
        font-size: 11px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        min-width: auto !important;
        width: auto !important;
    }

    .recent-item .name {
        font-size: 12px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        min-width: auto !important;
        width: auto !important;
    }

    .recent-item .name a {
        text-decoration: none !important;
    }

    .recent-item .post-link {
        font-size: 11px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        min-width: auto !important;
        width: auto !important;
    }

    .recent-item .recent-row-bottom {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding-left: 0 !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    .recent-item .trig {
        display: block !important;
        font-size: 11px !important;
        color: var(--text-secondary) !important;
        flex: 1 1 auto !important;
        min-width: 20px !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .recent-item .badges {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .recent-item {
        padding: 6px 10px !important;
        gap: 1px !important;
    }

    .recent-item .time {
        font-size: 10px !important;
    }

    .recent-item .name {
        font-size: 11px !important;
    }

    .recent-item .post-link {
        font-size: 10px !important;
    }

    .recent-item .trig {
        font-size: 10px !important;
    }
}


/* ===== СКРЫТЬ СТОЛБЕЦ "НЕЙРО" ===== */
.helper-categories.neiro-col {
    display: none !important;
}

thead th.neiro-col {
    display: none !important;
}

tbody td.neiro-col {
    display: none !important;
}

.modal-body details {
    margin: 4px 0 0 0;
    padding: 4px 0 0 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.modal-body details summary {
    cursor: pointer;
    color: var(--text-accent2);
    font-weight: 500;
    user-select: none;
    padding: 2px 0 4px 0;
    font-size: 12px;
    list-style: none;
}

.modal-body details summary::-webkit-details-marker {
    display: none;
}

.modal-body details summary::before {
    content: "▶ ";
    font-size: 10px;
    color: var(--text-secondary);
}

.modal-body details[open] summary::before {
    content: "▼ ";
}

.modal-body details div {
    padding: 4px 0 4px 12px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    border-left: 1px solid var(--border-color);
    margin-left: 4px;
}
/* ===== БЕЙДЖИ ДЛЯ МОБИЛЬНЫХ ===== */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.badge-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-tag.confirmed {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-tag.specified {
    background: rgba(74, 108, 247, 0.15);
    color: #4a6cf7;
    border: 1px solid rgba(74, 108, 247, 0.3);
}

.badge-tag.suspected {
    background: rgba(255, 204, 0, 0.15);
    color: #ffcc00;
    border: 1px solid rgba(255, 204, 0, 0.3);
}

.badge-tag.category {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ===== */
@media (max-width: 768px) {
    .recent-item {
        padding: 10px 12px;
    }

    .badge-tag {
        font-size: 9px;
        padding: 2px 6px;
    }

    .badge-tag.confirmed {
        background: rgba(0, 255, 136, 0.2);
        color: #00ff88;
        border: 1px solid rgba(0, 255, 136, 0.4);
        font-weight: 700;
        font-size: 10px;
    }

    .badges {
        gap: 3px;
    }
}

@media (max-width: 480px) {
    .recent-item {
        padding: 8px 10px;
    }

    .badge-tag {
        font-size: 8px;
        padding: 1px 5px;
    }

    .badge-tag.confirmed {
        font-size: 9px;
        padding: 2px 8px;
        background: rgba(0, 255, 136, 0.25);
        border: 1px solid rgba(0, 255, 136, 0.5);
        border-radius: 12px;
    }
}
/* ===== ТОСТ ДЛЯ ГРАФИКА ===== */
@keyframes chartToastFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes chartToastFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px) scale(0.95);
    }
}

.chart-bar-toast {
    position: absolute;
    background: rgba(0, 255, 136, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 136, 0.4);
    color: #00ff88;
    padding: 4px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    font-family: system-ui, -apple-system, sans-serif;
    white-space: nowrap;
    animation: chartToastFadeIn 0.25s ease;
}
/* ===== СВЕТЛАЯ ТЕМА ДЛЯ ГРАФИКА ===== */
body.light-theme {
    --chart-bar-active: #2d7a4a;
    --chart-bar-inactive: #4a6cf7;
    --chart-bar-inactive-opacity: 0.6;
    --chart-bar-empty: #e8e8f0;
    --chart-tooltip-bg: #f0f0f8;
    --chart-tooltip-text: #1a1a2e;
    --chart-tooltip-border: #d0d0e0;
}

body.light-theme .chart-block .bar.active {
    background: #2d7a4a;
    box-shadow: 0 0 20px rgba(45, 122, 74, 0.3);
}

body.light-theme .chart-block .bar.inactive {
    background: #4a6cf7;
    opacity: 0.6;
}

body.light-theme .chart-block .bar {
    background: #e8e8f0;
}

body.light-theme .chart-block .year-marker {
    color: #666;
}

body.light-theme .chart-block .year-marker.active {
    color: #4a6cf7;
}

body.light-theme .chart-block .year-marker.inactive {
    color: #ccc;
}

body.light-theme .chart-block .bar-tooltip {
    background: #f0f0f8;
    color: #1a1a2e;
    border-color: #d0d0e0;
}

body.light-theme .chart-block .bar-label {
    color: #888;
}

body.light-theme .chart-bar-toast {
    background: rgba(45, 122, 74, 0.15);
    border-color: rgba(45, 122, 74, 0.3);
    color: #2d7a4a;
}

body.light-theme .chart-bar-toast::after {
    border-top-color: rgba(45, 122, 74, 0.3);
}



/* ===== ФИКСИРОВАННАЯ ШИРИНА СТОЛБЦОВ ===== */
.table-wrapper table {
    table-layout: fixed !important;
    width: 100% !important;
}

.table-wrapper table th,
.table-wrapper table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 🔥 ШИРИНА СТОЛБЦОВ (СБАЛАНСИРОВАННАЯ) */
/* Столбец # (ранг) */
.table-wrapper table th:nth-child(1),
.table-wrapper table td:nth-child(1) {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    text-align: center !important;
}

/* Столбец "Спасатель" (имя) - 35% от ширины таблицы */
.table-wrapper table th:nth-child(2),
.table-wrapper table td:nth-child(2) {
    width: 35% !important;
    min-width: 140px !important;
    max-width: 300px !important;
}

/* Столбец "Всего" */
.table-wrapper table th:nth-child(3),
.table-wrapper table td:nth-child(3) {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    text-align: center !important;

}

/* Столбец "Застрял" */
.table-wrapper table th:nth-child(4),
.table-wrapper table td:nth-child(4) {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    text-align: center !important;
}

/* Столбец "Сломался" */
.table-wrapper table th:nth-child(5),
.table-wrapper table td:nth-child(5) {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    text-align: center !important;
}

/* Столбец "Другое" (unknown) */
.table-wrapper table th:nth-child(6),
.table-wrapper table td:nth-child(6) {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    text-align: center !important;
}

/* Столбец "Последнее" (дата) */
.table-wrapper table th:nth-child(7),
.table-wrapper table td:nth-child(7) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 120px !important;
    text-align: center !important;
}

/* Обрезаем длинные имена */
.table-wrapper .helper-name a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

/* Строки не должны менять высоту */
.table-wrapper table tr {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
}

.table-wrapper table td {
    height: 38px !important;
    padding: 4px 6px !important;
    vertical-align: middle !important;
    font-size: 13px !important;
}

/* Шапка таблицы */
.table-wrapper table th {
    padding: 8px 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-align: center !important;
}

/* Номер строки */
.table-wrapper .rank-number {
    font-weight: 600 !important;
    font-size: 13px !important;
}

/* Имя спасателя */
.table-wrapper .helper-name a {
    font-size: 13px !important;
    font-weight: 500 !important;
}



/* ===== УБИРАЕМ СКАЧОК ПРИ ОТКРЫТИИ МОДАЛКИ ===== */
.modal-overlay.active {
    display: flex;
    /* 🔥 ФИКСИРУЕМ ШИРИНУ, ЧТОБЫ НЕ БЫЛО СДВИГА */
    padding-right: 0 !important;
}

.modal {
    /* 🔥 ВСЕГДА РЕЗЕРВИРУЕМ МЕСТО ПОД СКРОЛЛ */
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
}

/* Для WebKit-браузеров (Chrome, Safari, Edge) */
.modal::-webkit-scrollbar {
    width: 6px;
}

.modal::-webkit-scrollbar-track {
    background: var(--bg-input, #1a1a3a);
    border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a);
    border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent, #00ff88);
}

/* 🔥 ДЛЯ МОДАЛКИ ТРАССИРОВКИ ТОЖЕ */
.trace-modal {
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
}

.trace-modal::-webkit-scrollbar {
    width: 6px;
}

.trace-modal::-webkit-scrollbar-track {
    background: var(--bg-input, #1a1a3a);
    border-radius: 3px;
}

.trace-modal::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a);
    border-radius: 3px;
}

.trace-modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent, #00ff88);
}

/* ===== УБИРАЕМ ПОДЧЁРКИВАНИЕ У ССЫЛОК В ТАБЛИЦЕ ===== */
.table-wrapper .helper-name a {
    text-decoration: none !important;
}

.table-wrapper .helper-name a:hover {
    text-decoration: none !important;
}

/* Для всех ссылок в модалке тоже */
.modal .helper-name a,
.modal .helper-name a:hover {
    text-decoration: none !important;
}
/* ===== УБИРАЕМ ПОДЧЁРКИВАНИЕ У ВСЕХ ССЫЛОК В ТАБЛИЦЕ (ГЛОБАЛЬНО) ===== */
#tableBody a,
#tableBody a:link,
#tableBody a:visited,
#tableBody a:hover,
#tableBody a:active,
#tableBody a:focus {
    text-decoration: none !important;
    border-bottom: none !important;
    outline: none !important;
}

/* Для всех ссылок в модалке */
.modal-body a,
.modal-body a:link,
.modal-body a:visited,
.modal-body a:hover,
.modal-body a:active,
.modal-body a:focus {
    text-decoration: none !important;
    border-bottom: none !important;
    outline: none !important;
}

/* Для ссылок в пост-листе модалки */
.modal-body .post-item .post-id a,
.modal-body .post-item .post-id a:hover {
    text-decoration: none !important;
}

/* Для кнопок-ссылок (btn-profile, btn-trace-post) */
.btn-profile,
.btn-profile:hover,
.btn-profile:focus,
.btn-trace-post,
.btn-trace-post:hover,
.btn-trace-post:focus {
    text-decoration: none !important;
    border-bottom: none !important;
}

/* Ссылки в последних спасателях */
.recent-item .name a,
.recent-item .name a:hover {
    text-decoration: none !important;
}


/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ТАБЛИЦЫ ===== */
@media (max-width: 768px) {
    .table-wrapper table {
        table-layout: auto !important;
        min-width: 100% !important;
        font-size: 10px !important;
    }

    /* Столбец # (ранг) */
    .table-wrapper table th:nth-child(1),
    .table-wrapper table td:nth-child(1) {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
        font-size: 10px !important;
        padding: 2px 1px !important;
    }

    /* Столбец "Спасатель" (имя) */
    .table-wrapper table th:nth-child(2),
    .table-wrapper table td:nth-child(2) {
        width: auto !important;
        min-width: 60px !important;
        max-width: 120px !important;
        flex: 1 !important;
    }

    .table-wrapper .helper-name a {
        font-size: 10px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
        max-width: 100px !important;
    }

    /* Столбец "Всего" */
    .table-wrapper table th:nth-child(3),
    .table-wrapper table td:nth-child(3) {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        padding: 2px 1px !important;
        font-size: 9px !important;
        text-align: center !important;
    }

    .table-wrapper td .count {
        font-size: 10px !important;
        padding: 1px 4px !important;
        min-width: 16px !important;
    }

    /* Столбцы "Застрял", "Сломался", "Другое" */
    .table-wrapper table th:nth-child(4),
    .table-wrapper table td:nth-child(4),
    .table-wrapper table th:nth-child(5),
    .table-wrapper table td:nth-child(5),
    .table-wrapper table th:nth-child(6),
    .table-wrapper table td:nth-child(6) {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        font-size: 8px !important;
        padding: 2px 1px !important;
        text-align: center !important;
    }

    /* Столбец "Последнее" */
    .table-wrapper table th:nth-child(7),
    .table-wrapper table td:nth-child(7) {
        width: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
        font-size: 8px !important;
        padding: 2px 1px !important;
        text-align: center !important;
    }

    /* Шапка таблицы */
    .table-wrapper table th {
        font-size: 8px !important;
        padding: 3px 2px !important;
        letter-spacing: 0 !important;
        white-space: nowrap !important;
    }

    /* Ранг */
    .rank-number {
        font-size: 9px !important;
        padding: 2px 1px !important;
        text-align: center !important;
    }

    /* Высота строк */
    .table-wrapper table tr {
        height: 28px !important;
        min-height: 28px !important;
        max-height: 28px !important;
    }
    .table-wrapper table td {
        height: 28px !important;
        padding: 2px 2px !important;
        font-size: 9px !important;
        vertical-align: middle !important;
    }
}

@media (max-width: 480px) {
    .table-wrapper table th:nth-child(2),
    .table-wrapper table td:nth-child(2) {
        min-width: 70px !important;
    }

    .table-wrapper .helper-name a {
        font-size: 11px !important;
    }

    .table-wrapper table td {
        font-size: 10px !important;
        padding: 3px 2px !important;
    }

    .table-wrapper table th {
        font-size: 8px !important;
        padding: 3px 2px !important;
    }

    .rank-number {
        font-size: 10px !important;
    }

    .table-wrapper td .count {
        font-size: 10px !important;
        padding: 1px 4px !important;
        min-width: 16px !important;
    }
}


/* ===== СКРЫВАЕМ СТОЛБЕЦ С КНОПКОЙ "ЛОГИКА" ===== */
.helper-trace-btn-wrap {
    display: none !important;
}

/* А если кнопка добавляется отдельно */
.btn-trace {
    display: none !important;
}

/* Скрываем контейнер кнопки в модалке */
#modalContent .helper-trace-btn-wrap {
    display: none !important;
}

/* Скрываем кнопку "Логика" если она появляется в любом месте */
.post-item .helper-trace-btn-wrap {
    display: none !important;
}

.post-item .btn-trace {
    display: none !important;
}
/* ===== СКРЫВАЕМ СТОЛБЕЦ С КНОПКОЙ "ЛОГИКА" (перебиваем inline-стили из helpers.php) ===== */
.btn-trace,
.helper-trace-btn-wrap .btn-trace,
.post-item .btn-trace {
    display: none !important;
}

.helper-trace-btn-wrap {
    display: none !important;
}

/* Скрываем контейнер кнопки в модалке */
#modalContent .helper-trace-btn-wrap {
    display: none !important;
}

/* Скрываем кнопку если она появляется в любом месте */
.post-item .helper-trace-btn-wrap {
    display: none !important;
}

.post-item .btn-trace {
    display: none !important;
}
/* ===== КЛИКАБЕЛЬНЫЕ СТРОКИ ПОСТОВ В МОДАЛКЕ ===== */
.post-item {
    cursor: pointer !important;
    transition: background 0.2s ease !important;
}

.post-item:hover {
    background: var(--post-item-hover) !important;
}

.post-item:active {
    background: var(--bg-active, rgba(255,255,255,0.08)) !important;
}

/* Ссылка внутри поста должна оставаться кликабельной отдельно */
.post-item .post-id a {
    cursor: pointer !important;
    position: relative;
    z-index: 2;
}



/* ===== ПЛАВНОЕ ЗАТУХАНИЕ ТАБЛИЦЫ ===== */
#tableBody {
    transition: opacity 0.3s ease !important;
}

#tableBody.loading {
    opacity: 0.3 !important;
}

#tableBody.loaded {
    opacity: 1 !important;
}

/* Спиннер поверх таблицы */
.table-wrapper {
    position: relative !important;
}

.table-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-card, rgba(15, 15, 35, 0.9));
    padding: 20px 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #2a2a4a);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    pointer-events: none;
}

.table-loader.show {
    display: flex;
}

.table-loader .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, #2a2a4a);
    border-top-color: var(--text-accent, #00ff88);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.table-loader .label {
    color: var(--text-secondary, #8888aa);
    font-size: 13px;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ===== ФИКСИРУЕМ ВЫРАВНИВАНИЕ ИМЁН ===== */
#tableBody td.helper-name {
    text-align: left !important;
    vertical-align: middle !important;
    padding-left: 12px !important;
}

#tableBody td.helper-name a {
    text-align: left !important;
    display: inline-block !important;
    max-width: 100% !important;
}

/* ===== ФИКСИРУЕМ ВЫСОТУ ЗАГЛУШКИ СОРТИРОВКИ ===== */
#tableBody .loading,
#tableBody .no-data,
#tableBody .loading-sort {
    min-height: 600px !important;
    height: 600px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ===== СКРЫВАЕМ СКРОЛЛБАР ВЕЗДЕ ===== */
.modal-body::-webkit-scrollbar,
.helper-posts-container::-webkit-scrollbar,
.post-list::-webkit-scrollbar,
.trace-modal-body::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    background: transparent !important;
}

.modal-body,
.helper-posts-container,
.post-list,
.trace-modal-body {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* ===== СКРЫВАЕМ СКРОЛЛБАР ВЕЗДЕ (включая график) ===== */
/* Для WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    background: transparent !important;
}

/* Для Firefox */
* {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* ===== НО ДЛЯ МОБИЛЬНЫХ ОСТАВЛЯЕМ ТОНКИЙ СКРОЛЛБАР ===== */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px !important;
        height: 4px !important;
    }

    ::-webkit-scrollbar-track {
        background: var(--bg-tertiary, #1a1a2e) !important;
        border-radius: 2px !important;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--accent-color, #00ff88) !important;
        border-radius: 2px !important;
    }

    * {
        scrollbar-width: thin !important;
        -ms-overflow-style: auto !important;
    }
}


/* ===== МОДАЛКА НА ВСЮ ШИРИНУ НА МОБИЛЬНЫХ ===== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important; /* прижимаем к низу */
    }

    .modal {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        max-height: 90vh !important;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .modal {
        border-radius: 12px 12px 0 0 !important;
    }
}
/* ===== ФИКС ХЕДЕРА ДЛЯ ПУСТОЙ ТАБЛИЦЫ ===== */
#tableBody:empty + .table-footer,
#tableBody:has(.no-data) {
    /* хедер уже имеет ширину от table-layout: fixed */
}

/* Убеждаемся, что хедер растягивается на всю ширину */
.table-wrapper table thead {
    display: table-header-group;
    width: 100%;
}

.table-wrapper table thead tr {
    display: table-row;
    width: 100%;
}

.table-wrapper table thead th {
    display: table-cell;
    /* ширина уже задана в фиксированных стилях */
}


/* ===== КНОПКА "НАВЕРХ" ВНУТРИ МОДАЛКИ (ПРОСТАЯ) ===== */
#modalBackToTop {
    position: sticky !important;
    bottom: 24px !important;
    float: right !important;
    margin-right: 4px !important;
    margin-top: -60px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: 2px solid #00ff88 !important;
    background: rgba(18, 18, 42, 0.85) !important;
    color: #00ff88 !important;
    font-size: 22px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    z-index: 999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    transition: opacity 0.3s ease !important;
    /* Убираем все hover/active эффекты */
}

/* Убираем hover эффекты */
#modalBackToTop:hover,
#modalBackToTop:active,
#modalBackToTop:focus {
    background: rgba(18, 18, 42, 0.85) !important;
    color: #00ff88 !important;
    transform: none !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    border-color: #00ff88 !important;
    outline: none !important;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    #modalBackToTop {
        bottom: 20px !important;
        margin-right: 0px !important;
        margin-top: -56px !important;
        width: 38px !important;
        height: 38px !important;
        font-size: 18px !important;
    }
}

@media (max-width: 480px) {
    #modalBackToTop {
        bottom: 16px !important;
        margin-right: -2px !important;
        margin-top: -52px !important;
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
    }
}
/* ===== КНОПКА "НАВЕРХ" ВНУТРИ МОДАЛКИ (БАЗОВЫЕ СТИЛИ) ===== */
#modalBackToTop {
    position: sticky !important;
    bottom: 24px !important;
    float: right !important;
    margin-right: 4px !important;
    margin-top: -60px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: 2px solid #00ff88 !important;
    background: rgba(18, 18, 42, 0.85) !important;
    color: #00ff88 !important;
    font-size: 22px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    z-index: 999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
    transition: opacity 0.3s ease !important;
}

/* ❌ УБИРАЕМ принудительное отображение — теперь оно управляется через класс */
/* #modalBackToTop { opacity: 1; pointer-events: auto; } - УДАЛИТЬ */

/* ===== ПОКАЗЫВАЕМ КНОПКУ ЧЕРЕЗ КЛАСС ===== */
#modalBackToTop.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}


/* ===== ОРИГИНАЛ ПОСТА ===== */
.original-post-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.original-post-section .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #8888aa);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.original-post-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary, #e0e0e0);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-input, #1a1a2e);
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--text-accent, #00ff88);
}

.original-post-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.original-post-photos .original-photo-link {
    display: inline-block;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color, #2a2a4a);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.original-post-photos .original-photo-link:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.original-post-photos .original-photo-thumb {
    max-width: 120px;
    max-height: 120px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.original-post-meta {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
    margin-top: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--border-color, #2a2a4a);
}

.original-post-source {
    font-size: 11px;
    color: var(--text-tertiary, #666);
    margin-top: 4px;
}

/* ===== КОММЕНТАРИИ ===== */
.comments-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.comments-section .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #8888aa);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-comments-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 4px;
}

.post-comments-list::-webkit-scrollbar {
    width: 4px;
}

.post-comments-list::-webkit-scrollbar-track {
    background: var(--bg-input, #1a1a2e);
    border-radius: 2px;
}

.post-comments-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a);
    border-radius: 2px;
}

.post-comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent, #00ff88);
}

.comment-item {
    padding: 8px 12px;
    background: var(--bg-input, #1a1a2e);
    border-radius: 6px;
    border-left: 3px solid var(--border-color, #2a2a4a);
    transition: background 0.2s;
}

.comment-item:hover {
    background: var(--bg-hover, #222244);
}

.comment-item.comment-author {
    border-left-color: #ff8800;
    background: rgba(255, 136, 0, 0.06);
}

.comment-item.comment-admin {
    border-left-color: #4488ff;
    background: rgba(68, 136, 255, 0.06);
}

.comment-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}

.comment-author-name {
    font-weight: 600;
    color: var(--text-accent, #00ff88);
}

.comment-author-badge {
    font-size: 9px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #ff880033;
    color: #ff8800;
    border: 1px solid #ff880044;
}

.comment-admin-badge {
    font-size: 9px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #4488ff33;
    color: #4488ff;
    border: 1px solid #4488ff44;
}

.comment-date {
    font-size: 10px;
    color: var(--text-tertiary, #666);
    margin-left: auto;
}

.comment-likes {
    font-size: 10px;
    color: #ff4444;
}

.comment-text {
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.comment-photos {
    margin-top: 6px;
}

.comment-photos .col-4 {
    display: inline-block;
    width: auto;
    margin-right: 4px;
}

.comment-photos .img_comm {
    max-width: 80px;
    max-height: 80px;
    border-radius: 4px;
    border: 1px solid var(--border-color, #2a2a4a);
}

/* Бейджи счётчиков */
.comment-header .badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.comment-header .helper-badge {
    background: #00ff8833;
    color: #00ff88;
    border: 1px solid #00ff8844;
}

.comment-header .sos-badge {
    background: #ff444433;
    color: #ff4444;
    border: 1px solid #ff444444;
}

.comment-header .comment-badge {
    background: #4488ff33;
    color: #4488ff;
    border: 1px solid #4488ff44;
}

/* ===== АДАПТИВ ДЛЯ МОБИЛЬНЫХ ===== */
@media (max-width: 600px) {
    .original-post-section,
    .comments-section {
        padding: 10px 12px;
        margin-top: 12px;
    }

    .original-post-text {
        font-size: 13px;
        padding: 8px 10px;
    }

    .original-post-photos .original-photo-thumb {
        max-width: 80px;
        max-height: 80px;
    }

    .comment-item {
        padding: 6px 10px;
    }

    .comment-text {
        font-size: 12px;
    }

    .post-comments-list {
        max-height: 300px;
    }

    .comment-header {
        font-size: 11px;
        gap: 4px;
    }

    .comment-author-name {
        font-size: 11px;
    }

    .comment-date {
        font-size: 9px;
    }

    .comment-photos .img_comm {
        max-width: 60px;
        max-height: 60px;
    }
}

@media (max-width: 400px) {
    .original-post-photos .original-photo-thumb {
        max-width: 60px;
        max-height: 60px;
    }

    .comment-item {
        padding: 4px 8px;
    }

    .comment-text {
        font-size: 11px;
    }
}
/* ===== МАСКИРОВКА ТЕЛЕФОНОВ ===== */
.phone-masked {
    background: rgba(255, 100, 100, 0.12);
    color: #ff6b6b;
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid rgba(255, 100, 100, 0.15);
    font-weight: 500;
    font-size: 0.9em;
    cursor: help;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.phone-masked:hover {
    background: rgba(255, 100, 100, 0.25);
    border-color: rgba(255, 100, 100, 0.35);
    box-shadow: 0 0 12px rgba(255, 100, 100, 0.1);
}

/* Светлая тема */
body.light-theme .phone-masked {
    background: rgba(200, 50, 50, 0.08);
    color: #cc3333;
    border-color: rgba(200, 50, 50, 0.15);
}

body.light-theme .phone-masked:hover {
    background: rgba(200, 50, 50, 0.18);
    border-color: rgba(200, 50, 50, 0.3);
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .phone-masked {
        font-size: 0.8em;
        padding: 1px 4px;
    }
}
/* ===== ВКЛАДКИ ПОСТА ===== */
.post-tabs-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.post-tabs-header {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #2a2a4a);
    padding-bottom: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.post-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #8888aa);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.post-tab-btn:hover {
    background: var(--bg-input, #1a1a2e);
    color: var(--text-primary, #e0e0e0);
}

.post-tab-btn.active {
    background: var(--text-accent, #00ff88);
    color: var(--bg-body, #0a0a1a);
}

.post-tab-loader {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
    margin-left: auto;
}

.post-tabs-content {
    min-height: 100px;
}

.post-tab-panel {
    display: none;
}

.post-tab-panel.active {
    display: block;
    animation: traceFadeIn 0.3s ease;
}

/* ===== ИТОГОВАЯ ВЕРСИЯ ===== */
.final-post-stats {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
    margin-top: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--border-color, #2a2a4a);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.final-post-source {
    font-size: 11px;
    color: var(--text-tertiary, #666);
    margin-top: 4px;
}

.comments-count {
    font-size: 11px;
    color: var(--text-secondary, #8888aa);
    font-weight: 400;
}

/* Адаптив */
@media (max-width: 600px) {
    .post-tabs-section {
        padding: 10px 12px;
    }

    .post-tab-btn {
        font-size: 12px;
        padding: 4px 12px;
    }

    .post-tabs-header {
        gap: 4px;
    }
}
/* ===== ВЛОЖЕННЫЕ КОММЕНТАРИИ ===== */
.comment-item {
    position: relative;
    padding: 8px 12px;
    background: var(--bg-input, #1a1a2e);
    border-radius: 6px;
    border-left: 3px solid var(--border-color, #2a2a4a);
    transition: background 0.2s;
    margin-bottom: 4px;
}

/* Визуальная ветка для вложенных комментариев */
.comment-branch-line {
    position: absolute;
    left: -14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color, #2a2a4a);
    opacity: 0.3;
}

/* Для разных уровней вложенности — разные оттенки */
.comment-item[style*="margin-left: 24px;"] {
    border-left-color: #4488ff44;
}

.comment-item[style*="margin-left: 48px;"] {
    border-left-color: #ff880044;
}

.comment-item[style*="margin-left: 72px;"] {
    border-left-color: #ff44ff44;
}

.comment-item[style*="margin-left: 96px;"] {
    border-left-color: #44ff8844;
}

.comment-item[style*="margin-left: 120px;"] {
    border-left-color: #ffcc0044;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .comment-item {
        padding: 6px 10px;
    }

    .comment-branch-line {
        left: -10px;
    }
}

/* ===== УДАЛЁННЫЕ КОММЕНТАРИИ ===== */
.comment-item.comment-deleted {
    opacity: 0.5;
    border-left-color: #ff4444 !important;
    background: rgba(255, 68, 68, 0.05) !important;
}

.comment-item.comment-deleted .comment-text {
    text-decoration: line-through;
    color: var(--text-secondary, #8888aa);
}

.comment-item.comment-deleted:hover {
    opacity: 0.7;
    background: rgba(255, 68, 68, 0.08) !important;
}

.deleted-badge {
    font-size: 9px;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
    font-weight: 600;
}
/* ===== ОРИГИНАЛ ПОСТА (скрыт по умолчанию) ===== */
.original-post-section {
    display: none;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.original-post-section.visible {
    display: block;
}

/* Для итоговой версии без вкладок */
.post-single-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.post-single-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.post-single-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #8888aa);
}

.post-single-loader {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
}
/* ===== ОРИГИНАЛ ПОСТА (скрыт по умолчанию) ===== */
.original-post-section {
    display: none;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.original-post-section.visible {
    display: block;
}

.original-post-section .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #8888aa);
    margin-bottom: 10px;
}

/* Для итоговой версии без вкладок */
.post-single-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.post-single-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.post-single-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #8888aa);
}

.post-single-loader {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
}

.post-single-content {
    min-height: 80px;
}

/* Остальные стили для постов */
.original-post-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary, #e0e0e0);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-input, #1a1a2e);
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--text-accent, #00ff88);
}

.original-post-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.original-post-photos .original-photo-link {
    display: inline-block;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color, #2a2a4a);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.original-post-photos .original-photo-link:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.original-post-photos .original-photo-thumb {
    max-width: 120px;
    max-height: 120px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.original-post-meta {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
    margin-top: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--border-color, #2a2a4a);
}

.original-post-source {
    font-size: 11px;
    color: var(--text-tertiary, #666);
    margin-top: 4px;
}

.final-post-stats {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
    margin-top: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--border-color, #2a2a4a);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.final-post-source {
    font-size: 11px;
    color: var(--text-tertiary, #666);
    margin-top: 4px;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .original-post-section,
    .post-single-section {
        padding: 10px 12px;
        margin-top: 12px;
    }

    .original-post-text {
        font-size: 13px;
        padding: 8px 10px;
    }

    .original-post-photos .original-photo-thumb {
        max-width: 80px;
        max-height: 80px;
    }
}


/* ===== КОММЕНТАРИИ С АВАТАРКАМИ ===== */
.comment-item {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-input, #1a1a2e);
    border-radius: 6px;
    border-left: 3px solid var(--border-color, #2a2a4a);
    transition: background 0.2s;
    margin-bottom: 4px;
    align-items: flex-start;
}

.comment-item:hover {
    background: var(--bg-hover, #222244);
}

/* Автор */
.comment-item.comment-author {
    border-left-color: #ff8800;
    background: rgba(255, 136, 0, 0.06);
}

/* Спасатель */
.comment-item.comment-helper {
    border-left-color: #00ff88;
    background: rgba(0, 255, 136, 0.06);
}

/* Автор + Спасатель */
.comment-item.comment-author.comment-helper {
    border-left-color: #ffaa00;
    background: rgba(255, 170, 0, 0.08);
}

/* Удалённый */
.comment-item.comment-deleted {
    opacity: 0.5;
    border-left-color: #ff4444 !important;
    background: rgba(255, 68, 68, 0.05) !important;
}

.comment-item.comment-deleted .comment-text {
    text-decoration: line-through;
    color: var(--text-secondary, #8888aa);
}

.comment-item.comment-deleted:hover {
    opacity: 0.7;
}

/* Аватарка */
.comment-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color, #2a2a4a);
    background: var(--bg-tertiary, #0f0f23);
}

.comment-item.comment-author .comment-avatar {
    border-color: #ff8800;
}

.comment-item.comment-helper .comment-avatar {
    border-color: #00ff88;
}

.comment-item.comment-author.comment-helper .comment-avatar {
    border-color: #ffaa00;
}

.avatar-helper-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 11px;
    background: var(--bg-body, #0a0a1a);
    border-radius: 50%;
    padding: 1px;
    border: 1px solid #00ff88;
    line-height: 1;
}

/* Тело комментария */
.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-bottom: 3px;
    font-size: 12px;
}

.comment-author-name {
    font-weight: 600;
    color: var(--text-accent, #00ff88);
}

.comment-item.comment-author .comment-author-name {
    color: #ff8800;
}

.comment-item.comment-helper .comment-author-name {
    color: #00ff88;
}

.comment-item.comment-author.comment-helper .comment-author-name {
    color: #ffaa00;
}

/* Бейджи */
.badge {
    font-size: 9px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-block;
}

.author-badge {
    background: rgba(255, 136, 0, 0.2);
    color: #ff8800;
    border: 1px solid rgba(255, 136, 0, 0.3);
}

.helper-badge {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.deleted-badge {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.comment-date {
    font-size: 10px;
    color: var(--text-tertiary, #666);
    margin-left: auto;
}

.comment-likes {
    font-size: 10px;
    color: #ff4444;
}

.comment-text {
    font-size: 13px;
    color: var(--text-primary, #e0e0e0);
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Вложения в комментариях */
.comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.comment-attachment-item {
    display: inline-block;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color, #2a2a4a);
    max-width: 120px;
}

.comment-attachment-img {
    max-width: 120px;
    max-height: 120px;
    object-fit: cover;
    display: block;
}

.comment-attachment-sticker {
    max-width: 80px;
    max-height: 80px;
    display: block;
}

.comment-attachment-file {
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary, #8888aa);
    background: var(--bg-tertiary, #0f0f23);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-attachment-video iframe {
    max-width: 100%;
    border-radius: 4px;
}

.comment-attachment-audio {
    padding: 4px 8px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 4px;
    max-width: 250px;
}

.comment-attachment-audio-info {
    font-size: 10px;
    color: var(--text-secondary, #8888aa);
    display: block;
    margin-top: 2px;
}

/* Ветка для вложенных комментариев */
.comment-branch-line {
    position: absolute;
    left: -14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color, #2a2a4a);
    opacity: 0.3;
}

/* Список комментариев */
.post-comments-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}

.post-comments-list::-webkit-scrollbar {
    width: 4px;
}

.post-comments-list::-webkit-scrollbar-track {
    background: var(--bg-input, #1a1a2e);
    border-radius: 2px;
}

.post-comments-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a);
    border-radius: 2px;
}

.post-comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent, #00ff88);
}

/* Адаптив */
@media (max-width: 600px) {
    .comment-item {
        padding: 6px 10px;
        gap: 8px;
    }

    .comment-avatar-wrapper {
        width: 28px;
        height: 28px;
    }

    .comment-avatar {
        width: 28px;
        height: 28px;
    }

    .avatar-helper-badge {
        font-size: 9px;
        bottom: -2px;
        right: -2px;
    }

    .comment-author-name {
        font-size: 11px;
    }

    .comment-text {
        font-size: 12px;
    }

    .badge {
        font-size: 8px;
        padding: 1px 6px;
    }

    .comment-branch-line {
        left: -10px;
    }

    .comment-attachment-item {
        max-width: 80px;
    }

    .comment-attachment-img {
        max-width: 80px;
        max-height: 80px;
    }

    .comment-attachment-sticker {
        max-width: 60px;
        max-height: 60px;
    }

    .comment-attachment-video iframe {
        width: 120px;
        height: 90px;
    }

    .comment-attachment-audio {
        max-width: 180px;
    }
}


/* ===== ОДИНОЧНЫЙ БЛОК ИТОГОВОЙ ВЕРСИИ ===== */
.post-single-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.post-single-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.post-single-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #8888aa);
}

.post-single-loader {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
}

.post-single-content {
    min-height: 80px;
}

/* ===== ВКЛАДКИ ПОСТА ===== */
.post-tabs-section {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary, #0f0f23);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.post-tabs-header {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #2a2a4a);
    padding-bottom: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.post-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #8888aa);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.post-tab-btn:hover {
    background: var(--bg-input, #1a1a2e);
    color: var(--text-primary, #e0e0e0);
}

.post-tab-btn.active {
    background: var(--text-accent, #00ff88);
    color: var(--bg-body, #0a0a1a);
}

.post-tab-loader {
    font-size: 12px;
    color: var(--text-secondary, #8888aa);
    margin-left: auto;
}

.post-tabs-content {
    min-height: 100px;
}

.post-tab-panel {
    display: none;
}

.post-tab-panel.active {
    display: block;
    animation: traceFadeIn 0.3s ease;
}


/* ===== ВСЕ ПОСТЫ ===== */
.all-posts-modal {
    max-width: 950px !important;
    max-height: 92vh !important;
}

.all-posts-modal .modal-body {
    padding: 16px 20px !important;
    overflow-y: auto;
    flex: 1;
}

.all-posts-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    background: var(--bg-container);
    z-index: 5;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.all-posts-search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

.all-posts-search-input:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
}

.all-posts-search-input::placeholder {
    color: var(--text-secondary);
}

.all-posts-refresh {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.all-posts-refresh:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
}

.all-posts-refresh.spinning {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Список постов */
.all-posts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.all-posts-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 8px;
    border-left: 3px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
    align-items: flex-start;
}

.all-posts-item:hover {
    background: var(--bg-hover);
    border-left-color: var(--text-accent);
    transform: translateX(4px);
}

.all-posts-item .post-avatar-wrapper {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.all-posts-item .post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
}

.all-posts-item .post-body {
    flex: 1;
    min-width: 0;
}

.all-posts-item .post-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-bottom: 4px;
}

.all-posts-item .post-author {
    font-weight: 600;
    color: var(--text-accent);
    font-size: 14px;
}

.all-posts-item .post-id {
    font-size: 11px;
    color: var(--text-accent2);
    font-weight: 500;
}

.all-posts-item .post-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
}

.all-posts-item .post-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.all-posts-item .post-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.all-posts-item .post-photo-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.all-posts-item .post-photo-thumb:hover {
    transform: scale(1.05);
}

.all-posts-item .post-meta {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.all-posts-item .post-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.all-posts-item .post-meta .badge-tag {
    font-size: 9px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-secondary);
}

/* Пустой список */
.all-posts-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.all-posts-empty .big-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* Футер */
.all-posts-footer {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.post-count-badge {
    font-size: 12px;
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 2px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-weight: 400;
}

/* Адаптив */
@media (max-width: 600px) {
    .all-posts-modal {
        max-width: 100% !important;
        border-radius: 12px !important;
        margin: 10px !important;
    }

    .all-posts-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .all-posts-item .post-avatar-wrapper {
        width: 32px;
        height: 32px;
    }

    .all-posts-item .post-avatar {
        width: 32px;
        height: 32px;
    }

    .all-posts-item .post-text {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }

    .all-posts-item .post-photo-thumb {
        width: 40px;
        height: 40px;
    }

    .all-posts-filter {
        flex-wrap: wrap;
    }

    .all-posts-search-input {
        min-width: 120px;
        font-size: 12px;
        padding: 6px 10px;
    }
}


/* ===== КНОПКА ВСЕ ПОСТЫ ===== */
.btn-all-posts {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    position: relative;
}

.btn-all-posts:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
    background: rgba(0, 255, 136, 0.05);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.05);
}

.btn-all-posts .badge-all-posts {
    background: var(--text-accent);
    color: var(--bg-body);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 12px;
    min-width: 18px;
    text-align: center;
    line-height: 1.6;
    transition: all 0.3s;
}

.btn-all-posts:hover .badge-all-posts {
    transform: scale(1.1);
}

.btn-all-posts .label {
    font-size: 13px;
    font-weight: 500;
}

/* Светлая тема */
body.light-theme .btn-all-posts {
    background: #f0f0f8;
    border-color: #d0d0e0;
}

body.light-theme .btn-all-posts:hover {
    border-color: #2d7a4a;
    color: #2d7a4a;
    background: rgba(45, 122, 74, 0.05);
}

body.light-theme .btn-all-posts .badge-all-posts {
    background: #2d7a4a;
    color: #ffffff;
}
/* ===== ИНДИКАТОР ЗАГРУЗКИ ДЛЯ ВСЕХ ПОСТОВ ===== */
.infinite-loader {
    text-align: center;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.infinite-loader .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Группировка постов по автору */
.all-posts-item[data-group] {
    border-left: 3px solid transparent;
    transition: border-color 0.3s;
}
.all-posts-item[data-group]:hover {
    border-left-color: var(--text-accent);
}

/* Бейдж статуса поста */
.all-posts-item .post-header .badge-tag {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* Фильтр "только удалённые" */
.all-posts-filter label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}
.all-posts-filter label input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--text-accent);
}

/* Индикатор загрузки */
.infinite-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}
.infinite-loader .spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ===== БЕЙДЖИ В ЗАГОЛОВКЕ ===== */
.badge-group {
    font-size: 10px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-linked {
    background: rgba(68, 136, 255, 0.15);
    color: #4488ff;
    border: 1px solid rgba(68, 136, 255, 0.3);
}

.badge-group.status-existing {
    background: rgba(0, 255, 136, 0.12);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge-group.status-deleted {
    background: rgba(255, 68, 68, 0.12);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
}

.badge-group.status-partial {
    background: rgba(255, 204, 0, 0.12);
    color: #ffcc00;
    border: 1px solid rgba(255, 204, 0, 0.2);
}


/* ===== ФОТО ===== */
.post-photos {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.post-photo-thumb {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.post-photo-thumb:hover {
    transform: scale(1.08);
    border-color: var(--text-accent);
    box-shadow: 0 2px 12px rgba(0, 255, 136, 0.15);
}

.photo-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.all-posts-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.all-posts-empty .big-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.6;
}

.all-posts-empty div {
    font-size: 16px;
}

/* ===== ИНДИКАТОР ЗАГРУЗКИ ===== */
.infinite-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {


    .author-group-right {
        justify-content: flex-start;
    }

    .post-row {
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 12px;
    }

    .post-row-left {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 100%;
        gap: 4px 8px;
        padding-right: 0;
        align-items: center;
    }

    .post-row-type {
        font-size: 10px;
    }

    .post-row-id {
        font-size: 12px;
    }

    .post-row-text {
        font-size: 12px;
        max-height: 60px;
        -webkit-line-clamp: 3;
    }

    .post-photo-thumb {
        width: 72px;
        height: 72px;
    }

    .photo-more {
        width: 36px;
        height: 36px;
        font-size: 10px;
    }

    .badge-group {
        font-size: 9px;
        padding: 1px 8px;
    }
}

@media (max-width: 480px) {
    .author-group-name {
        font-size: 13px;
    }

    .post-row-text {
        font-size: 11px;
        max-height: 50px;
        -webkit-line-clamp: 2;
    }

    .post-row-id {
        font-size: 11px;
    }

    .post-row-date {
        font-size: 10px;
    }

    .post-photo-thumb {
        width: 72px;
        height: 72px;
    }

    .photo-more {
        width: 30px;
        height: 30px;
        font-size: 9px;
    }
}


/* ===== ВСЕ ПОСТЫ: ПРОСТОЙ СПИСОК ===== */
.all-posts-list-simple {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-row-simple {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    align-items: flex-start;
}

.post-row-simple:hover {
    border-color: var(--text-accent);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.05);
    transform: translateX(4px);
}

/* Типы постов */
.post-row-simple.type-original {
    border-left: 4px solid #00ff88;
}
.post-row-simple.type-republished {
    border-left: 4px solid #4488ff;
}
.post-row-simple.type-group {
    border-left: 4px solid #ff8800;
}
.post-row-simple.type-single {
    border-left: 4px solid var(--border-color);
}

/* Левая колонка */
.post-row-simple-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 110px;
    flex-shrink: 0;
}

.post-row-simple-type {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}
.post-row-simple-type.type-original {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}
.post-row-simple-type.type-republished {
    color: #4488ff;
    background: rgba(68, 136, 255, 0.1);
}
.post-row-simple-type.type-group {
    color: #ff8800;
    background: rgba(255, 136, 0, 0.1);
}
.post-row-simple-type.type-single {
    color: var(--text-secondary);
    background: var(--bg-body);
}

.post-row-simple-id {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-accent2);
    font-family: 'Courier New', monospace;
}

.post-row-simple-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.post-row-simple-confidence {
    font-size: 10px;
    color: var(--text-accent);
    font-weight: 600;
}

/* Бейджи статуса */
.badge-status {
    font-size: 10px;
    padding: 1px 10px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
    width: fit-content;
}
.badge-exists {
    background: rgba(0, 255, 136, 0.12);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.2);
}
.badge-deleted {
    background: rgba(255, 68, 68, 0.12);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
}

/* Центр */
.post-row-simple-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.post-row-simple-author {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.post-row-simple-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    max-height: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

/* Фото */
.post-row-simple .post-photos {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.post-row-simple .post-photo-thumb {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}
.post-row-simple .post-photo-thumb:hover {
    transform: scale(1.08);
    border-color: var(--text-accent);
}

.photo-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

/* Индикатор связи */
.post-link-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(68, 136, 255, 0.08);
    border-radius: 6px;
    border: 1px solid rgba(68, 136, 255, 0.15);
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.link-arrow {
    font-size: 14px;
}
.link-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.link-type-label {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(68, 136, 255, 0.12);
    color: #4488ff;
}
.link-confidence {
    font-size: 10px;
    color: var(--text-accent);
}

.post-link-reason-tip {
    font-size: 16px;
    cursor: help;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.post-link-reason-tip:hover {
    opacity: 1;
}

/* Правая колонка */
.post-row-simple-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-left: 8px;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .post-row-simple {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .post-row-simple-left {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 100%;
        gap: 4px 8px;
        align-items: center;
    }
    .post-row-simple-type {
        font-size: 10px;
    }
    .post-row-simple-id {
        font-size: 12px;
    }
    .post-row-simple-text {
        font-size: 12px;
        max-height: 60px;
        -webkit-line-clamp: 3;
    }
    .post-row-simple .post-photo-thumb {
        width: 72px;
        height: 72px;
    }
    .photo-more {
        width: 36px;
        height: 36px;
        font-size: 10px;
    }
    .post-link-indicator {
        font-size: 10px;
        padding: 3px 8px;
        flex-wrap: wrap;
    }
    .post-row-simple-right {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .post-row-simple-text {
        font-size: 11px;
        max-height: 50px;
        -webkit-line-clamp: 2;
    }
    .post-row-simple-id {
        font-size: 11px;
    }
    .post-row-simple-date {
        font-size: 10px;
    }
    .post-row-simple .post-photo-thumb {
        width: 72px;
        height: 72px;
    }
    .photo-more {
        width: 30px;
        height: 30px;
        font-size: 9px;
    }
}



/* ===== ВСЕ ПОСТЫ: ПРОСТОЙ СПИСОК ===== */
.all-posts-list-simple {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-row-simple {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    align-items: flex-start;
}

.post-row-simple:hover {
    border-color: var(--text-accent);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.05);
    transform: translateX(4px);
}

/* Типы постов */
.post-row-simple.type-original {
    border-left: 4px solid #00ff88;
}
.post-row-simple.type-republished {
    border-left: 4px solid #4488ff;
}
.post-row-simple.type-group {
    border-left: 4px solid #ff8800;
}
.post-row-simple.type-single {
    border-left: 4px solid var(--border-color);
}

/* ===== АВАТАРКА ===== */
.post-row-simple-avatar-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.post-row-simple-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
}

/* ===== ТЕЛО ПОСТА ===== */
.post-row-simple-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.post-row-simple-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.post-row-simple-type {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}
.post-row-simple-type.type-original {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}
.post-row-simple-type.type-republished {
    color: #4488ff;
    background: rgba(68, 136, 255, 0.1);
}
.post-row-simple-type.type-group {
    color: #ff8800;
    background: rgba(255, 136, 0, 0.1);
}
.post-row-simple-type.type-single {
    color: var(--text-secondary);
    background: var(--bg-body);
}

.post-row-simple-id {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-accent2);
    font-family: 'Courier New', monospace;
}

.post-row-simple-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.post-row-simple-confidence {
    font-size: 10px;
    color: var(--text-accent);
    font-weight: 600;
}

/* Бейджи статуса */
.badge-status {
    font-size: 10px;
    padding: 1px 10px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
    width: fit-content;
}
.badge-exists {
    background: rgba(0, 255, 136, 0.12);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.2);
}
.badge-deleted {
    background: rgba(255, 68, 68, 0.12);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
}

.post-row-simple-author {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.post-row-simple-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    max-height: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

/* Фото */
.post-row-simple .post-photos {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.post-row-simple .post-photo-thumb {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}
.post-row-simple .post-photo-thumb:hover {
    transform: scale(1.08);
    border-color: var(--text-accent);
}

.photo-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

/* Индикатор связи */
.post-link-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(68, 136, 255, 0.08);
    border-radius: 6px;
    border: 1px solid rgba(68, 136, 255, 0.15);
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.link-arrow {
    font-size: 14px;
}
.link-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.link-type-label {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(68, 136, 255, 0.12);
    color: #4488ff;
}
.link-confidence {
    font-size: 10px;
    color: var(--text-accent);
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .post-row-simple {
        gap: 10px;
        padding: 10px 12px;
    }
    .post-row-simple-avatar-wrap {
        width: 36px;
        height: 36px;
    }
    .post-row-simple-avatar {
        width: 36px;
        height: 36px;
    }
    .post-row-simple-header {
        gap: 4px 6px;
    }
    .post-row-simple-type {
        font-size: 10px;
    }
    .post-row-simple-id {
        font-size: 12px;
    }
    .post-row-simple-text {
        font-size: 12px;
        max-height: 60px;
        -webkit-line-clamp: 3;
    }
    .post-row-simple .post-photo-thumb {
        width: 36px;
        height: 36px;
    }
    .photo-more {
        width: 36px;
        height: 36px;
        font-size: 10px;
    }
    .post-link-indicator {
        font-size: 10px;
        padding: 3px 8px;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .post-row-simple-avatar-wrap {
        width: 30px;
        height: 30px;
    }
    .post-row-simple-avatar {
        width: 30px;
        height: 30px;
    }
    .post-row-simple-text {
        font-size: 11px;
        max-height: 50px;
        -webkit-line-clamp: 2;
    }
    .post-row-simple-id {
        font-size: 11px;
    }
    .post-row-simple-date {
        font-size: 10px;
    }
    .post-row-simple .post-photo-thumb {
        width: 72px;
        height: 72px;
    }
    .photo-more {
        width: 30px;
        height: 30px;
        font-size: 9px;
    }
}


/* ===== АВАТАРКА ===== */
.post-row-simple-avatar-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.post-row-simple-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
}

.post-row-simple-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .post-row-simple-avatar-wrap {
        width: 36px;
        height: 36px;
    }
    .post-row-simple-avatar {
        width: 36px;
        height: 36px;
    }
    .post-row-simple-avatar-placeholder {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .post-row-simple-avatar-wrap {
        width: 30px;
        height: 30px;
    }
    .post-row-simple-avatar {
        width: 30px;
        height: 30px;
    }
    .post-row-simple-avatar-placeholder {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}



/* ===== СВЕТЛАЯ ТЕМА ДЛЯ МОДАЛКИ ТРАССИРОВКИ ===== */
body.light-theme .trace-modal {
    background: #ffffff !important;
    border-color: #d0d0e0 !important;
}

body.light-theme .trace-modal-header {
    background: #f8f9fa !important;
    border-bottom-color: #dee2e6 !important;
}

body.light-theme .trace-modal-header h2 {
    color: #212529 !important;
}

body.light-theme .trace-modal-header .post-id-badge {
    background: rgba(13, 110, 253, 0.1) !important;
    color: #0d6efd !important;
}

body.light-theme .trace-modal-body {
    background: #ffffff !important;
}

body.light-theme .trace-summary {
    background: #f0f2f5 !important;
    border-left-color: #0d6efd !important;
}

body.light-theme .trace-summary-item .label {
    color: #6c757d !important;
}

body.light-theme .trace-summary-item .value {
    color: #212529 !important;
}

body.light-theme .trace-summary-item .value.green {
    color: #198754 !important;
}
body.light-theme .trace-summary-item .value.orange {
    color: #fd7e14 !important;
}
body.light-theme .trace-summary-item .value.red {
    color: #dc3545 !important;
}
body.light-theme .trace-summary-item .value.blue {
    color: #0d6efd !important;
}

body.light-theme .trace-step {
    border-left-color: #d0d0e0 !important;
}

body.light-theme .trace-step .step-name {
    color: #212529 !important;
}

body.light-theme .trace-step .step-message {
    color: #6c757d !important;
}

body.light-theme .trace-step .step-meta {
    color: #adb5bd !important;
}

body.light-theme .trace-step .step-meta .tag {
    background: #e9ecef !important;
    color: #495057 !important;
}

body.light-theme .trace-step .step-data {
    background: #f8f9fa !important;
    color: #495057 !important;
}

body.light-theme .trace-empty {
    color: #6c757d !important;
}

body.light-theme .trace-loading {
    color: #6c757d !important;
}

body.light-theme .trace-loading .spinner {
    border-color: #dee2e6 !important;
    border-top-color: #0d6efd !important;
}

/* ===== СВЕТЛАЯ ТЕМА ДЛЯ ПОСТА В ТРАССИРОВКЕ ===== */
body.light-theme .post-tabs-section {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

body.light-theme .post-tabs-header {
    border-bottom-color: #dee2e6 !important;
}

body.light-theme .post-tab-btn {
    color: #6c757d !important;
}

body.light-theme .post-tab-btn:hover {
    background: #e9ecef !important;
    color: #212529 !important;
}

body.light-theme .post-tab-btn.active {
    background: #0d6efd !important;
    color: #ffffff !important;
}

body.light-theme .post-single-section {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

body.light-theme .post-single-title {
    color: #6c757d !important;
}

body.light-theme .original-post-text {
    background: #ffffff !important;
    color: #212529 !important;
    border-left-color: #0d6efd !important;
}

body.light-theme .original-post-meta {
    color: #6c757d !important;
    border-top-color: #dee2e6 !important;
}

body.light-theme .original-post-source {
    color: #adb5bd !important;
}

body.light-theme .final-post-stats {
    color: #6c757d !important;
    border-top-color: #dee2e6 !important;
}

body.light-theme .final-post-source {
    color: #adb5bd !important;
}

/* ===== СВЕТЛАЯ ТЕМА ДЛЯ КОММЕНТАРИЕВ ===== */
body.light-theme .comments-section {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

body.light-theme .comments-section .section-title {
    color: #6c757d !important;
}

body.light-theme .comment-item {
    background: #ffffff !important;
    border-left-color: #dee2e6 !important;
}

body.light-theme .comment-item:hover {
    background: #f8f9fa !important;
}

body.light-theme .comment-item.comment-author {
    border-left-color: #fd7e14 !important;
    background: rgba(253, 126, 20, 0.05) !important;
}

body.light-theme .comment-item.comment-helper {
    border-left-color: #198754 !important;
    background: rgba(25, 135, 84, 0.05) !important;
}

body.light-theme .comment-item.comment-author.comment-helper {
    border-left-color: #fd7e14 !important;
    background: rgba(253, 126, 20, 0.08) !important;
}

body.light-theme .comment-item.comment-deleted {
    background: rgba(220, 53, 69, 0.05) !important;
    border-left-color: #dc3545 !important;
}

body.light-theme .comment-author-name {
    color: #0d6efd !important;
}

body.light-theme .comment-item.comment-author .comment-author-name {
    color: #fd7e14 !important;
}

body.light-theme .comment-item.comment-helper .comment-author-name {
    color: #198754 !important;
}

body.light-theme .comment-date {
    color: #adb5bd !important;
}

body.light-theme .comment-text {
    color: #212529 !important;
}

body.light-theme .comment-likes {
    color: #dc3545 !important;
}

/* ===== БЕЙДЖИ ===== */
body.light-theme .author-badge {
    background: rgba(253, 126, 20, 0.15) !important;
    color: #fd7e14 !important;
    border-color: rgba(253, 126, 20, 0.25) !important;
}

body.light-theme .helper-badge {
    background: rgba(25, 135, 84, 0.15) !important;
    color: #198754 !important;
    border-color: rgba(25, 135, 84, 0.25) !important;
}

body.light-theme .deleted-badge {
    background: rgba(220, 53, 69, 0.15) !important;
    color: #dc3545 !important;
    border-color: rgba(220, 53, 69, 0.25) !important;
}

/* ===== СВЕТЛАЯ ТЕМА ДЛЯ СТАТУСОВ ===== */
body.light-theme .status-badge.complete {
    background: rgba(25, 135, 84, 0.12) !important;
    color: #198754 !important;
}

body.light-theme .status-badge.error {
    background: rgba(220, 53, 69, 0.12) !important;
    color: #dc3545 !important;
}

body.light-theme .status-badge.processing {
    background: rgba(253, 126, 14, 0.12) !important;
    color: #fd7e14 !important;
}

body.light-theme .status-badge.start {
    background: rgba(13, 110, 253, 0.12) !important;
    color: #0d6efd !important;
}

/* ===== КНОПКИ ===== */
body.light-theme .btn-trace-post {
    background: rgba(13, 110, 253, 0.1) !important;
    color: #0d6efd !important;
    border-color: rgba(13, 110, 253, 0.2) !important;
}

body.light-theme .btn-trace-post:hover {
    background: rgba(13, 110, 253, 0.2) !important;
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.15) !important;
}

body.light-theme .btn-trace-post svg {
    fill: #0d6efd !important;
}

/* ===== СВЕТЛАЯ ТЕМА ДЛЯ МОДАЛКИ ВСЕ ПОСТЫ ===== */
body.light-theme .all-posts-modal .modal-header {
    background: #f8f9fa !important;
    border-bottom-color: #dee2e6 !important;
}

body.light-theme .all-posts-modal .modal-body {
    background: #ffffff !important;
}

body.light-theme .all-posts-modal .all-posts-filter {
    background: #ffffff !important;
    border-bottom-color: #dee2e6 !important;
}

body.light-theme .all-posts-modal .all-posts-search-input {
    background: #ffffff !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
}

body.light-theme .all-posts-modal .all-posts-item {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
}

body.light-theme .all-posts-modal .all-posts-item:hover {
    background: #e9ecef !important;
}

body.light-theme .all-posts-modal .all-posts-item .post-author {
    color: #0d6efd !important;
}

body.light-theme .all-posts-modal .all-posts-item .post-text {
    color: #212529 !important;
}

body.light-theme .all-posts-modal .all-posts-item .post-date {
    color: #6c757d !important;
}


.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .stat-item .num {
        font-size: 18px;
    }
}


/* ===== УДАЛЁННЫЙ НЕПЕРЕОПУБЛИКОВАННЫЙ ПОСТ ===== */
.post-row-simple.deleted-not-republished {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.08) 0%, rgba(255, 68, 68, 0.02) 100%);
    border-left: 3px solid rgba(255, 68, 68, 0.3);
    transition: all 0.3s ease;
    border-radius: 4px;
}

.post-row-simple.deleted-not-republished:hover {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.15) 0%, rgba(255, 68, 68, 0.05) 100%);
}

.post-row-simple .badge-deleted-not-republished {
    display: inline-block;
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 8px;
    border: 1px solid rgba(255, 68, 68, 0.2);
}


/* ===== ФИКС КОММЕНТАРИЕВ В ТРАССИРОВКЕ ===== */
.trace-modal-body .comment-item {
    display: flex !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    background: var(--bg-input, #1a1a2e) !important;
    border-radius: 6px !important;
    border-left: 3px solid var(--border-color, #2a2a4a) !important;
    margin-bottom: 4px !important;
    align-items: flex-start !important;
    position: relative !important;
}

.trace-modal-body .comment-item .comment-avatar-wrapper {
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    position: relative !important;
}

.trace-modal-body .comment-item .comment-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid var(--border-color, #2a2a4a) !important;
    background: var(--bg-tertiary, #0f0f23) !important;
    display: block !important;
}

.trace-modal-body .comment-item .comment-body {
    display: block !important;
    flex: 1 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

.trace-modal-body .comment-item .comment-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 4px 8px !important;
    margin-bottom: 3px !important;
    font-size: 12px !important;
}

.trace-modal-body .comment-item .comment-author-name {
    font-weight: 600 !important;
    color: var(--text-accent, #00ff88) !important;
}

.trace-modal-body .comment-item .comment-date {
    font-size: 10px !important;
    color: var(--text-tertiary, #666) !important;
    margin-left: auto !important;
}

.trace-modal-body .comment-item .comment-likes {
    font-size: 10px !important;
    color: #ff4444 !important;
}

.trace-modal-body .comment-item .comment-text {
    font-size: 13px !important;
    color: var(--text-primary, #e0e0e0) !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
    line-height: 1.5 !important;
}

/* ===== БЕЙДЖИ ===== */
.trace-modal-body .comment-item .badge {
    font-size: 9px !important;
    padding: 1px 8px !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
    display: inline-block !important;
}

.trace-modal-body .comment-item .author-badge {
    background: rgba(255, 136, 0, 0.2) !important;
    color: #ff8800 !important;
    border: 1px solid rgba(255, 136, 0, 0.3) !important;
}

.trace-modal-body .comment-item .helper-badge {
    background: rgba(0, 255, 136, 0.2) !important;
    color: #00ff88 !important;
    border: 1px solid rgba(0, 255, 136, 0.3) !important;
}

.trace-modal-body .comment-item .deleted-badge {
    background: rgba(255, 68, 68, 0.2) !important;
    color: #ff4444 !important;
    border: 1px solid rgba(255, 68, 68, 0.3) !important;
}

/* ===== ЦВЕТА ===== */
.trace-modal-body .comment-item.comment-author {
    border-left-color: #ff8800 !important;
    background: rgba(255, 136, 0, 0.06) !important;
}

.trace-modal-body .comment-item.comment-helper {
    border-left-color: #00ff88 !important;
    background: rgba(0, 255, 136, 0.06) !important;
}

.trace-modal-body .comment-item.comment-author.comment-helper {
    border-left-color: #ffaa00 !important;
    background: rgba(255, 170, 0, 0.08) !important;
}

.trace-modal-body .comment-item.comment-deleted {
    opacity: 0.5 !important;
    border-left-color: #ff4444 !important;
    background: rgba(255, 68, 68, 0.05) !important;
}

.trace-modal-body .comment-item.comment-deleted .comment-text {
    text-decoration: line-through !important;
    color: var(--text-secondary, #8888aa) !important;
}

/* ===== АВАТАР-БЕЙДЖ ===== */
.trace-modal-body .comment-item .avatar-helper-badge {
    position: absolute !important;
    bottom: -4px !important;
    right: -4px !important;
    font-size: 11px !important;
    background: var(--bg-body, #0a0a1a) !important;
    border-radius: 50% !important;
    padding: 1px !important;
    border: 1px solid #00ff88 !important;
    line-height: 1 !important;
}

/* ===== ВЛОЖЕННЫЕ КОММЕНТАРИИ ===== */
.trace-modal-body .comment-item .comment-branch-line {
    position: absolute !important;
    left: -14px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 2px !important;
    background: var(--border-color, #2a2a4a) !important;
    opacity: 0.3 !important;
}

/* ===== ФОТО В КОММЕНТАРИЯХ ===== */
.trace-modal-body .comment-item .comment-attachments {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    margin-top: 4px !important;
}

.trace-modal-body .comment-item .comment-attachment-item {
    display: inline-block !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    border: 1px solid var(--border-color, #2a2a4a) !important;
    max-width: 120px !important;
}

.trace-modal-body .comment-item .comment-attachment-img {
    max-width: 120px !important;
    max-height: 120px !important;
    object-fit: cover !important;
    display: block !important;
}

/* ===== КОНТЕЙНЕР СПИСКА ===== */
.trace-modal-body .post-comments-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
    padding-right: 4px !important;
}

/* ===== СКРОЛЛБАР ===== */
.trace-modal-body .post-comments-list::-webkit-scrollbar {
    width: 4px !important;
}
.trace-modal-body .post-comments-list::-webkit-scrollbar-track {
    background: var(--bg-input, #1a1a2e) !important;
    border-radius: 2px !important;
}
.trace-modal-body .post-comments-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #2a2a4a) !important;
    border-radius: 2px !important;
}
.trace-modal-body .post-comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent, #00ff88) !important;
}


/* ===== СТАТИСТИКА ПОЛЬЗОВАТЕЛЯ В КОММЕНТАРИЯХ ===== */
.user-stats {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-input, #1a1a2e);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.user-stats .stat-item {
    padding: 0 3px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 3px;
}

.user-stats .stat-item:hover {
    background: rgba(0, 255, 136, 0.15);
    color: var(--text-accent, #00ff88);
}

.user-stats .stat-item .stat-val {
    font-weight: 600;
    min-width: 12px;
    display: inline-block;
    text-align: center;
}

/* ===== МОДАЛКА СТАТИСТИКИ ===== */
.user-stats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-stats-item {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-input, #1a1a2e);
    border-radius: 6px;
    border-left: 3px solid var(--border-color, #2a2a4a);
    font-size: 13px;
    align-items: center;
}

.user-stats-item .stats-item-id {
    font-weight: 600;
    color: var(--text-accent2, #4488ff);
    min-width: 60px;
    font-size: 12px;
}

.user-stats-item .stats-item-date {
    color: var(--text-secondary, #8888aa);
    font-size: 11px;
    min-width: 80px;
}

.user-stats-item .stats-item-text {
    flex: 1;
    color: var(--text-primary, #e0e0e0);
    word-break: break-word;
}

.user-stats-footer {
    padding: 10px 0;
    font-size: 13px;
    color: var(--text-secondary, #8888aa);
    border-top: 1px solid var(--border-color, #2a2a4a);
    margin-top: 12px;
    text-align: center;
}


/* ===== СТАТИСТИКА ПОЛЬЗОВАТЕЛЯ В КОММЕНТАРИЯХ ===== */
.user-stats {
    display: inline-flex !important;
    align-items: center;
    gap: 2px;
    font-size: 9px;
    color: var(--text-secondary);
    background: var(--bg-input, #1a1a2e);
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid var(--border-color, #2a2a4a);
    flex-shrink: 0;
    margin-left: 2px;
}

.user-stats .stat-item {
    padding: 0 2px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
    font-size: 9px;
    white-space: nowrap;
}

.user-stats .stat-item:hover {
    background: rgba(0, 255, 136, 0.15);
    color: var(--text-accent, #00ff88);
}

.user-stats .stat-item .stat-val {
    font-weight: 600;
    min-width: 8px;
    display: inline-block;
    text-align: center;
}

/* В модалке "Все посты" */
#postModalCommentsContent .user-stats {
    font-size: 8px;
    padding: 1px 3px;
}

#postModalCommentsContent .user-stats .stat-item {
    font-size: 8px;
    padding: 0 2px;
}


/* ===== СТАТИСТИКА АВТОРОВ В "ВСЕ ПОСТЫ" ===== */
.post-row-simple-author .user-stats {
    font-size: 9px;
    padding: 1px 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.post-row-simple-author .user-stats .stat-item {
    font-size: 9px;
    padding: 0 2px;
}

.post-row-simple-author .user-stats .stat-item .stat-val {
    font-size: 9px;
    min-width: 6px;
}


/* ===== ССЫЛКИ В МОДАЛКЕ СТАТИСТИКИ ===== */
#userStatsModalContent .user-stats-item .stats-item-id a,
#userStatsModalContent .user-stats-item .stats-item-id a:link,
#userStatsModalContent .user-stats-item .stats-item-id a:visited {
    color: var(--text-accent2, #4488ff) !important;
    text-decoration: none !important;
}

#userStatsModalContent .user-stats-item .stats-item-id a:hover {
    color: #66aaff !important;
    text-decoration: underline !important;
}


/* ===== ВКЛАДКИ В МОДАЛКЕ СТАТИСТИКИ ===== */
.user-stats-item.with-tabs {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px 14px;
}

.user-stats-item-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.stats-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color, #2a2a4a);
    padding-bottom: 6px;
}

.stats-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #8888aa);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    font-family: inherit;
}

.stats-tab-btn:hover {
    color: var(--text-primary, #e0e0e0);
    background: var(--bg-hover, rgba(255,255,255,0.05));
}

.stats-tab-btn.active {
    color: var(--text-accent, #00ff88);
    border-bottom: 2px solid var(--text-accent, #00ff88);
}

.stats-tab-content {
    min-height: 60px;
}

.stats-tab-panel {
    display: none;
    padding: 6px 0;
}

.stats-tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.stats-item-meta {
    font-size: 11px;
    color: var(--text-secondary, #8888aa);
    margin-top: 4px;
}

.stats-item-source {
    font-size: 11px;
    color: var(--text-tertiary, #666);
    margin-top: 2px;
}

.stats-badge.republished-badge {
    font-size: 9px;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(68, 136, 255, 0.15);
    color: #4488ff;
    border: 1px solid rgba(68, 136, 255, 0.2);
    display: inline-block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Светлая тема */
body.light-theme .stats-tab-btn.active {
    color: #2d7a4a;
    border-bottom-color: #2d7a4a;
}

body.light-theme .stats-badge.republished-badge {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    border-color: rgba(13, 110, 253, 0.15);
}



/* ===== ПРОСМОТРЩИК ФОТО ===== */
.photo-viewer-modal {
    background: rgba(0, 0, 0, 0.95);
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border: none;
    box-shadow: none;
    animation: photoViewerIn 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

@keyframes photoViewerIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.photo-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    z-index: 10;
}

.photo-viewer-counter {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.photo-viewer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 0 8px;
    transition: color 0.3s;
    line-height: 1;
}

.photo-viewer-close:hover {
    color: #ff4444;
}

.photo-viewer-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.photo-viewer-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    position: relative;
    padding: 20px;
}

#photoViewerImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
    display: none;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

#photoViewerImage.zoomed {
    cursor: zoom-out;
    transform: scale(1.8);
}

.photo-viewer-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #888;
    font-size: 14px;
}

.photo-viewer-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 32px;
    padding: 16px 20px;
    cursor: pointer;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    user-select: none;
}

.photo-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.photo-viewer-nav:active {
    transform: translateY(-50%) scale(0.9);
}

.photo-viewer-prev {
    left: 20px;
}

.photo-viewer-next {
    right: 20px;
}

.photo-viewer-nav.hidden {
    opacity: 0;
    pointer-events: none;
}

.photo-viewer-footer {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.5);
    text-align: center;
    color: #888;
    font-size: 12px;
    flex-shrink: 0;
    z-index: 10;
}

.photo-viewer-info {
    color: #888;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .photo-viewer-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
        padding: 10px 14px;
    }
    .photo-viewer-prev {
        left: 8px;
    }
    .photo-viewer-next {
        right: 8px;
    }
    .photo-viewer-header {
        padding: 8px 16px;
    }
    .photo-viewer-counter {
        font-size: 12px;
    }
    .photo-viewer-close {
        font-size: 24px;
    }
    #photoViewerImage.zoomed {
        transform: scale(1.5);
    }
}

@media (max-width: 480px) {
    .photo-viewer-nav {
        width: 32px;
        height: 32px;
        font-size: 16px;
        padding: 6px 10px;
    }
    .photo-viewer-prev {
        left: 4px;
    }
    .photo-viewer-next {
        right: 4px;
    }
    #photoViewerImage.zoomed {
        transform: scale(1.2);
    }
}



/* ===== ПРОСМОТРЩИК ФОТО — ПОВЕРХ ВСЕГО ===== */
#photoViewerOverlay {
    z-index: 99999 !important;
}

.photo-viewer-modal {
    background: rgba(0, 0, 0, 0.95) !important;
    border-radius: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
}

.photo-viewer-body {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    overflow: hidden !important;
    min-height: 0 !important;
    padding: 20px !important;
}

.photo-viewer-container {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    width: 100% !important;
    position: relative !important;
    padding: 20px !important;
}

#photoViewerImage {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5) !important;
    display: none !important;
    cursor: zoom-in !important;
    transition: transform 0.3s ease !important;
}

#photoViewerImage.zoomed {
    cursor: zoom-out !important;
    transform: scale(1.8) !important;
}


/* ===== ПРИНУДИТЕЛЬНЫЕ СТИЛИ ДЛЯ ПРОСМОТРЩИКА ФОТО ===== */
#photoViewerOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99999 !important;
    background: rgba(0, 0, 0, 0.95) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
}

#photoViewerOverlay.active {
    display: flex !important;
}

.photo-viewer-modal {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.photo-viewer-body {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    overflow: hidden !important;
    min-height: 0 !important;
    padding: 20px !important;
}

.photo-viewer-container {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    width: 100% !important;
    position: relative !important;
    padding: 20px !important;
}

#photoViewerImage {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5) !important;
    cursor: zoom-in !important;
    transition: transform 0.3s ease !important;
}

#photoViewerImage.zoomed {
    cursor: zoom-out !important;
    transform: scale(1.8) !important;
}

.photo-viewer-loader {
    display: none !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    color: #888 !important;
    font-size: 14px !important;
}

.photo-viewer-loader .spinner {
    width: 40px !important;
    height: 40px !important;
    border: 3px solid rgba(255,255,255,0.1) !important;
    border-top-color: #00ff88 !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
}

.photo-viewer-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: rgba(0, 0, 0, 0.5) !important;
    color: #fff !important;
    border: none !important;
    font-size: 32px !important;
    padding: 16px 20px !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    width: 56px !important;
    height: 56px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    user-select: none !important;
}

.photo-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.photo-viewer-prev {
    left: 20px !important;
}

.photo-viewer-next {
    right: 20px !important;
}

.photo-viewer-nav.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.photo-viewer-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 24px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
}

.photo-viewer-counter {
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.photo-viewer-close {
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 32px !important;
    cursor: pointer !important;
    padding: 0 8px !important;
    transition: color 0.3s !important;
    line-height: 1 !important;
}

.photo-viewer-close:hover {
    color: #ff4444 !important;
}

.photo-viewer-footer {
    padding: 12px 24px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    text-align: center !important;
    color: #888 !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
    z-index: 10 !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ===== АНИМАЦИЯ ДЛЯ INFO BANNER ===== */
.info-banner {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.info-banner.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}


/* ===== ПОИСК: мобильная версия (по умолчанию) ===== */
.filters-group-right {
    flex: 0 1 auto !important;
    min-width: 150px !important;
    max-width: 100% !important;
    width: 100% !important;
}

.search-container {
    max-width: 100% !important;
    min-width: 150px !important;
    width: 100% !important;
}

.search-container input[type="text"] {
    min-width: 80px !important;
    font-size: 13px !important;
    width: 100% !important;
}

/* ===== ПОИСК: ПК версия ===== */
@media (min-width: 768px) {
    .filters-group-right {
        flex: 1 1 auto !important;
        min-width: 350px !important;
        max-width: 500px !important;
        width: auto !important;
    }

    .search-container {
        max-width: 100% !important;
        min-width: 350px !important;
        width: 100% !important;
    }

    .search-container input[type="text"] {
        min-width: 250px !important;
        font-size: 14px !important;
        width: 100% !important;
    }
}

/* ===== ПОИСК: планшеты ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    .filters-group-right {
        min-width: 200px !important;
        max-width: 350px !important;
    }

    .search-container {
        min-width: 200px !important;
    }

    .search-container input[type="text"] {
        min-width: 150px !important;
    }
}


/* ===== СТРЕЛКИ СОРТИРОВКИ ===== */
th.sortable {
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

th.sortable:hover {
    background: rgba(255, 255, 255, 0.03);
}

th.sortable .sort-arrow {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    color: var(--text-tertiary, #555);
    transition: color 0.3s ease;
    vertical-align: middle;
}

/* Активная колонка — зелёная стрелка */
th.sortable .sort-arrow.active {
    color: #00ff88;
}

/* Скрытая стрелка */
th.sortable .sort-arrow.hidden {
    opacity: 0;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    th.sortable .sort-arrow {
        font-size: 9px;
        margin-left: 3px;
    }
}
@media (max-width: 768px) {
    /* Столбец "Всего" */
    #tableBody td{
        padding: 2px 1px !important;
        text-align: center !important;
    }
}
