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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0518 0%, #1a0b2e 100%);
    color: #ffffff;
    min-height: 100vh;
}

.panel-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(20, 10, 40, 0.95);
    border-right: 1px solid rgba(184, 79, 214, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.logo {
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
}

.platform-switch {
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* 🌟 ИЗМЕНЕНИЯ ТУТ: */
    background: rgba(213, 155, 240, 0.25); /* 1. Увеличили плотность цвета с 0.1 до 0.25 */
    backdrop-filter: blur(12px);          /* 2. Эффект матового стекла (теперь фон под меню размывается) */
    border: 1px solid rgba(213, 155, 240, 0.3); /* 3. Тонкая неоновая граница в тон */
    box-shadow: 0 4px 20px rgba(184, 79, 214, 0.15); /* 4. Мягкое фиолетовое свечение вниз */
    
    padding: 5px; /* Чуть-чуть увеличили паддинг для аккуратности */
    border-radius: 60px;
    margin: -20px auto 0 auto;
    width: max-content;
}


.platform-switch span, .lang-switch span {
    padding: 5px 10px;
    border-radius: 60px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-align: center; /* 👈 Дополнительно центрирует текст внутри самих кнопок */
}

.platform-switch span.active, .lang-switch span.active {
    background: rgba(184, 79, 214, 0.6);
}



.lang-switch {
    justify-content: center; /* 👈 Центрирует элементы (RU/EN) внутри самого меню */
    align-items: center; 
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 60px;
    width: max-content;
    /* 🌟 ИЗМЕНЕНИЯ ТУТ: */
    background: rgba(213, 155, 240, 0.25); /* 1. Увеличили плотность цвета с 0.1 до 0.25 */
    backdrop-filter: blur(12px);          /* 2. Эффект матового стекла (теперь фон под меню размывается) */
    border: 1px solid rgba(213, 155, 240, 0.3); /* 3. Тонкая неоновая граница в тон */
    box-shadow: 0 4px 20px rgba(184, 79, 214, 0.15); /* 4. Мягкое фиолетовое свечение вниз */
}



.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s;
    
}

.nav-item:hover {
    background: rgba(184, 79, 214, 0.15);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    color: white;
}

