/* ============================================ */
/* 1. ОБНУЛЕНИЕ                                 */
/* ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg, linear-gradient(145deg, #0a0618 0%, #1a0b2e 30%, #0d1b2a 70%, #000000 100%));
    color: var(--fg, #ffffff);
    min-height: 100vh;
    padding: 16px;
    background-attachment: fixed;
}

.app-wrapper {
    max-width: 440px;
    margin: 0 auto;
    padding-bottom: 84px;
}

/* ============================================ */
/* 2. ШАПКА                                     */
/* ============================================ */

.header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(20, 10, 50, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(160, 80, 255, 0.15);
    padding: 14px 18px;
    border-radius: 16px;
    margin-bottom: 16px;
    text-align: left;
}

.theme-toggle {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(160, 80, 255, 0.3);
    border-radius: 12px;
    background: rgba(20, 10, 50, 0.6);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.theme-toggle:active {
    transform: scale(0.9);
}

.user-avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    border: 2px solid rgba(160, 80, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.user-info-header {
    flex: 1;
    min-width: 0;
}

.user-info-header h1 {
    font-size: 20px;
    color: #fbbf24;
    font-weight: 700;
    margin-bottom: 2px;
}

.user-name {
    font-size: 14px;
    color: #e9d5ff;
    font-weight: 500;
}

.user-status {
    font-size: 11px;
    color: #34c759;
    opacity: 0.8;
}

/* ============================================ */
/* 3. АВТОРИЗАЦИЯ                               */
/* ============================================ */

#authPanel {
    background: rgba(20, 10, 50, 0.5);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(251, 191, 36, 0.2);
    border-radius: 16px;
    padding: 30px 20px;
    margin-bottom: 16px;
    text-align: center;
}

#authPanel .btn {
    width: 100%;
    max-width: 300px;
    font-size: 18px;
    padding: 14px;
}

.auth-hint {
    font-size: 12px;
    color: #4b1d8a;
    margin-top: 8px;
}

/* ============================================ */
/* 4. БАЛАНСЫ                                   */
/* ============================================ */

