:root {
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-tertiary: #666666;
    --accent: #ffffff;
    --border: #333333;
    --success: #00ff9d;
    --hover: #222222;
    --filter-bg: #222222;
    --filter-active: #00ff9d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 12px;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
.header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.user-info h1 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.user-id {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--hover);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.stat-value.ton {
    color: var(--success);
    font-size: 16px;
}

.stat-value.usd {
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

/* Refresh Button */
.refresh-btn {
    width: 100%;
    padding: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.refresh-btn:hover {
    background: var(--hover);
    border-color: var(--accent);
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border);
}

/* Filters */
.filters-section {
    margin-bottom: 20px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-tab {
    background: var(--filter-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-tab:hover {
    background: var(--hover);
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--filter-active);
    color: var(--bg-primary);
    border-color: var(--filter-active);
}

.filter-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    background: var(--filter-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    min-width: 120px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--filter-active);
}

.filter-search {
    background: var(--filter-bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    flex-grow: 1;
    min-width: 150px;
}

.filter-search:focus {
    outline: none;
    border-color: var(--filter-active);
}

.active-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.active-filter {
    background: var(--filter-active);
    color: var(--bg-primary);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.clear-filters {
    background: transparent;
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-filters:hover {
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}

/* Inventory Title */
.inventory-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.title-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.item-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.item-card:hover {
    background: var(--hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.item-image {
    width: 100%;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 10px;
    background: var(--bg-primary);
    padding: 8px;
}

.item-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-primary);
    line-height: 1.3;
    height: 32px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-type {
    font-size: 9px;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-price {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.price-ton {
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 2px;
}

.price-usd {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Type badges */
.type-badge {
    display: inline-block;
    background: var(--bg-primary);
    color: var(--text-tertiary);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    margin: 1px;
    border: 1px solid var(--border);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Error State */
.error-message {
    text-align: center;
    padding: 40px 20px;
}

.error-title {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.error-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 14px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-options {
        flex-direction: column;
    }
    
    .filter-select, .filter-search {
        width: 100%;
    }
    
    .container {
        padding: 0 6px;
    }
    
    body {
        padding: 10px;
    }
}

@media (max-width: 400px) {
    .items-grid {
        grid-template-columns: 1fr;
    }
    
    .user-section {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .avatar, .avatar-placeholder {
        width: 56px;
        height: 56px;
        font-size: 18px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}