.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 2px 0;
}

.category-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 3 / 2;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
    background: var(--sec-bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-card:active {
    transform: scale(0.96);
    opacity: 0.8;
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.category-card .cat-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.category-card .cat-emoji {
    font-size: 24px;
    position: absolute;
    top: 8px;
    left: 8px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.category-card .cat-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
}

.category-card .cat-fallback .fallback-emoji {
    font-size: 28px;
    margin-bottom: 4px;
}

.category-card .cat-fallback .fallback-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px 0;
}

.product-card {
    display: flex;
    gap: 10px;
    background: var(--sec-bg-color);
    border-radius: 12px;
    padding: 10px;
    align-items: center;
    transition: transform 0.12s ease;
}

.product-card:active {
    transform: scale(0.98);
}

.product-card img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
    line-height: 1.25;
}

.product-desc {
    font-size: 11px;
    color: var(--hint-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-color);
}

.product-old-price {
    font-size: 11px;
    color: var(--hint-color);
    text-decoration: line-through;
    margin-left: 4px;
}

.buy-btn {
    background: transparent;
    color: var(--btn-color);
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 2px;
    white-space: nowrap;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 2px 0;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: flex-end;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal.active .modal-overlay {
    opacity: 1;
}

.modal-sheet {
    position: relative;
    background: var(--sec-bg-color);
    border-radius: 20px 20px 0 0;
    padding: 12px 16px 24px;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}

.modal.active .modal-sheet {
    transform: translateY(0);
}

.modal-handle {
    width: 32px;
    height: 4px;
    background: var(--hint-color);
    border-radius: 2px;
    margin: 0 auto 12px;
    opacity: 0.4;
}

.modal-img {
    width: 100%;
    height: 140px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 10px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.2;
}

.modal-desc {
    font-size: 13px;
    color: var(--hint-color);
    line-height: 1.4;
    margin-bottom: 14px;
}

.dynamic-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.dynamic-field label {
    font-size: 12px;
    color: var(--hint-color);
    margin-bottom: 3px;
    display: block;
}

.dynamic-field input,
.dynamic-field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.qty-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-color);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    background: var(--sec-bg-color);
    border: none;
    border-radius: 8px;
    color: var(--btn-color);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.qty-btn:active {
    transform: scale(0.92);
}

.qty-val {
    font-size: 16px;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
}

.total-row .label {
    color: var(--hint-color);
}

.total-row .value {
    font-weight: 600;
}

.total-row.total-final {
    font-size: 16px;
    font-weight: 700;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(128,128,128,0.15);
}

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(44,44,46,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(128,128,128,0.1);
    z-index: 500;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--hint-color);
    font-size: 9px;
    gap: 2px;
    cursor: pointer;
    padding: 4px 12px;
    transition: color 0.12s;
    user-select: none;
}

.tab-item.active {
    color: var(--btn-color);
}

.tab-item i {
    font-size: 18px;
}

.profile-card {
    padding: 4px 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--btn-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.profile-info h2 {
    margin: 0 0 3px;
    font-size: 16px;
    font-weight: 700;
}

.profile-info p {
    margin: 0;
    color: var(--hint-color);
    font-size: 12px;
}

.profile-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.stat-box {
    flex: 1;
    background: var(--sec-bg-color);
    padding: 10px;
    border-radius: 12px;
    text-align: center;
}

.stat-val {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 11px;
    color: var(--hint-color);
}

.profile-menu {
    background: var(--sec-bg-color);
    border-radius: 12px;
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(128,128,128,0.08);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s;
}

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

.menu-item:active {
    background: rgba(128,128,128,0.08);
}

.text-blue {
    color: var(--btn-color);
}