.balances-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.balance-card {
    background: rgba(20, 10, 50, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(160, 80, 255, 0.1);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance-card.main-balance {
    border-color: rgba(52, 199, 89, 0.2);
}

.balance-card.deposit-balance {
    border-color: rgba(251, 191, 36, 0.2);
}

.balance-card-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.balance-card-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.balance-card-label {
    display: block;
    font-size: 10px;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-card-amount {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.main-balance .balance-card-amount {
    color: #34c759;
}

.deposit-balance .balance-card-amount {
    color: #fbbf24;
}

/* ============================================ */
/* 5. ОПЕРАЦИИ                                  */
/* ============================================ */

.operations-box {
    background: rgba(20, 10, 50, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(160, 80, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.operations-header {
    text-align: left;
    margin-bottom: 12px;
}

.operations-title {
    font-size: 14px;
    font-weight: 600;
    color: #e9d5ff;
}

.operations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.op-btn {
    padding: 10px 8px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.op-btn:active {
    transform: scale(0.93);
}

.op-add {
    background: rgba(52, 199, 89, 0.2);
    color: #34c759;
}

.op-add:hover {
    background: rgba(52, 199, 89, 0.3);
}

.op-deposit {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.op-deposit:hover {
    background: rgba(251, 191, 36, 0.3);
}

.op-withdraw {
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
}

.op-withdraw:hover {
    background: rgba(251, 191, 36, 0.2);
}

.operation-custom {
    display: flex;
    gap: 8px;
}

.operation-custom input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(160, 80, 255, 0.2);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(20, 10, 40, 0.6);
    color: #ffffff;
    outline: none;
    min-width: 80px;
}

.operation-custom input:focus {
    border-color: #a855f7;
}

.operation-custom .btn {
    min-width: 80px;
    padding: 10px 14px;
    font-size: 13px;
}

/* ============================================ */
/* 6. ПОПОЛНЕНИЕ КРИПТО                         */
/* ============================================ */

.deposit-box {
    background: rgba(20, 10, 50, 0.5);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(251, 191, 36, 0.15);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.deposit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.1);
}

.deposit-icon {
    font-size: 22px;
}

.deposit-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #e9d5ff;
    text-align: left;
}

.deposit-badge {
    font-size: 10px;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    padding: 2px 10px;
    border-radius: 10px;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.payment-section {
    background: rgba(20, 10, 40, 0.3);
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(160, 80, 255, 0.08);
}

.payment-label {
    font-size: 12px;
    color: #a78bfa;
    margin-bottom: 6px;
    text-align: center;
}

.payment-btn {
    width: 100%;
    min-width: unset;
    font-size: 13px;
    padding: 10px;
}

/* ============================================ */
/* 7. НИЖНЯЯ НАВИГАЦИЯ                          */
/* ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 440px;
    display: flex;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(14, 7, 36, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(160, 80, 255, 0.25);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: #a78bfa;
    user-select: none;
}

.nav-btn span {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.nav-btn.active {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.nav-btn:active {
    transform: scale(0.92);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    background: rgba(20, 10, 50, 0.4);
    padding: 5px;
    border-radius: 14px;
    border: 1px solid rgba(160, 80, 255, 0.1);
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    padding: 10px 4px;
    border: none;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #a78bfa;
    user-select: none;
    min-width: 55px;
}

.tab-btn.active {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}

.tab-btn:active {
    transform: scale(0.95);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.expandable-details {
    margin-bottom: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card-bg);
}

.expandable-details summary {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    user-select: none;
    list-style: none;
}

.expandable-details summary::-webkit-details-marker {
    display: none;
}

.expandable-details[open] summary {
    border-bottom: 1px solid var(--border-soft);
}

.expandable-details .add-form,
.expandable-details .add-product-box {
    padding: 10px 12px 12px;
    margin: 0;
}

/* ============================================ */
/* 8. ТОВАРЫ                                    */
/* ============================================ */

.products-section {
    background: rgba(20, 10, 50, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(160, 80, 255, 0.1);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    min-height: 180px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(160, 80, 255, 0.1);
}

.section-title {
    font-size: 16px;
    color: #e9d5ff;
    font-weight: 600;
}

.product-count {
    font-size: 13px;
    color: #a78bfa;
    background: rgba(80, 30, 160, 0.3);
    padding: 3px 10px;
    border-radius: 12px;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(80, 30, 160, 0.1);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(160, 80, 255, 0.06);
    animation: slideIn 0.3s ease;
}

.product-item .product-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.product-item .product-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.product-item .product-name {
    font-size: 14px;
    color: #e9d5ff;
    font-weight: 500;
}

.product-item .product-price {
    font-size: 12px;
    color: #fbbf24;
}

.product-item .product-desc {
    font-size: 11px;
    color: #6d28d9;
    margin-top: 2px;
}

.product-item .product-meta {
    font-size: 10px;
    color: #4b1d8a;
}

.product-item .product-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================ */
/* 9. КНОПКИ ДЕЙСТВИЙ                          */
/* ============================================ */

.btn-action {
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

.btn-action:active {
    transform: scale(0.9);
}

.btn-buy {
    background: linear-gradient(135deg, #34c759, #28a745);
    color: white;
}

.btn-delete {
    background: rgba(220, 38, 38, 0.2);
    color: #ef4444;
    font-size: 16px;
    padding: 4px 8px;
}

.btn-sold-tag {
    background: rgba(160, 80, 255, 0.1);
    color: #6d28d9;
    cursor: default;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
}

/* ============================================ */
/* 10. ПУСТЫЕ СООБЩЕНИЯ                        */
/* ============================================ */

.empty-message {
    text-align: center;
    padding: 25px 0;
}

.empty-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.empty-message p {
    color: #6d28d9;
    font-size: 15px;
}

.empty-hint {
    font-size: 12px !important;
    color: #4b1d8a !important;
    margin-top: 4px;
}

/* ============================================ */
/* 11. ВЫСТАВКА                                 */
/* ============================================ */

.add-product-box {
    background: rgba(20, 10, 50, 0.5);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(160, 80, 255, 0.1);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-form input,
.add-form textarea {
    padding: 10px 14px;
    border: 1px solid rgba(160, 80, 255, 0.2);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(20, 10, 40, 0.6);
    color: #ffffff;
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.add-form input:focus,
.add-form textarea:focus {
    border-color: #a855f7;
}

.add-form input[type="number"] {
    -moz-appearance: textfield;
}

.add-form input[type="number"]::-webkit-inner-spin-button,
.add-form input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* ============================================ */
/* 12. КНОПКИ ОБЩИЕ                            */
/* ============================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 100px;
    user-select: none;
}

.btn:active {
    transform: scale(0.93);
}

.btn-purple {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}

.btn-purple:hover {
    box-shadow: 0 4px 30px rgba(124, 58, 237, 0.5);
}

.btn-neon {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #ffffff;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.2);
    animation: neon-pulse 3s ease-in-out infinite;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.2);
}

.btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* ============================================ */
/* 13. ИНФО И ПОДВАЛ                           */
/* ============================================ */

.info {
    background: rgba(20, 10, 50, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(160, 80, 255, 0.1);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    color: #a78bfa;
    margin-top: 8px;
}

.info span {
    color: #e9d5ff;
    font-weight: 600;
}

.footer {
    margin-top: 20px;
    padding: 12px;
    font-size: 11px;
    color: #4b1d8a;
    border-top: 1px solid rgba(160, 80, 255, 0.06);
    text-align: center;
}

/* ============================================ */
/* 14. АНИМАЦИИ                                */
/* ============================================ */

@keyframes neon-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.2); }
    50% { box-shadow: 0 0 40px rgba(168, 85, 247, 0.4); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.money-rain {
    position: fixed;
    font-size: 28px;
    pointer-events: none;
    z-index: 9999;
    animation: moneyRain 0.8s ease forwards;
}

@keyframes moneyRain {
    0% { opacity: 1; transform: translateY(-20px) scale(0.5); }
    50% { opacity: 1; transform: translateY(5px) scale(1.1); }
    100% { opacity: 0; transform: translateY(20px) scale(1); }
}

/* ============================================ */
/* 15. СДЕЛКИ                                   */
/* ============================================ */

.deal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(80, 30, 160, 0.1);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(160, 80, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s;
}

.deal-item:active {
    transform: scale(0.98);
}

.deal-item .deal-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.deal-item .deal-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.deal-item .deal-name {
    font-size: 14px;
    color: #e9d5ff;
    font-weight: 500;
}

.deal-item .deal-meta {
    font-size: 11px;
    color: #6d28d9;
    margin-top: 2px;
}

.deal-status {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.deal-status.escrow { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.deal-status.released { background: rgba(52, 199, 89, 0.2); color: #34c759; }
.deal-status.disputed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.deal-status.refunded { background: rgba(160, 80, 255, 0.2); color: #a78bfa; }

.deal-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.deal-actions .btn-action-deal {
    padding: 4px 8px;
    font-size: 10px;
}

/* ============================================ */
/* 16. ЧАТ                                     */
/* ============================================ */

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(80, 30, 160, 0.1);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(160, 80, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s;
}

.chat-item:active { transform: scale(0.98); }

.chat-item .chat-icon { font-size: 22px; flex-shrink: 0; }
.chat-item .chat-avatar-img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-item .chat-info { flex: 1; text-align: left; min-width: 0; }
.chat-item .chat-name { font-size: 14px; color: #e9d5ff; font-weight: 600; }
.chat-item .chat-sub { font-size: 11px; color: #a78bfa; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .chat-preview { font-size: 11px; color: #6d28d9; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-unread {
    background: #7c3aed;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.chat-container {
    background: rgba(20, 10, 50, 0.5);
    border: 1px solid rgba(160, 80, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 70vh;
    min-height: 400px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(20, 10, 50, 0.7);
    border-bottom: 1px solid rgba(160, 80, 255, 0.1);
}

.btn-back {
    background: none;
    border: none;
    color: #a78bfa;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.btn-back:active { background: rgba(160, 80, 255, 0.1); }

.chat-header-info { flex: 1; text-align: left; }
.chat-header-title { font-size: 14px; color: #e9d5ff; font-weight: 600; }
.chat-header-deal { font-size: 11px; color: #6d28d9; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-msg.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg.theirs {
    align-self: flex-start;
    background: rgba(80, 30, 160, 0.2);
    color: #e9d5ff;
    border-bottom-left-radius: 4px;
}

.chat-msg .msg-time {
    font-size: 9px;
    opacity: 0.6;
    margin-top: 3px;
    text-align: right;
}

.chat-actions {
    padding: 10px 12px;
    border-top: 1px solid rgba(160, 80, 255, 0.1);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chat-actions .btn-action-deal {
    flex: 1;
    min-width: 90px;
    padding: 10px 8px;
    border: none;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action-deal:active { transform: scale(0.93); }

.btn-confirm { background: linear-gradient(135deg, #34c759, #28a745); color: white; }
.btn-dispute { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.btn-refund { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.btn-ban { background: linear-gradient(135deg, #111827, #000000); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); }

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(20, 10, 50, 0.7);
    border-top: 1px solid rgba(160, 80, 255, 0.1);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(160, 80, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
    background: rgba(20, 10, 40, 0.6);
    color: #ffffff;
    outline: none;
}

.chat-input-area input:focus { border-color: #a855f7; }

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: white;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:active { transform: scale(0.9); }

/* ============================================ */
/* 17. СПОРЫ АДМИН                              */
/* ============================================ */

.dispute-item {
    padding: 14px;
    background: rgba(80, 30, 160, 0.1);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.dispute-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dispute-title { font-size: 14px; color: #e9d5ff; font-weight: 600; }
.dispute-amount { font-size: 13px; color: #fbbf24; font-weight: 600; }

.dispute-parties {
    font-size: 11px;
    color: #6d28d9;
    margin-bottom: 10px;
}

.dispute-chat-preview {
    background: rgba(20, 10, 40, 0.4);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 11px;
    color: #a78bfa;
}

.dispute-chat-details {
    margin-bottom: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: rgba(20, 10, 40, 0.35);
    overflow: hidden;
}

.dispute-chat-details summary {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-title);
    user-select: none;
    list-style: none;
}

.dispute-chat-details summary::-webkit-details-marker { display: none; }

.dispute-chat-full {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dispute-chat-msg {
    max-width: 85%;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
    word-break: break-word;
}

.dispute-chat-msg.buyer {
    align-self: flex-start;
    background: rgba(37, 99, 235, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.dispute-chat-msg.seller {
    align-self: flex-end;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.35);
}

.dispute-chat-msg .dcm-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
    font-size: 10px;
    color: var(--text-dim);
}

.dispute-chat-msg .dcm-time {
    color: var(--text-faint);
    white-space: nowrap;
}

.dispute-chat-msg .dcm-text {
    color: var(--fg);
    white-space: pre-wrap;
}

.dispute-chat-full .dcm-empty {
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    padding: 8px;
}

.dispute-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dispute-actions .btn-action-deal {
    min-width: 80px;
}

/* ============================================ */
/* 18. АДАПТАЦИЯ                                */
/* ============================================ */

@media (max-width: 480px) {
    .balances-grid {
        grid-template-columns: 1fr 1fr;
    }
    .operations-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .btn {
        padding: 8px 14px;
        font-size: 13px;
        min-width: 70px;
    }
    .tab-btn {
        font-size: 10px;
        padding: 8px 2px;
        min-width: 45px;
    }
    .nav-btn {
        font-size: 16px;
        padding: 5px 1px;
    }
    .nav-btn span {
        font-size: 8px;
    }
    .product-item {
        flex-wrap: wrap;
        padding: 8px 10px;
    }
    .product-item .product-actions {
        width: 100%;
        justify-content: flex-end;
    }
    #authPanel .btn {
        font-size: 16px;
        padding: 12px;
    }
}

/* ============================================ */
/* 19. ТЕМЫ: ТЁМНАЯ / СВЕТЛАЯ                 */
/* ============================================ */

body {
    --bg: linear-gradient(145deg, #0a0618 0%, #1a0b2e 30%, #0d1b2a 70%, #000000 100%);
    --fg: #ffffff;
    --card-bg: rgba(20, 10, 50, 0.5);
    --card-bg-strong: rgba(20, 10, 50, 0.6);
    --card-bg-input: rgba(20, 10, 40, 0.6);
    --border-soft: rgba(160, 80, 255, 0.1);
    --border-mid: rgba(160, 80, 255, 0.2);
    --item-bg: rgba(80, 30, 160, 0.1);
    --text-title: #e9d5ff;
    --text-sub: #a78bfa;
    --text-dim: #6d28d9;
    --text-faint: #4b1d8a;
    --text-mine: #ffffff;
}

body.theme-light {
    --bg: linear-gradient(145deg, #f3eeff 0%, #e9ddff 30%, #f4f0ff 70%, #ffffff 100%);
    --fg: #1a1030;
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-bg-strong: rgba(255, 255, 255, 0.8);
    --card-bg-input: rgba(255, 255, 255, 0.9);
    --border-soft: rgba(124, 58, 237, 0.18);
    --border-mid: rgba(124, 58, 237, 0.3);
    --item-bg: rgba(124, 58, 237, 0.08);
    --text-title: #4c1d95;
    --text-sub: #7c3aed;
    --text-dim: #8b5cf6;
    --text-faint: #a78bfa;
    --text-mine: #ffffff;
}

body.theme-light .header,
body.theme-light #authPanel,
body.theme-light .balance-card,
body.theme-light .operations-box,
body.theme-light .deposit-box,
body.theme-light .products-section,
body.theme-light .add-product-box,
body.theme-light .info {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-color: var(--border-soft);
}

body.theme-light .tabs {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border-soft);
}

body.theme-light .bottom-nav {
    background: rgba(255, 255, 255, 0.96);
    border-top-color: var(--border-mid);
}

body.theme-light .operation-custom input,
body.theme-light .add-form input,
body.theme-light .add-form textarea,
body.theme-light .chat-input-area input {
    background: var(--card-bg-input);
    color: var(--fg);
    border-color: var(--border-mid);
}

body.theme-light .product-item,
body.theme-light .deal-item,
body.theme-light .chat-item,
body.theme-light .dispute-item {
    background: var(--item-bg);
    border-color: var(--border-soft);
}

body.theme-light .chat-container,
body.theme-light .chat-header,
body.theme-light .chat-input-area {
    background: var(--card-bg-strong);
    border-color: var(--border-soft);
}

body.theme-light .user-status {
    color: #059669;
}

body.theme-light .chat-msg.theirs {
    background: rgba(124, 58, 237, 0.12);
    color: var(--text-title);
}

body.theme-light .chat-msg.mine {
    color: var(--text-mine);
}

body.theme-light .btn-sold-tag {
    color: var(--text-sub);
    background: rgba(124, 58, 237, 0.12);
}

body.theme-light .footer {
    color: var(--text-faint);
}

body.theme-light .theme-toggle {
    background: rgba(255, 255, 255, 0.8);
    color: #4c1d95;
    border-color: var(--border-mid);
}

body.theme-light .empty-message p {
    color: var(--text-dim);
}

body.theme-light .empty-hint {
    color: var(--text-faint) !important;
}

body.theme-light .user-info-header h1 {
    color: #7c3aed;
}

body.theme-light .user-name,
body.theme-light .operations-title,
body.theme-light .deposit-title,
body.theme-light .section-title,
body.theme-light .product-item .product-name,
body.theme-light .deal-item .deal-name,
body.theme-light .chat-item .chat-name,
body.theme-light .chat-header-title,
body.theme-light .dispute-title,
body.theme-light .info span {
    color: var(--text-title);
}

body.theme-light .product-item .product-price {
    color: #b45309;
}

body.theme-light .deal-status.escrow { color: #b45309; background: rgba(180, 83, 9, 0.12); }
body.theme-light .deal-status.refunded { color: #7c3aed; background: rgba(124, 58, 237, 0.12); }

body.theme-light .product-count {
    color: var(--text-sub);
    background: rgba(124, 58, 237, 0.12);
}

body.theme-light .payment-section {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border-soft);
}

body.theme-light .withdraw-hint {
    color: #6d28d9;
}

/* ============================================ */
/* 20. НОВЫЕ ФИЧИ: УВЕДОМЛЕНИЯ, АУКЦИОНЫ, ПРОФИЛЬ, АДМИН */
/* ============================================ */

.notif-bell {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(160, 80, 255, 0.3);
    border-radius: 12px;
    background: rgba(20, 10, 50, 0.6);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.notif-bell:active { transform: scale(0.9); }

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

#notifPanel {
    margin-bottom: 16px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--item-bg, rgba(80, 30, 160, 0.1));
    border: 1px solid var(--border-soft, rgba(160, 80, 255, 0.1));
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    text-align: left;
}

.notif-item.unread { border-left: 3px solid #7c3aed; }

.notif-text { font-size: 13px; line-height: 1.5; color: var(--text-title, #e9d5ff); flex: 1; }
.notif-time { font-size: 11px; color: var(--text-faint, #4b1d8a); }

.shop-filters, .promo-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.shop-filters input, .shop-filters select, .promo-row input {
    flex: 1;
    min-width: 120px;
    background: var(--card-bg-input, rgba(20, 10, 40, 0.6));
    border: 1px solid var(--border-mid, rgba(160, 80, 255, 0.2));
    color: var(--fg, #ffffff);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.shop-filters select option {
    background: #1a0b2e;
    color: #ffffff;
}

.promo-row .btn { flex-shrink: 0; padding: 10px 16px; }

.promo-status { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.promo-status.ok { color: #34c759; }
.promo-status.err { color: #ef4444; }

.top-products {
    overflow-x: auto;
}

.top-products-row {
    display: flex;
    gap: 10px;
}

.top-product-chip {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(190, 24, 93, 0.2));
    border: 1px solid var(--border-mid, rgba(160, 80, 255, 0.3));
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    text-align: left;
    color: var(--fg, #ffffff);
}

.top-product-chip:hover { border-color: #7c3aed; }

.top-product-chip .tpc-name { font-size: 12px; font-weight: 700; color: var(--text-title, #e9d5ff); }
.top-product-chip .tpc-price { font-size: 12px; color: var(--text-sub, #a78bfa); }
.top-product-chip .tpc-views { font-size: 10px; color: var(--text-faint, #4b1d8a); }

.deals-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.deal-filter.tab-btn {
    font-size: 12px;
    padding: 8px 12px;
}

.withdraw-source {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.withdraw-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-sub, #a78bfa);
    cursor: pointer;
}

.withdraw-radio input { accent-color: #7c3aed; }

.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg, rgba(20, 10, 50, 0.5));
    border: 1px solid var(--border-soft, rgba(160, 80, 255, 0.1));
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    flex-shrink: 0;
}

.profile-info { flex: 1; text-align: left; }
.profile-name { font-size: 16px; font-weight: 800; color: var(--text-title, #e9d5ff); }
.profile-username { font-size: 12px; color: var(--text-sub, #a78bfa); }
.profile-id { font-size: 11px; color: var(--text-faint, #4b1d8a); }
.profile-role {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
}

.profile-rating { margin-bottom: 12px; }

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 10px;
}

.rating-stars { color: #fbbf24; letter-spacing: 2px; font-size: 14px; }

.review-item {
    background: var(--item-bg, rgba(80, 30, 160, 0.1));
    border: 1px solid var(--border-soft, rgba(160, 80, 255, 0.1));
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 8px;
    text-align: left;
}

.review-item .rev-author { font-size: 12px; font-weight: 700; color: var(--text-title, #e9d5ff); }
.review-item .rev-stars { color: #fbbf24; font-size: 12px; }
.review-item .rev-text { font-size: 13px; color: var(--text-sub, #a78bfa); margin-top: 4px; }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.dash-card {
    background: var(--item-bg, rgba(80, 30, 160, 0.1));
    border: 1px solid var(--border-soft, rgba(160, 80, 255, 0.1));
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}

.dash-card .dc-value { font-size: 16px; font-weight: 800; color: var(--text-title, #e9d5ff); }
.dash-card .dc-label { font-size: 11px; color: var(--text-faint, #4b1d8a); }

.referral-box {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(190, 24, 93, 0.15));
    border: 1px solid var(--border-mid, rgba(160, 80, 255, 0.3));
    border-radius: 14px;
    padding: 14px;
    margin-top: 12px;
    text-align: left;
}

.referral-box .ref-code {
    font-size: 16px;
    font-weight: 800;
    color: #fbbf24;
    letter-spacing: 2px;
    user-select: all;
}

.referral-box .ref-link {
    font-size: 12px;
    color: var(--text-sub, #a78bfa);
    word-break: break-all;
    margin-top: 4px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.admin-stat-card {
    background: var(--item-bg, rgba(80, 30, 160, 0.1));
    border: 1px solid var(--border-soft, rgba(160, 80, 255, 0.1));
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.admin-stat-card .as-value { font-size: 17px; font-weight: 800; color: var(--text-title, #e9d5ff); }
.admin-stat-card .as-label { font-size: 11px; color: var(--text-faint, #4b1d8a); margin-top: 2px; }

.admin-card {
    background: var(--card-bg, rgba(20, 10, 50, 0.5));
    border: 1px solid var(--border-soft, rgba(160, 80, 255, 0.1));
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    text-align: left;
}

.admin-card .ac-title { font-size: 13px; font-weight: 700; color: var(--text-title, #e9d5ff); }
.admin-card .ac-line { font-size: 12px; color: var(--text-sub, #a78bfa); margin-top: 3px; }

.balance-card-alt {
    font-size: 10px;
    color: var(--text-faint, #4b1d8a);
    display: block;
    margin-top: 2px;
}

body.theme-light .notif-bell { background: rgba(255,255,255,0.8); color: #4c1d95; border-color: var(--border-mid); }
body.theme-light .shop-filters select option { background: #ffffff; color: #2a1652; }

/* fav toggle button in shop */
.btn-fav {
    border: 1px solid rgba(236, 72, 153, 0.3);
    background: rgba(236, 72, 153, 0.1);
    color: #f472b6;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-fav.faved { background: rgba(236, 72, 153, 0.2); color: #ec4899; }

.lot-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    margin-right: 6px;
}

.new-row-separator { margin-top: 8px; }