.modal-container#category-order-modal {
    max-width: 640px !important;
    width: 94% !important;
    min-width: 320px;
}

.category-order-modal-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-order-modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    text-align: center;
}

.category-order-modal-help {
    margin: 0;
    color: #94a3b8;
    font-size: 0.95rem;
    text-align: center;
}

.category-order-loading {
    color: #94a3b8;
    font-size: 0.95rem;
    text-align: center;
}

.category-order-list-header,
.category-order-item {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr) minmax(0, 1.35fr) auto;
    align-items: center;
    gap: 0.75rem;
}

.category-order-list-header {
    padding: 0 1rem 0.25rem;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.category-order-header-handle {
    width: 1.5rem;
}

.category-order-header-public {
    justify-self: end;
}

.category-order-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.category-order-item {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: grab;
    transition: border-color 0.2s, background-color 0.2s, opacity 0.2s;
}

.category-order-item.dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.category-order-item:hover {
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.1);
}

.category-order-handle {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 700;
    letter-spacing: 0.08em;
    user-select: none;
}

.category-order-label {
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-order-display-input {
    width: 100%;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(15, 23, 42, 0.55);
    color: #f8fafc;
    font-size: 0.9rem;
}

.category-order-display-input::placeholder {
    color: #64748b;
}

.category-order-display-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.75);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.category-order-public-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #cbd5e1;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    justify-self: end;
}

.category-order-public-input {
    width: 1rem;
    height: 1rem;
    accent-color: #6366f1;
    cursor: pointer;
}

.category-order-public-label {
    white-space: nowrap;
}

.category-order-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

#category-order-modal .btn-primary {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s, background-color 0.2s;
    background: #6366f1;
    color: #fff;
}

#category-order-modal .btn-primary:hover:not(:disabled) {
    background: #4f46e5;
}

#category-order-modal .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 560px) {
    .category-order-list-header {
        display: none;
    }

    .category-order-item {
        grid-template-columns: 1.5rem minmax(0, 1fr);
        grid-template-areas:
            "handle label"
            "handle display"
            "handle public";
    }

    .category-order-handle {
        grid-area: handle;
        align-self: start;
        margin-top: 0.15rem;
    }

    .category-order-label {
        grid-area: label;
    }

    .category-order-display-input {
        grid-area: display;
    }

    .category-order-public-toggle {
        grid-area: public;
        justify-self: start;
    }
}
