* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
    --bg: #08060f;
    --neon-purple: #a855f7;
    --neon-cyan: #06b6d4;
    --neon-pink: #ec4899;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-strong-bg: rgba(20, 15, 35, 0.92);
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.55);
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}
body { padding-bottom: 90px; position: relative; min-height: 100vh; }

.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55; animation: float 20s ease-in-out infinite; }
.orb-1 { width: 350px; height: 350px; background: radial-gradient(circle, var(--neon-purple), transparent 70%); top: -100px; left: -100px; }
.orb-2 { width: 300px; height: 300px; background: radial-gradient(circle, var(--neon-cyan), transparent 70%); bottom: 100px; right: -80px; animation-delay: -7s; }
.orb-3 { width: 280px; height: 280px; background: radial-gradient(circle, var(--neon-pink), transparent 70%); top: 40%; left: 30%; animation-delay: -14s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.1); }
    66% { transform: translate(-30px, 40px) scale(0.95); }
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.glass-strong {
    background: var(--glass-strong-bg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.gradient-text {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan), var(--neon-pink));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 6s ease infinite;
    font-weight: 700;
    letter-spacing: -0.02em;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

#app { position: relative; z-index: 1; }
.page { display: none; padding: 0 16px; }
.page.active { display: block; animation: fadeIn .35s ease; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.topbar { padding: 16px 0 12px; }
.page-header { padding: 24px 0 16px; }
.page-header h1 { font-size: 28px; }

.search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 18px; }
.search-icon { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 16px; }
.search input::placeholder { color: var(--muted); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
    padding: 9px 18px; border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text); font-size: 13px; font-weight: 500;
    white-space: nowrap; cursor: pointer; transition: all .25s ease;
}
.filter:active { transform: scale(0.95); }
.filter.active {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    border-color: transparent;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6), 0 0 40px rgba(6, 182, 212, 0.3);
    color: #fff;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px; overflow: hidden;
    cursor: pointer; transition: transform .25s ease, box-shadow .25s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.card:active { transform: scale(0.97); }
