/* Cabinet */
.cabinet-wrap { max-width: 980px; margin: 0 auto; padding: 20px; }

.cabinet-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cabinet-tab {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.cabinet-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.cabinet-tab:hover:not(.active) {
    background: var(--surface-3);
    color: var(--text);
}

.billing-status {
    font-size: 15px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.billing-status.vip-active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.billing-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.billing-product {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.billing-product .price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.billing-payments table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.billing-payments th,
.billing-payments td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
}

.billing-payments .status-succeeded { color: #66bb6a; }
.billing-payments .status-pending { color: var(--warn); }
.billing-payments .status-failed,
.billing-payments .status-canceled { color: #ef5350; }

.user-search-wrap { position: relative; flex-wrap: wrap; }

.user-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    margin-top: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 180px;
    overflow-y: auto;
}

.user-search-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}

.user-search-item:hover { background: var(--primary-soft); }

.reg-consent {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.reg-consent a {
    color: var(--primary);
}

.privacy-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin: 10px 0 4px;
    cursor: pointer;
}

.privacy-toggle a {
    color: var(--primary);
}

.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }

.auth-tab {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.auth-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.user-bar-main {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-upload-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.user-avatar.has-img {
    border-color: var(--primary);
}

.avatar-change-btn {
    font-size: 11px;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--surface-3);
}

.friend-avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.social-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.social-tab {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
}

.social-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.friend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    background: var(--surface-3);
    transition: border-color 0.2s, background 0.2s;
}

.friend-row.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.friend-meta { flex: 1; min-width: 0; }
.friend-name { font-weight: 600; font-size: 14px; }
.friend-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-preview.typing-preview {
    color: var(--primary);
    font-style: italic;
}

.st-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.st-online { background: #4caf50; }
.st-ready { background: #2196f3; }
.st-watching { background: #9c27b0; }
.st-busy { background: #f44336; }
.st-away { background: #ff9800; }
.st-offline { background: #777; }

.friend-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}

.friend-menu-wrap { position: relative; }

.friend-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 168px;
    z-index: 40;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.friend-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}

.friend-menu button:hover { background: var(--primary-soft); }

.friend-menu button.danger { color: #ff8a80; }

.badge-unread {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    margin-left: 4px;
}

.social-layout {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr);
    gap: 16px;
}

@media (max-width: 800px) {
    .social-layout { grid-template-columns: 1fr; }
}

.dm-panel {
    display: flex;
    flex-direction: column;
    min-height: 360px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-3);
    overflow: hidden;
}

.dm-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}

.dm-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 380px;
    min-height: 220px;
}

.dm-input-row {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border);
}

.dm-input-row input { flex: 1; }

.dm-typing {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 12px 6px;
    min-height: 16px;
}

.dm-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px;
    text-align: center;
}

.invite-room-row {
    display: flex;
    gap: 8px;
    padding: 0 10px 8px;
    flex-wrap: wrap;
}

.invite-room-row input { flex: 1; min-width: 100px; }

.request-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.request-row:last-child { border-bottom: none; }

.support-msgs {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    padding: 4px;
}

.msg {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    max-width: 92%;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.45;
}

.msg-user {
    align-self: flex-end;
    background: var(--primary-soft);
    border-bottom-right-radius: 4px;
}

.msg-admin {
    align-self: flex-start;
    background: rgba(76, 175, 80, 0.2);
    border-bottom-left-radius: 4px;
}

.msg-system {
    align-self: center;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
}

.msg-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

.msg-files { margin-top: 6px; }
.msg-files a { color: var(--primary); font-size: 13px; display: block; }

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.add-friend-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.add-friend-row input { flex: 1; min-width: 140px; }

/* Cabinet mobile */
@media (max-width: 480px) {
    .cabinet-wrap { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    .friend-row { padding: 12px; min-height: 48px; }
    .friend-actions button, .dm-input-row button, .add-friend-row button { min-height: 44px; min-width: 44px; }
    .dm-msgs { max-height: 50vh; min-height: 180px; }
    .cabinet-tab, .social-tab { min-height: 44px; }
}