.nav-divider {
    margin: 15px 0;
    border-top: 1px solid rgba(184, 79, 214, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h1 {
    font-size: 32px;
    font-weight: 700;
}

/* Period Selector */
.period-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.period-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(184, 79, 214, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.period-btn.active {
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    border-color: transparent;
}

.date-picker {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(184, 79, 214, 0.3);
    border-radius: 8px;
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(184, 79, 214, 0.2);
    border-radius: 16px;
    padding: 24px;
}

.stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-change {
    font-size: 13px;
    font-weight: 600;
}

.stat-change.positive {
    color: #27ca40;
}

.stat-change.negative {
    color: #ff5f56;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(184, 79, 214, 0.2);
    border-radius: 16px;
    padding: 24px;
}

.chart-card h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

/* Time Stats */
.time-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.time-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.time-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.time-value {
    font-size: 24px;
    font-weight: 700;
    color: #b84fd6;
}

/* Platforms Balance */
.platforms-balance {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.platform-item {
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.platform-name {
    font-weight: 600;
    margin-bottom: 10px;
}

.balance-info {
    display: flex;
    gap: 20px;
    font-size: 14px;
}

.frozen {
    color: #ffbd2e;
}

.available {
    color: #27ca40;
}

/* Platforms Tabs */
.platforms-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.platform-tab {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(184, 79, 214, 0.3);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.platform-tab.active {
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
}

/* Order Filters */
.order-filters {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(184, 79, 214, 0.3);
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

.filter-btn.active {
    background: rgba(184, 79, 214, 0.3);
}



/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.settings-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(184, 79, 214, 0.2);
    border-radius: 16px;
    padding: 24px;
}

.settings-card h3 {
    margin-bottom: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item:last-child {
    border-bottom: none;
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: #b84fd6;
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.balance-display {
    text-align: center;
    padding: 30px;
}

.balance-amount {
    font-size: 48px;
    font-weight: 700;
    color: #b84fd6;
    margin-bottom: 10px;
}

.balance-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: rgba(255, 255, 255, 0.6);
}


/* Стили для заказов GGSEL */
.order-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(184, 79, 214, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin: 10px 0;
  cursor: pointer;
  transition: all 0.3s;
}
.order-item:hover { border-color: #b84fd6; transform: translateX(5px); }

.order-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.order-platform.ggsel { background: rgba(0, 136, 204, 0.2); color: #0088cc; padding: 4px 10px; border-radius: 4px; font-size: 12px; }
.order-prices { font-weight: bold; margin: 8px 0; }
.order-meta { font-size: 12px; color: rgba(255,255,255,0.5); }

/* Модалка */
.modal { position: fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.8); z-index:1000; display:flex; align-items:center; justify-content:center; }
.modal-content.ggsel-style { background: #1a0b2e; border: 1px solid #b84fd6; padding: 30px; border-radius: 16px; width: 500px; max-width: 90%; }
.modal-header { display:flex; justify-content:space-between; margin-bottom:20px; }
.order-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.detail-group h4 { font-size: 12px; color: rgba(255,255,255,0.5); text-transform: uppercase; }
.review-box { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 8px; margin-top: 15px; }





















/* ===== КОНТЕЙНЕР ЧАТОВ (3 колонки) ===== */
.chats-container {
    display: flex;
    height: calc(100vh - 160px);
    max-height: 800px;
    background: rgba(15, 15, 30, 0.6);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(184, 79, 214, 0.2);
}

/* --- Список чатов (лево) --- */
.chats-sidebar {
    width: 250px;
    min-width: 220px;
    border-right: 1px solid rgba(184, 79, 214, 0.15);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
}

.chats-sidebar-title {
    padding: 16px;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(184, 79, 214, 0.15);
}

#chatList {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:hover {
    background: rgba(184, 79, 214, 0.08);
}

.chat-item.active {
    background: rgba(184, 79, 214, 0.15);
    border-left: 3px solid #b84fd6;
}

.chat-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.chat-item-preview {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Переписка (центр) --- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(184, 79, 214, 0.15);
    color: #fff;
    font-size: 16px;
}

.chat-header h3 {
    margin: 0;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Сообщения */
.chat-message {
    margin-bottom: 5px;
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 80%;
}

.chat-message.other {
    background: rgba(255, 255, 255, 0.08);
    margin-right: auto;
}

.chat-message.own {
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    margin-left: auto;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.7;
    color: #fff;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    color: #fff;
    word-wrap: break-word;
}

.message-time {
    font-size: 10px;
    opacity: 0.5;
    text-align: right;
    margin-top: 5px;
    color: #fff;
}

/* Поле ввода */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(184, 79, 214, 0.2);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(184, 79, 214, 0.3);
    border-radius: 8px;
    color: white;
    outline: none;
    font-size: 14px;
}

.chat-input-area input:focus {
    border-color: #b84fd6;
}

.chat-input-area input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.send-btn {
    padding: 0 20px;
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s, opacity 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* --- Детали сделки (ПРАВО) --- */
.deal-details-sidebar {
    width: 260px;
    min-width: 240px;
    border-left: 1px solid rgba(184, 79, 214, 0.15);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.deal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(184, 79, 214, 0.15);
}

.deal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
    font-weight: 600;
}

.deal-status {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.status-pending {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
}

.deal-info-block {
    flex: 1;
}

.deal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
}

.deal-label {
    color: rgba(255, 255, 255, 0.4);
}

.deal-value {
    color: #fff;
    font-weight: 500;
    text-align: right;
}

.deal-highlight {
    color: #b84fd6;
    font-weight: 700;
    font-size: 15px;
}

.deal-pending {
    color: #facc15;
}

.deal-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid rgba(184, 79, 214, 0.15);
}

.btn-deal-primary {
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    color: white;
    transition: opacity 0.2s;
}

.btn-deal-primary:hover {
    opacity: 0.85;
}

.btn-deal-secondary {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(184, 79, 214, 0.3);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
}

.btn-deal-secondary:hover {
    background: rgba(184, 79, 214, 0.1);
    color: #fff;
}

/* Скроллбар в тёмной теме */
#chatList::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.deal-details-sidebar::-webkit-scrollbar {
    width: 6px;
}

#chatList::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.deal-details-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#chatList::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.deal-details-sidebar::-webkit-scrollbar-thumb {
    background: rgba(184, 79, 214, 0.3);
    border-radius: 3px;
}

/* ===== Общие ===== */
[hidden] { display: none !important; }
.admin-only { display: flex; flex-direction: column; gap: 5px; }
.list-empty { padding: 16px; text-align: center; opacity: .5; font-size: 13px; }
.list-empty.err { color: #ff5f56; opacity: 1; }
.nav-badge, .unread {
    background: #ff5f56; color: #fff; border-radius: 10px; padding: 1px 7px;
    font-size: 11px; font-weight: 700; margin-left: auto;
}
.search-input, .select {
    padding: 9px 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(184,79,214,.3);
    border-radius: 8px; color: #fff; outline: none; font-size: 14px; min-width: 260px;
}
.search-input.small { min-width: 0; width: calc(100% - 24px); margin: 12px; }
.select option { background: #1a0b2e; }

/* ===== Статусы ===== */
.deal-status { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 12px; font-weight: 600; white-space: nowrap; }
.st-awaiting { background: rgba(250,204,21,.15); color: #facc15; }
.st-sent     { background: rgba(96,165,250,.15); color: #60a5fa; }
.st-done     { background: rgba(34,197,94,.15);  color: #4ade80; }
.st-refund   { background: rgba(255,95,86,.15);  color: #ff5f56; }
.st-problem  { background: rgba(255,95,86,.25);  color: #ff8a80; }

/* ===== Заказы ===== */
.filters-bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.order-filters { flex-wrap: wrap; }
.filter-btn .cnt { opacity: .6; font-weight: 600; margin-left: 4px; }
.order-product { font-size: 15px; font-weight: 600; }
.order-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.order-platform.playerok { background: rgba(184,79,214,.2); color: #d59bf0; padding: 3px 9px; border-radius: 6px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.order-actions:empty { display: none; }
.pending-action { font-size: 13px; color: #facc15; }
.btn-deal-danger {
    padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px;
    background: rgba(255,95,86,.12); color: #ff8a80; border: 1px solid rgba(255,95,86,.35);
}
.btn-deal-danger:hover { background: rgba(255,95,86,.22); }
a.btn-deal-secondary { text-decoration: none; text-align: center; display: inline-block; }
.btn-deal-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-deal-primary.wide { width: 100%; margin-top: 20px; padding: 12px; font-size: 15px; }

/* ===== Чаты ===== */
.account-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.account-tabs .platform-tab { padding: 8px 14px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-item-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.chat-item-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 10px; color: gray; }
.acc-badge:empty { display: none; }
.chat-message.admin { background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.35); margin-right: auto; }
.chat-message.system {
    background: rgba(184,79,214,.1); border: 1px solid rgba(184,79,214,.3);
    margin: 6px auto; max-width: 90%; text-align: center; border-radius: 8px; padding: 8px 12px;
}
.chat-message.system.sys-problem  { border-color: rgba(255,95,86,.45); background: rgba(255,95,86,.08); }
.chat-message.system.sys-confirmed,
.chat-message.system.sys-resolved { border-color: rgba(74,222,128,.4); background: rgba(74,222,128,.07); }
.chat-message.system.sys-refunded { border-color: rgba(250,204,21,.4); background: rgba(250,204,21,.07); }
.chat-message.system.sys-admin    { border-color: rgba(96,165,250,.45); background: rgba(96,165,250,.08); }
.chat-message.system .message-text { font-size: 13px; }
.sys-icon { font-size: 16px; margin-bottom: 2px; }
.msg-img { max-width: 220px; border-radius: 8px; display: block; margin: 4px 0; }
.msg-status { margin-left: 4px; }

/* ===== Панель сделки ===== */
.deal-details-sidebar { width: 300px; min-width: 260px; gap: 10px; }
.deal-count { background: rgba(184,79,214,.2); border-radius: 10px; padding: 2px 8px; font-size: 12px; }
.deal-card { border: 1px solid rgba(184,79,214,.2); border-radius: 10px; padding: 10px 12px; background: rgba(255,255,255,.02); }
.deal-card summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.deal-card summary::-webkit-details-marker { display: none; }
.deal-card-title { font-size: 13px; font-weight: 600; }
.deal-card-sub { font-size: 12px; opacity: .8; }
.deal-card[open] summary { margin-bottom: 12px; }
.deal-card .deal-actions { margin-top: 10px; padding-top: 10px; }
.deal-value { max-width: 60%; word-break: break-word; }

/* ===== Настройки / баланс ===== */
.card-subtitle { margin: 10px 0; font-size: 14px; opacity: .7; }
.mini-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.mini-row {
    display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
    padding: 10px 12px; background: rgba(255,255,255,.03); border-radius: 8px; font-size: 13px;
}
.mini-row small { display: block; opacity: .5; font-size: 11px; }
.mini-row .pos { color: #4ade80; }
.mini-row .neg { color: #ff8a80; }
.wd-status { font-size: 11px; padding: 3px 8px; border-radius: 8px; }
.wd-pending  { background: rgba(250,204,21,.15); color: #facc15; }
.wd-paid     { background: rgba(34,197,94,.15);  color: #4ade80; }
.wd-rejected { background: rgba(255,95,86,.15);  color: #ff5f56; }

/* ===== Модалка / формы / тосты ===== */
.modal-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; opacity: .6; }
.modal-content .deal-actions { flex-direction: row; flex-wrap: wrap; }
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; opacity: .9; }
.form-grid input, .form-grid select {
    padding: 10px 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(184,79,214,.3);
    border-radius: 8px; color: #fff; outline: none;
}
.form-grid select option { background: #1a0b2e; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }
#toastRoot { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.toast {
    background: rgba(20,10,40,.95); border: 1px solid rgba(74,222,128,.4); color: #fff;
    padding: 12px 16px; border-radius: 10px; font-size: 14px; max-width: 360px;
    box-shadow: 0 8px 30px rgba(0,0,0,.4); animation: fadeIn .2s ease-out;
}
.toast.err { border-color: rgba(255,95,86,.5); }

/* ===== МОБИЛЬНАЯ ВЕРСИЯ ===== */
.burger-btn {
    display: none; /* на десктопе скрыта */
    background: linear-gradient(135deg, #b84fd6 0%, #8b2fd1 100%);
    border: none;
    color: white;
    font-size: 22px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(184, 79, 214, 0.4);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
    /* --- Бургер --- */
    .burger-btn { display: block; }

    /* --- Сайдбар как выезжающая шторка --- */
    .sidebar {
        width: 280px;
        position: fixed;
        left: -300px;           /* прячем за экран */
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    .sidebar.open { left: 0; }

    /* --- Основной контент --- */
    .main-content {
        margin-left: 0;
        padding: 70px 16px 20px 16px; /* отступ сверху под бургер */
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .section-header h1 { font-size: 24px; }

    /* --- Сетка статистики в 1 колонку --- */
    .stats-grid { grid-template-columns: 1fr; }

    /* --- Графики в 1 колонку --- */
    .charts-row { grid-template-columns: 1fr; }

    /* --- Период/фильтры — перенос на новую строку --- */
    .period-selector,
    .order-filters,
    .platforms-tabs {
        flex-wrap: wrap;
    }
    .period-btn, .filter-btn, .platform-tab {
        flex: 1 1 auto;
        text-align: center;
    }

    /* --- Настройки в 1 колонку --- */
    .settings-grid { grid-template-columns: 1fr; }

    /* --- ЧАТЫ: табы вместо 3 колонок --- */
    .chats-container {
        flex-direction: column;
        height: calc(100vh - 180px);
        max-height: none;
    }
    .chats-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 40%;
        border-right: none;
        border-bottom: 1px solid rgba(184, 79, 214, 0.15);
    }
    .chat-main {
        flex: 1;
        min-height: 0;
    }
    .deal-details-sidebar {
        display: none; /* скрываем на мобильном, откроем по кнопке */
        position: fixed;
        inset: 0;
        width: 100%;
        z-index: 1002;
        border-left: none;
    }
    .deal-details-sidebar.open {
        display: flex;
    }

    /* --- Модалки --- */
    .modal-content.ggsel-style {
        width: 95%;
        padding: 20px;
    }
    .order-details-grid { grid-template-columns: 1fr; }

    /* --- Time stats --- */
    .time-stats {
        flex-direction: column;
        gap: 15px;
    }

    /* --- Балансы площадок --- */
    .balance-info { flex-direction: column; gap: 5px; }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .main-content { padding: 65px 12px 15px 12px; }
    .section-header h1 { font-size: 20px; }
    .stat-value { font-size: 22px; }
    .balance-amount { font-size: 36px; }
    .chat-message { max-width: 90%; }
}




/* ===== плашки аккаунтов ===== */
.acc-badge {
    --acc: #b84fd6;
    display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
    padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .3px;
    white-space: nowrap; line-height: 1.5;
    background: color-mix(in srgb, var(--acc) 18%, transparent);
    color: color-mix(in srgb, var(--acc) 65%, white);
    border: 1px solid color-mix(in srgb, var(--acc) 45%, transparent);
}
.chat-header .acc-badge { font-size: 12px; padding: 3px 12px; max-width: 220px; }
.acc-dot {
    --acc: #b84fd6;
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--acc); box-shadow: 0 0 6px var(--acc);
}
.chat-item-meta { gap: 8px; }
.chat-item-meta > span:last-child { flex-shrink: 0; }

/* ===== разделители дат ===== */
.day-sep { display: flex; justify-content: center; margin: 10px 0 4px; position: sticky; top: 0; z-index: 2; }
.day-sep span {
    font-size: 11px; font-weight: 600; color: rgba(255,255,255,.75);
    background: rgba(30,15,55,.9); border: 1px solid rgba(184,79,214,.25);
    padding: 3px 12px; border-radius: 999px; backdrop-filter: blur(6px);
}
.message-time { cursor: default; }

/* ===== фото в чате ===== */
.chat-message.image-only { padding: 4px; background: transparent; border: none; }
.chat-message.image-only .message-time { padding: 0 6px 2px; }
.msg-img { max-width: 260px; max-height: 320px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }

.chat-main { position: relative; }
.attach-btn {
    width: 42px; flex-shrink: 0; border-radius: 8px; cursor: pointer; font-size: 18px;
    background: rgba(255,255,255,.05); border: 1px solid rgba(184,79,214,.3); color: #fff;
}
.attach-btn:hover { background: rgba(184,79,214,.15); }
.attach-btn:disabled, .send-btn:disabled { opacity: .4; cursor: wait; }

.attach-preview {
    display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 20px 0;
    border-top: 1px solid rgba(184,79,214,.2); background: rgba(0,0,0,.2);
}
.attach-thumb { position: relative; width: 64px; height: 64px; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid rgba(184,79,214,.4); }
.attach-thumb button {
    position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
    border: none; background: #ff5f56; color: #fff; font-size: 11px; cursor: pointer; line-height: 20px;
}
.attach-preview + .chat-input-area { border-top: none; }

.drop-overlay {
    position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; font-size: 42px;
    background: rgba(184,79,214,.15); border: 2px dashed #b84fd6; border-radius: 12px;
    backdrop-filter: blur(3px); pointer-events: none;
}
.drop-overlay::after { content: attr(data-text); font-size: 15px; font-weight: 600; }
.mobile-only, .mobile-deal-btn { display: none; }
@media (max-width: 768px) {
    .mobile-only, .mobile-deal-btn { display: inline-block; align-self: flex-end; }
}

/* правая панель всегда видна на широком экране; на планшете — выезжает по кнопке ℹ️ */
@media (min-width: 1201px) {
    .deal-details-sidebar { display: flex !important; position: static !important; transform: none !important; }
}
.deal-comment { margin: 10px 0 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.deal-comment.seller { border-color: rgba(184,79,214,.35); background: rgba(184,79,214,.07); }
.deal-comment .deal-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.deal-comment-text { font-size: 13px; line-height: 1.5; word-break: break-word; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
.kv small { opacity: .55; }
.copy { cursor: pointer; font-weight: 600; word-break: break-all; }
.copy:hover { color: #d59bf0; }

/* товары */
.filters-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.filters-inline .search-input { min-width: 220px; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.product-card {
    display: flex; flex-direction: column; gap: 12px; padding: 18px;
    background: rgba(255,255,255,.03); border: 1px solid rgba(184,79,214,.2); border-radius: 16px; transition: .2s;
}
.product-card:hover { border-color: rgba(184,79,214,.5); transform: translateY(-2px); }
.product-top { display: flex; justify-content: space-between; align-items: center; }
.product-last { font-size: 11px; opacity: .5; }
.product-name { font-weight: 700; font-size: 15px; line-height: 1.35; min-height: 40px; }
.product-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.product-stats div { background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px; text-align: center; }
.product-stats b { display: block; font-size: 14px; }
.product-stats small { font-size: 10px; opacity: .55; text-transform: uppercase; }
.product-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.product-rate { font-size: 13px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.product-rate b { color: #d59bf0; }
.product-rate small, .muted { opacity: .55; }
/* =====================================================================
   Закрепы, «Избранные», заметки, пруфы, Telegram, история
   ===================================================================== */
.chat-header h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-head-btn {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 16px;
    background: rgba(255,255,255,.05); border: 1px solid rgba(184,79,214,.3); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; filter: grayscale(1) opacity(.7);
    transition: .2s;
}
.icon-head-btn:hover { background: rgba(184,79,214,.15); filter: none; }
.icon-head-btn.active { background: rgba(184,79,214,.3); border-color: #b84fd6; filter: none; }

.chat-item.fav-item { background: linear-gradient(90deg, rgba(250,204,21,.08), transparent); }
.chat-item.fav-item.active { border-left-color: #facc15; background: rgba(250,204,21,.12); }
.fav-ico { color: #facc15; }
.pin-ico { font-size: 11px; opacity: .7; margin-left: auto; }
.pin-ico + .unread { margin-left: 4px; }
.note-ico { font-size: 11px; }
.chat-item.pinned { background: rgba(184,79,214,.05); }
.chat-main.is-fav .chat-input-area input::placeholder { color: rgba(250,204,21,.45); }
.fav-hint { font-size: 13px; line-height: 1.5; color: rgba(255,255,255,.6); }
.msg-del {
    background: none; border: none; cursor: pointer; font-size: 11px; opacity: 0; margin-left: 6px;
    transition: opacity .15s; padding: 0;
}
.chat-message:hover .msg-del { opacity: .8; }
@media (hover: none) { .msg-del { opacity: .6; } }

/* заметки о покупателе */
.notes-box {
    margin-bottom: 14px; padding: 12px; border-radius: 12px;
    background: rgba(250,204,21,.05); border: 1px solid rgba(250,204,21,.22);
}
.notes-head { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: #fde68a; word-break: break-word; }
.note { padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.2); margin-bottom: 6px; }
.note-text { font-size: 13px; line-height: 1.45; word-break: break-word; }
.note-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; font-size: 11px; opacity: .55; }
.note-del { background: none; border: none; cursor: pointer; font-size: 12px; opacity: .8; }
.notes-empty { font-size: 12px; opacity: .5; margin-bottom: 8px; }
.note-form { display: flex; flex-direction: column; gap: 6px; }
.note-form textarea {
    width: 100%; resize: vertical; min-height: 44px; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 13px;
    background: rgba(255,255,255,.05); border: 1px solid rgba(250,204,21,.25); color: #fff; outline: none;
}
.note-form textarea:focus { border-color: #facc15; }

/* пруфы */
.proof-chip {
    display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
    background: rgba(74,222,128,.12); color: #4ade80; border: 1px solid rgba(74,222,128,.3);
}
.proof-hint { font-size: 13px; line-height: 1.5; opacity: .75; margin-bottom: 12px; }
.proof-order { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.04); margin-bottom: 14px; }
.proof-drop {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; cursor: pointer;
    border: 2px dashed rgba(184,79,214,.45); border-radius: 14px; background: rgba(184,79,214,.06); text-align: center;
    transition: .2s;
}
.proof-drop:hover { background: rgba(184,79,214,.12); border-color: #b84fd6; }
.proof-drop-ico { font-size: 36px; }
.proof-drop small { opacity: .5; }
.proof-progress { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.04); }
.proof-progress-name { font-size: 13px; word-break: break-all; }
.proof-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.proof-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b84fd6, #8b2fd1); transition: width .2s; }

/* Telegram */
.tg-link {
    display: flex; flex-direction: column; gap: 10px; padding: 14px; margin-bottom: 8px; border-radius: 12px;
    background: rgba(0,136,204,.08); border: 1px solid rgba(0,136,204,.3);
}
.tg-link.ok { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.tg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin-right: 8px; box-shadow: 0 0 8px #4ade80; }
.tg-link .btn-deal-primary.wide { margin-top: 0; background: linear-gradient(135deg, #229ed9, #0088cc); text-decoration: none; text-align: center; display: block; }
.tg-code { font-family: ui-monospace, monospace; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.3); text-align: center; }
#tgCode { display: flex; flex-direction: column; gap: 8px; }
#tgCode:empty { display: none; }

/* история */
.seg-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: rgba(0,0,0,.25); }
.seg-tabs button { padding: 7px 14px; border: none; border-radius: 8px; background: none; color: rgba(255,255,255,.7); cursor: pointer; font-weight: 600; }
.seg-tabs button.active { background: linear-gradient(135deg, #b84fd6, #8b2fd1); color: #fff; }
.history-list { max-height: none; }
.hist-row b small { display: block; text-align: right; }
.btn-deal-secondary.wide { width: 100%; margin-top: 14px; }

/* =====================================================================
   Адаптивность: планшеты и телефоны
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; }
img, video, canvas { max-width: 100%; }
.charts-row { grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); }
.settings-grid { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.chats-sidebar { min-width: 0; }
.mobile-only, .icon-head-btn.mobile-only, .icon-head-btn.mobile-deal-btn, .deal-details-sidebar #closeDealBtn { display: none; }
.section-header { flex-wrap: wrap; }
.section-header h1 { white-space: nowrap; }
.day-sep { position: static; }

/* --- планшет: панель деталей выезжает справа --- */
@media (max-width: 1200px) {
    .mobile-deal-btn, .icon-head-btn.mobile-deal-btn { display: inline-flex; }
    .deal-details-sidebar {
        display: none; position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); z-index: 1002;
        background: #160a2b; box-shadow: -20px 0 50px rgba(0,0,0,.5); padding-top: calc(20px + env(safe-area-inset-top));
    }
    .deal-details-sidebar.open { display: flex; }
    .deal-details-sidebar #closeDealBtn { display: inline-block; }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar { width: 220px; padding: 16px; }
    .main-content { margin-left: 220px; padding: 28px 24px; }
    .chats-sidebar { width: 230px; }
    .section-header { flex-wrap: wrap; gap: 12px; }
    .search-input, .select { min-width: 0; }
}

/* --- телефон --- */
@media (max-width: 768px) {
    .mobile-only, .icon-head-btn.mobile-only { display: inline-flex; }
    body { overflow-x: hidden; }
    .main-content { padding: calc(64px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)); }
    .burger-btn { top: calc(12px + env(safe-area-inset-top)); left: 12px; }
    .section-header h1 { font-size: 22px; }
    .filters-inline, .filters-bar { width: 100%; }
    .filters-inline > *, .filters-bar > .select { flex: 1 1 100%; }
    .search-input, .select { min-width: 0; width: 100%; }
    .section-header > .search-input { width: 100%; }
    .order-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; width: 100%; }
    .order-filters::-webkit-scrollbar { display: none; }
    .filter-btn { flex: 0 0 auto; white-space: nowrap; }
    .order-item:hover { transform: none; }
    .order-actions > * { flex: 1 1 auto; }
    .products-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 20px; }
    .period-selector { width: 100%; }
    .date-picker { flex: 1 1 100%; }
    .account-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; scrollbar-width: none; }
    .account-tabs::-webkit-scrollbar { display: none; }
    .account-tabs .platform-tab { flex: 0 0 auto; white-space: nowrap; }

    /* чаты: список ↔ переписка */
    #section-chats .section-header { margin-bottom: 12px; }
    .chats-container { height: calc(100vh - var(--chat-top, 190px) - 12px); height: calc(100dvh - var(--chat-top, 190px) - 12px); min-height: 360px; flex-direction: row; position: relative; }
    .chats-sidebar { width: 100%; max-height: none; border-right: none; border-bottom: none; }
    .chat-main { display: none; }
    .chats-container.show-chat .chats-sidebar { display: none; }
    .chats-container.show-chat .chat-main { display: flex; width: 100%; }
    .chat-header { padding: 10px 12px; gap: 8px; }
    .chat-header h3 { font-size: 15px; }
    .chat-header #chatAccount { display: none; }
    .chat-messages { padding: 12px; }
    .chat-message { max-width: 88%; }
    .msg-img { max-width: 100%; }
    .chat-input-area { padding: 10px; gap: 8px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    .chat-input-area input { min-width: 0; font-size: 16px; } /* 16px — iOS не зумит поле */
    .send-btn { padding: 0 14px; }
    .attach-preview { padding: 8px 10px 0; }
    .deal-details-sidebar { width: 100vw; }

    /* модалки — снизу как шторка */
    .modal { align-items: flex-end; }
    .modal-content.ggsel-style {
        width: 100%; max-width: 100%; max-height: 92dvh; overflow-y: auto; border-radius: 18px 18px 0 0;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    }
    .modal-content .deal-actions { flex-direction: column; }
    .form-grid input, .form-grid select, .note-form textarea { font-size: 16px; }
    #toastRoot { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
    .toast { max-width: none; }
    .mini-row { grid-template-columns: 1fr auto; }
    .mini-row > small:last-child { grid-column: 1 / -1; }
    .settings-card { padding: 16px; }
    .balance-display { padding: 16px 0; }
    .tg-link.ok { flex-direction: column; align-items: stretch; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* flex-элемент не должен растягиваться под содержимое (длинные ленты вкладок) */
.main-content { min-width: 0; }
.vb-box { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(94,234,212,.06); border: 1px solid rgba(94,234,212,.25); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.vb-box.paused { background: rgba(251,191,36,.07); border-color: rgba(251,191,36,.35); }
.vb-box-head b { color: #5eead4; }
.vb-box.paused .vb-box-head b { color: #fbbf24; }
.vb-box-warn { color: #fbbf24; font-weight: 600; }
.vb-box-row { color: rgba(255,255,255,.75); word-break: break-word; }
.vb-box-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.vb-box-actions button { font-size: 12px; padding: 6px 10px; }

/* ---------- чаты по высоте экрана (планшеты, телефоны): поле ввода всегда видно ---------- */
@media (max-width: 1200px) {
    .chats-container {
        height: calc(100vh - var(--chat-top, 160px) - 16px);
        height: calc(100dvh - var(--chat-top, 160px) - 16px);
        max-height: none; min-height: 360px;
    }
}
/* планшет: как на телефоне — список чатов ↔ переписка на всю ширину */
@media (max-width: 1024px) and (min-width: 769px) {
    .chats-container { position: relative; }
    .chats-sidebar { width: 100%; min-width: 0; border-right: none; }
    .chat-main { display: none; }
    .chats-container.show-chat .chats-sidebar { display: none; }
    .chats-container.show-chat .chat-main { display: flex; width: 100%; }
    .icon-head-btn.mobile-only#backToListBtn { display: inline-flex; }
    .chat-input-area input { font-size: 16px; }
}