.card .photo { width: 100%; height: 150px; object-fit: cover; display: block; background: #1a1228; }
.card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.badge {
    display: inline-block; font-size: 10px; font-weight: 600;
    padding: 3px 8px; border-radius: 8px; width: fit-content;
    letter-spacing: 0.3px; text-transform: uppercase;
    background: rgba(168, 85, 247, 0.2); color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.badge.buy { background: rgba(6, 182, 212, 0.2); color: #67e8f9; border-color: rgba(6, 182, 212, 0.3); }
.badge.exchange { background: rgba(236, 72, 153, 0.2); color: #f9a8d4; border-color: rgba(236, 72, 153, 0.3); }
.badge.status-pending { background: rgba(234, 179, 8, 0.2); color: #fde047; border-color: rgba(234, 179, 8, 0.3); }
.badge.status-rejected { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.badge.status-needs_edit { background: rgba(249, 115, 22, 0.2); color: #fdba74; border-color: rgba(249, 115, 22, 0.3); }
.badge.status-archived { background: rgba(100, 116, 139, 0.3); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.4); }

.card .title { font-size: 13px; font-weight: 600; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.card .price {
    font-size: 13px; font-weight: 700;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.card .reason { font-size: 11px; color: #fca5a5; margin-top: 4px; line-height: 1.3; }
.card.archived { opacity: 0.65; }
.card.archived .photo { filter: grayscale(0.6); }

.card .fav-btn {
    position: absolute; top: 8px; right: 8px;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(10, 8, 20, 0.6);
    border: 1px solid var(--glass-border);
    color: #fff; display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 2; transition: all .2s ease;
}
.card .fav-btn svg { width: 16px; height: 16px; }
.card .fav-btn.active {
    color: var(--neon-pink);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.7);
    border-color: rgba(236, 72, 153, 0.5);
}
.card .fav-btn:active { transform: scale(0.85); }

.chats-list { display: flex; flex-direction: column; gap: 10px; }
.chat-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    cursor: pointer; transition: all .2s ease;
}
.chat-item:active { transform: scale(0.98); }
.chat-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px; flex-shrink: 0;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}
.chat-body { flex: 1; min-width: 0; }
.chat-name { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.chat-last { font-size: 12px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-listing-tag {
    font-size: 10px; padding: 2px 6px; border-radius: 6px;
    background: rgba(168, 85, 247, 0.2); color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
    margin-top: 3px; display: inline-block;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.profile-card {
    display: flex; align-items: center; gap: 16px;
    padding: 20px; border-radius: 24px; margin-bottom: 16px;
}
.avatar {
    width: 68px; height: 68px; border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan), var(--neon-pink));
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700;
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.6), 0 0 50px rgba(6, 182, 212, 0.3);
}
.profile-info h2 { font-size: 20px; margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 13px; }
.tiny { color: var(--muted); font-size: 11px; margin-top: 2px; }

.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat { padding: 16px; border-radius: 20px; text-align: center; }
.stat-value {
    font-size: 28px; font-weight: 700;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.profile-tabs {
    display: flex; gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px; padding: 4px;
    border: 1px solid var(--glass-border);
    margin-bottom: 16px;
}
.profile-tab {
    flex: 1; padding: 10px;
    background: none; border: none;
    border-radius: 10px;
    color: var(--muted); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .2s ease;
}
.profile-tab.active {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    color: #fff;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

.section-title { font-size: 16px; font-weight: 600; margin: 20px 0 12px; color: var(--text); }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; justify-content: space-around; align-items: center;
    padding: 10px 0 max(12px, env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; z-index: 50;
}
.nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: var(--muted);
    font-size: 10px; cursor: pointer; transition: all .25s ease; padding: 4px 8px;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--neon-purple); filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.8)); }
.nav-add {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    color: #fff !important; font-size: 26px; font-weight: 300;
    justify-content: center; margin-top: -22px;
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.7), 0 0 50px rgba(6, 182, 212, 0.4);
    filter: none !important;
}
.nav-add:active { transform: scale(0.9); }

.modal {
    position: fixed; inset: 0;
    background: rgba(5, 3, 10, 0.8);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 100; animation: fadeIn .25s ease;
    pointer-events: auto;
}
.modal.hidden { display: none; }
.modal-content {
    width: 100%; max-width: 520px;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
    display: flex; flex-direction: column; gap: 12px;
    max-height: 92vh; overflow-y: auto;
    background: #14101f;
    border: 1px solid var(--glass-border);
    animation: slideUp .35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.input {
    padding: 14px 16px; border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text); font-size: 16px; font-family: inherit;
    outline: none; transition: border-color .2s ease;
    pointer-events: auto;
}
.input:focus { border-color: var(--neon-purple); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15); }
.input::placeholder { color: var(--muted); }
textarea.input { min-height: 90px; resize: vertical; }
.input.hidden { display: none; }

.segmented {
    display: flex; gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px; padding: 4px;
    border: 1px solid var(--glass-border);
}
.seg {
    flex: 1; padding: 10px; background: none; border: none;
    border-radius: 10px; color: var(--muted);
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all .2s ease;
}
.seg.active {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    color: #fff; box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

.file-input {
    padding: 14px; border-radius: 14px;
    border: 1px dashed var(--glass-border);
    text-align: center; color: var(--muted); font-size: 14px;
    cursor: pointer; transition: all .2s ease;
}
.file-input:active { border-color: var(--neon-purple); }
.file-input input { display: none; }

.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

.btn-glass {
    flex: 1; padding: 14px; border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all .2s ease;
}
.btn-glass:active { transform: scale(0.97); }
.btn-glass.small { padding: 8px 14px; font-size: 13px; flex: none; }
.btn-glass.danger { margin-top: 20px; color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }

.btn-neon {
    flex: 1; padding: 14px; border-radius: 14px; border: none;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    color: #fff; font-size: 15px; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.6), 0 0 40px rgba(6, 182, 212, 0.3);
    transition: all .2s ease;
}
.btn-neon:active { transform: scale(0.97); }
.btn-neon.small { padding: 10px 16px; font-size: 14px; flex: none; }

/* Причины архивации */
.reason-btn {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: all .2s ease;
    width: 100%;
}
.reason-btn:active {
    transform: scale(0.98);
    background: rgba(168, 85, 247, 0.15);
    border-color: var(--neon-purple);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}
.reason-btn.selected {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(6, 182, 212, 0.15));
    border-color: var(--neon-purple);
}
#archive-reasons { display: flex; flex-direction: column; gap: 8px; }

.chat-modal-content { height: 92vh; display: flex; flex-direction: column; }
.chat-header {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 12px; border-bottom: 1px solid var(--glass-border);
}
.chat-header span { font-size: 17px; font-weight: 600; }

.deal-bar {
    padding: 10px 12px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; flex-wrap: wrap;
    font-size: 13px;
    margin-top: 8px;
}
.deal-bar.hidden { display: none; }
.deal-bar .deal-text { flex: 1; min-width: 100px; }
.deal-bar .deal-status-ok { color: #86efac; font-weight: 600; }
.deal-bar .deal-status-bad { color: #fca5a5; font-weight: 600; }
.deal-bar .deal-status-pending { color: #fde047; font-weight: 600; }
.deal-bar button {
    padding: 8px 12px; border-radius: 10px; border: none;
    font-size: 12px; font-weight: 600; cursor: pointer;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    color: #fff;
}
.deal-bar button.decline {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.chat-messages {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px 0;
}
.chat-msg {
    max-width: 78%; padding: 10px 14px;
    border-radius: 18px; font-size: 14px; line-height: 1.35;
    word-wrap: break-word;
}
.chat-msg.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    color: #fff; border-bottom-right-radius: 6px;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}
.chat-msg.their {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 6px;
}
.chat-msg .time { display: block; font-size: 10px; opacity: 0.6; margin-top: 3px; }

.chat-input-row {
    display: flex; gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}
.chat-input-row .input { flex: 1; }

.empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted); font-size: 14px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }

.user-header {
    display: flex; align-items: center; gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}
.user-rating {
    display: flex; align-items: center; gap: 6px;
    margin-top: 6px; font-size: 13px;
}
.user-rating .star { color: #fbbf24; font-size: 16px; }
.user-rating .value { font-weight: 700; font-size: 15px; }
.user-rating .count { color: var(--muted); font-size: 12px; }

.reviews-list { display: flex; flex-direction: column; gap: 10px; }
.review-item {
    padding: 12px 14px; border-radius: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.review-author { font-weight: 600; font-size: 13px; }
.review-stars { color: #fbbf24; font-size: 13px; letter-spacing: 1px; }
.review-text { font-size: 13px; line-height: 1.4; opacity: .85; }
.review-date { font-size: 11px; color: var(--muted); margin-top: 6px; }

.stars { display: flex; justify-content: center; gap: 8px; font-size: 36px; padding: 12px 0; }
.stars span { cursor: pointer; color: rgba(255, 255, 255, 0.2); transition: color .15s ease, transform .15s ease; }
.stars span.active { color: #fbbf24; text-shadow: 0 0 12px rgba(251, 191, 36, 0.7); }
.stars span:active { transform: scale(1.2); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.3); border-radius: 2px; }